于 2011年10月21日 17:32, vmnode guy 写道:
Hi All,
I am new to libvirt, i wander how we can achieve below objective, i read through a lot from libvirt.org but couldn't found any thing solid something equivalent to this:-

  virsh dumpxml dom > /tmp/dom.xml
  $EDITOR /tmp/dom.xml && virsh define /tmp/dom.xml

What i try to achieve is to have one management server that install with libvirt in place then we can use libvirt to connect to other libvirt box to provision the vm-create, vm-delete & capable to vm-modified the CPU,MEM,HDD,boot sequence, vnc password attached & detech network card..on the targeted VM.

there are commands to do the modifications? e.g.

for vnc password changes, HDD:
    # virsh update-device

for mem:
    # virsh setmem
    # virsh setmaxmem

for detach/attach NIC:
    # virsh attach-device
    # virsh detach-device

Not sure how you want to modify the "CPU", you could
see if following commands satisfy you requirement:

    # virsh setvcpus (if you are using qemu-kvm, the cpus in guest won't
                                be hotpluged/unhotpluged actually, as it lacks support)
    # virsh vcpupin

All these commands support change persistent config, But if you are trying
to modify a bunch of domains, scripts is better, though it's not supported
offically by libvirt to modify the domain configs externally.

Regards
Osier