ANNOUNCE: virt-xml: Edit libvirt XML with command line options

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I've just pushed a new tool to virt-manager.git called virt-xml. virt-xml uses
virt-install's command line options to allow building and editing domain XML.
Best way to describe what it can do is with a bunch of examples:


See a list of all suboptions that --disk and --network take

  # virt-xml --disk=? --network=?

Change the <description> of domain 'example':

  # virt-xml example --edit --metadata description="my new description"

# Enable the boot device menu for domain 'example':

  # virt-xml example --edit --boot bootmenu=on

Clear the previous <cpu> definition of domain 'winxp', change it to
'host-model', but interactively confirm the diff before saving:

  # virt-xml winxp --edit --cpu host-model,clearxml=yes --confirm

Change the sound cards with model=ac97 to model=ich6 on 'fedora19', but only
output the diff:

  # virt-xml fedora19 --edit model=ac97 --soundhw model=ich6 --print-diff

Update the first graphics password to 'foo' of the running VM 'rhel6':

  # virt-xml rhel6 --edit --graphics password=foo --update

Remove the disk path from disk device hdc:

  # virt-xml rhel6 --edit target=hdc --disk path=

Change all disk devices of type 'disk' to use cache=none, using XML from
stdin, printing the new XML to stdout.

  # cat <xmlfile> | virt-xml --edit device=disk --disk cache=none

Change all host devices to use driver_name=vfio for VM 'fedora20' on the
remote connection

  # virt-xml --connect qemu+ssh://remotehost/system \
             fedora20 --edit all --host-device driver_name=vfio

Hotplug host USB device 001.003 to running domain 'fedora19':

  # virt-xml f19 --add-device --host-device 001.003 --update

Add a spicevmc channel to the domain 'winxp', that will be available after the
next VM shutdown.

  # virt-xml winxp --add-device --channel spicevmc

Create a 10G qcow2 disk image and attach it to 'fedora18' for the next VM startup:

  # virt-xml fedora18 --add-device \
    --disk /var/lib/libvirt/images/newimage.qcow2,format=qcow2,size=10

Remove the disk vdb from the running domain 'rhel7':

  # virt-xml rhel7 --remove-device --disk target=vdb

Remove all graphics devices from the VM 'rhel7' after the next shutdown:

  # virt-xml rhel7 --remove-device --graphics all

Generate XML for a virtio console device and print it to stdout:

  # virt-xml --build-xml --console pty,target_type=virtio


The man page and --help output have more info, man page at:
https://git.fedorahosted.org/cgit/virt-manager.git/tree/man/virt-xml.pod

If you are interested in trying it out before it hits any distro, it's really
simple:

git clone git://git.fedorahosted.org/virt-manager.git
cd virt-manager
./virt-xml --help

Nothing is set in stone yet, so if anyone has suggestions about the command
line syntax or any of the above, please speak up: I plan on cutting a new
virt-manager release with virt-xml within the next few weeks.

Thanks,
Cole

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]