On 01/08/2014 01:56 PM, kangta123 wrote:
Hi,
I'm a newbie to Libvirt, i want to know if i can change the vm definition xml
dynamically. like change cpu, network value.
You can't do that with hooks. You'll need to edit the domain definition before
you ask libvirt to start it.
I found the hook in Libvirt, and i can get the xml from standard input. but i change it
and out put to standard output, it no effect.
Libvirt only reads the standard output of the migrate hook script.
I was try to execute “virsh define” shell command in python script on hook, but it was
blocked and unabled to execute another Libvirt command.
You shouldn't call libvirt functions from your hook script, see
http://libvirt.org/hooks.html#recursive or [1].
Is there create vm hook in Libvirt?
No (and it wouldn't let you change the definition anyway).
Jan
[1]
https://www.redhat.com/archives/libvirt-users/2013-November/msg00020.html