[virt-tools-list] Question about the image format

Daniel P. Berrange berrange at redhat.com
Thu Apr 8 14:09:14 UTC 2010


On Thu, Apr 08, 2010 at 09:58:51AM -0400, Cole Robinson wrote:
> On 04/07/2010 10:45 PM, Dustin Xiong wrote:
> > 
> > 
> > 
> >> Date: Tue, 6 Apr 2010 14:17:47 +0800
> >> Subject: Re: [virt-tools-list] Question about the image format
> >> From: miles.kuo at gmail.com
> >> To: x_k_123 at hotmail.com
> >> CC: virt-tools-list at redhat.com
> >>
> >> The virt-manager supports it I think. I've tried it on
> >> virt-manager-0.8.3 and it works well as the qemu-kvm commands.
> >>
> >> Could you paste your XML file of the VM under virt-manager here?
> >>
> > I can't create the VM, so I didn't have the XML file.
> > But I could use the same way to create VM2. The only differences is the disk images.
> > The vm2.img comes from this command : qemu-img create -f qcow vm2.img 4G
> > The vm3.img comes from the command :  qemu-img create -b vm1.img -f qcow vm3.img
> > 
> > virsh # create vm3.xml
> > error: Failed to create domain from vm3.xml
> > error: internal error unable to start guest: qemu: could not open disk image /var/lib/libvirt/images/vm3.img
> > 
> > virsh # create vm2.xml
> > Domain vm2 created from vm2.xml
> > 
> > The XML file as below:
> > <domain type='kvm'>
> >   <name>vm2</name>
> >   <uuid>7cb40798-1247-85e3-5e5b-e044eafbfff3</uuid>
> >   <memory>524288</memory>
> >   <currentMemory>524288</currentMemory>
> >   <vcpu>1</vcpu>
> >   <os>
> >     <type arch='i686' machine='pc-0.11'>hvm</type>
> >     <boot dev='hd'/>
> >   </os>
> >   <features>
> >     <acpi/>
> >     <apic/>
> >     <pae/>
> >   </features>
> >   <clock offset='utc'/>
> >   <on_poweroff>destroy</on_poweroff>
> >   <on_reboot>restart</on_reboot>
> >   <on_crash>restart</on_crash>
> >   <devices>
> >     <emulator>/usr/bin/kvm</emulator>
> >     <disk type='file' device='disk'>
> >       <driver name='qemu' type='qcow'/>
> >       <source file='/var/lib/libvirt/images/vm2.img'/>
> >       <target dev='hda' bus='ide'/>
> >     </disk>
> >     <disk type='block' device='cdrom'>
> >       <driver name='qemu' type='raw'/>
> >       <target dev='hdc' bus='ide'/>
> >       <readonly/>
> >     </disk>
> >     <interface type='network'>
> >       <mac address='52:54:00:5d:2c:c6'/>
> >       <source network='default'/>
> >     </interface>
> >     <serial type='pty'>
> >       <target port='0'/>
> >     </serial>
> >     <console type='pty'>
> >       <target port='0'/>
> >     </console>
> >     <input type='mouse' bus='ps2'/>
> >     <graphics type='vnc' port='-1' autoport='yes' keymap='en-us'/>
> >     <video>
> >       <model type='cirrus' vram='9216' heads='1'/>
> >     </video>
> >   </devices>
> > </domain>
> > 
> > 
> > <domain type='kvm'>
> >   <name>vm3</name>
> >   <uuid>7cb40798-1247-85e3-5e5b-e044eafbfff3</uuid>
> >   <memory>524288</memory>
> >   <currentMemory>524288</currentMemory>
> >   <vcpu>1</vcpu>
> >   <os>
> >     <type arch='i686' machine='pc-0.11'>hvm</type>
> >     <boot dev='hd'/>
> >   </os>
> >   <features>
> >     <acpi/>
> >     <apic/>
> >     <pae/>
> >   </features>
> >   <clock offset='utc'/>
> >   <on_poweroff>destroy</on_poweroff>
> >   <on_reboot>restart</on_reboot>
> >   <on_crash>restart</on_crash>
> >   <devices>
> >     <emulator>/usr/bin/kvm</emulator>
> >     <disk type='file' device='disk'>
> >       <driver name='qemu' type='qcow'/>
> >       <source file='/var/lib/libvirt/images/vm3.img'/>
> >       <target dev='hda' bus='ide'/>
> >     </disk>
> >     <disk type='block' device='cdrom'>
> >       <driver name='qemu' type='raw'/>
> >       <target dev='hdc' bus='ide'/>
> >       <readonly/>
> >     </disk>
> >     <interface type='network'>
> >       <mac address='52:54:00:5d:2c:c6'/>
> >       <source network='default'/>
> >     </interface>
> >     <serial type='pty'>
> >       <target port='0'/>
> >     </serial>
> >     <console type='pty'>
> >       <target port='0'/>
> >     </console>
> >     <input type='mouse' bus='ps2'/>
> >     <graphics type='vnc' port='-1' autoport='yes' keymap='en-us'/>
> >     <video>
> >       <model type='cirrus' vram='9216' heads='1'/>
> >     </video>
> >   </devices>
> > </domain>
> > 
> > 
> >>> I use the command 'qemu-img create -b vm1.img -f qcow vdisk.img'
> >>> create a new image vdisk.img. When I use virt-manager create a new VM based
> >>> on vdisk.img, failed.
> >>> The error as below:
> >>>
> >>> Unable to complete install '<class 'libvirt.libvirtError'> internal error
> >>> unable to start guest: qemu: could not open disk image
> >>> /media/disk/images/vdisk.img
> >>>
> >>> Traceback (most recent call last):
> >>>   File "/usr/local/share/virt-manager/virtManager/create.py", line 1437, in
> >>> do_install
> >>>     dom = guest.start_install(False, meter = meter)
> >>>   File "/usr/local/lib/python2.6/dist-packages/virtinst/Guest.py", line 795,
> >>> in start_install
> >>>     return self._do_install(consolecb, meter, removeOld, wait)
> >>>   File "/usr/local/lib/python2.6/dist-packages/virtinst/Guest.py", line 896,
> >>> in _do_install
> >>>     self.domain = self.conn.createLinux(install_xml, 0)
> >>>   File "/usr/lib/python2.6/dist-packages! /libvirt.py", line 1077, in
> >>> createLinux
> >>>     if ret is None:raise libvirtError('virDomainCreateLinux() failed',
> >>> conn=self)
> >>> libvirtError: internal error unable to start guest: qemu: could not open
> >>> disk image /media/disk/images/vdisk.img
> >>>
> >>> But if I don't use virt-manager. I just use the command
> >>> kvm -hda vdisk.img -m 1024 -cdrom rhel-server-5.4-i386-dvd.iso -boot d
> >>> or kvm vdisk.img -m 1024
> >>> The VM could running.
> >>>
> >>> So I want to ask whether the virt-manager support the disk created by
> >>> 'qemu-img create -b vm1.img -f qcow vdisk.img' or not.
> >>>
> >>> Thank you very much.
> >>>
> 
> There is a similar bug already filed against libvirt in fedora:
> 
> https://bugzilla.redhat.com/show_bug.cgi?id=579067
> 
> I don't think the security drivers know to change permissions of qcow2
> backing files when launching a domain.

Yes they do know how to deal with backing files, at least in the current
libvirt release.


Daniel
-- 
|: Red Hat, Engineering, London    -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org -o- http://virt-manager.org -o- http://deltacloud.org :|
|: http://autobuild.org        -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-   F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|




More information about the virt-tools-list mailing list