[libvirt] Use existing QEMU image with libvirt?

Cole Robinson crobinso at redhat.com
Tue Aug 19 16:55:55 UTC 2008


Jun Koi wrote:
> Hi,
> 
> I have some existing QEMU images. Now I want to use it with
> libvirt/virsh. Is there any easy way to do that?
> 
> I suppose that we need an XML file for each image, but dont want to
> craft them from scratch.
> 
> Thanks,
> Jun
> 

There isn't really an official way to do this, but we will
probably add some explicit support for it to virt-install
or virt-manager down the line.

You can try something like this (obviously this is
dependent on your previous virt-install troubles being
fixed):

virt-install --name somename --ram 256 --vnc \
	     --hvm --accelerate \
             --cdrom /some/existing/file \
             --file /path/to/existing/image \

The vnc console should pop up, but if you just pointed to
some useless file for cdrom boot will fail (which is fine).
Just kill virt-install, run 'virsh destroy somename' (this
will hard poweroff the VM), and the VM should be good to
go for future runs.

- Cole




More information about the libvir-list mailing list