I like to set up a new guest but do not want to start it immediately. I use virt-install with these options:

virt-install \
    --connect qemu:///system \
    --import \
    --virt-type kvm \
    --name somevm \
    --os-variant win7 \
    --memory 2048 \
    --vcpus 1 \
    --disk /home/bla/VirtualMachines/somevm.qcow2,format=qcow2,device=disk \
    --network network=default \
    --noautoconsole \
    --sound default

But virt-install will always start the VM. I can not find any option in the man page to disable the automatic start. I would rather not call virsh destroy somevm right after the install, although the VM will probably not be booted up yet... Is it possible to prevent the start of the guest with virt-install or is there another tool which can do the same but do not start the guest?

I also found some kind of workaround: instead of using --import, you can install the VM with --pxe. If no PXE server is available, then this should give enough time to destroy the guest using virsh.

up vote 1 down vote accepted

The --print-xml option to virt-install might get closer to what you want. You could then feed the XML it prints into the virsh define command to create, but not start, the guest.

Alternatively checkout the virt-xml tool which is simply a friendly way to build up an XML document from args like those you'd give to virt-install

  • --print-xml looks very promising! thanks! – reox Jul 5 at 10:57

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.