Closed mlibre closed 4 years ago
Hi, I think you're looking for domainDefineXML(xml: string): Promise<Domain>
. The xml does already contain the domains name, uuid, id etc. and libvirt should therefore not define a new domain but modify the existing one.
Oh, that is cool. I will try. thanks.
Unfortunately it does not work:
(node:29223) UnhandledPromiseRejectionWarning: operation failed: domain 'ubuntu18.04' is already defined with uuid 703ecb98-536a-45dd-b101-bc460f587c62
I’ve read this in the documentation for the define function: “A previous definition for this domain would be overridden if it already exists.” That’s basically what I mentioned earlier. It’s like doing virsh dumpxml
and virsh define
to edit the domain.
Are you trying to change the name of the domain?
According to http://rcritical.blogspot.com/2011/02/kvm-virtual-machine-renaming.html?m=1 the error you encountered, occurs when trying to change the domains name. It seems that changing the name requires to undefined the domain first and then define it using the new name.
Oh. yes, I was trying to change the name. So is there any way to undefine the domain with your library?
Currently no. I can implement it in next PR while @leonrinkel busy
ok. thank you
Hey. Is there any way I can fetch a VM XML, modify it and save it there again. Like: