[Libvir] Re: support for hvm guests

Jim Fehlig jfehlig at novell.com
Thu May 11 00:25:07 UTC 2006


Anthony Liguori wrote:

> Jim Fehlig wrote:
>
>>
>> Tomorrow ended up being several days later :-).  I looked at this 
>> again today and must say that this is a frustrating bug - feeling 
>> like some CS101 student.
>>
>> So I was wrong in stating that xend does not respond to the create op 
>> issued by libvirt.  I get the expected response from xend but the 
>> connection is not closed upon completing the request, thus I set in 
>> some read loop in libvirt waiting for eof.  I stepped through the 
>> request processing code in xend for create op for both 
>> paravirtualized and hvm guests and all seems fine, i.e. request is 
>> processed, finished, socket closed, etc. in httpserver.py.  Looking 
>> at a packet trace shows connection is terminated for paravirt case 
>> (which breaks out of the read loop in libvirt) but not so for hvm case.
>
>
> The proper way to do the S-Expression RPC (or XML-RPC for that matter) 
> is to look at the Content-Length header in the response and read back 
> that much data (close()'ing the connection once you've gotten that 
> amount).  We shouldn't wait for EOF to occur to stop reading.
>
> There was a patch recently that changed the read() behavior to read in 
> larger amounts.  It appears that when this was added, the behavior was 
> changed to expect EOF.  Sorry, I should have looked at that patch more 
> carefully.  If you revert xend_post to the older code, things should 
> go back to working.


grr...  Yes, this worked.  So I'm able to launch hvm guests now but in 
the process of incorporating comments about the XML format for such 
guests I have come across another issue that could be handled in libvirt 
but perhaps a better place would be xend.  The issue is structure of 
s-exp sent to xend.  Currently xend appears to only accept things such 
as (vnc 1), (cdrom /dev/hdd) within the (image (hvm ...)) node.  Well 
xend does accept something like "... (image (hvm ...(boot d))) (cdrom 
/dev/hdd) (vnc 1)...", but the resulting domain is not configured 
properly.  With this config I get the following in xend.log:

[2006-05-10 17:11:48 xend] DEBUG (image:267) args: cdrom, val: None

This list has agreed that cdrom and graphics should be in the devices 
section of libvirt's XML format, e.g.

<os>
  <type>hvm</type>
  ...
  <boot dev='hdd'>
<os>
<devices>
  <disk type='block'>
    <source dev='hdd'/>
    <target dev='hdd'/>
    <cdrom/>
  </disk>
  <graphics type='vnc'>
  </graphics>
  ...
</devices>

I can certainly add code in libvirt to handle converting this XML to the 
s-exp currently expected by xend but it makes for a larger patch.  It 
almost seems better to have xend accept definition of cdrom and graphics 
outside of image node, e.g.

(image
  (hvm
    ...
    (boot d)
  )
)
(cdrom /dev/hdd)
(vnc 1)
(other graphics-related options)

Any thoughts before I go off and rework the XML -> s-exp code in libvirt?

Regards,
Jim




More information about the libvir-list mailing list