I am trying to change a domain configuration from a python script. More specific, I want to edit the VNC settings. You can't do this using the libvirt API so you have to edit the domain configuration:

Fo exmple, to disable VNC for a domain 'test1':

vmXml = vm.XMLDesc(0)
root = ET.fromstring(vmXml)
devices = root.find('./devices')
graphics = devices.find('graphics')
devices.remove(graphics)
xml = ET.tostring(root)
with open('path_to/test1.xml', 'w') as f:
f.write(xml)

not the problem is with the test1.xml. Even though the domain configuration seems to be stored there, the file seems to be regenerated/overwritten so any changes I make will not take effect.

So the question really is: where is the domain configuration stored? Am I editing the write file, or am I missing something?

Thanks,
Andrei

The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of or taking of any action in reliance upon this information by persons or entities other than the intended recipient is prohibited. If you receive this in error please contact the sender and delete the material from any computer immediately. It is the policy of Klas  Limited to disavow the sending of offensive material and should you consider that the material contained in the message is offensive you should contact the sender immediately and also your I.T. Manager.

Klas Telecom Inc., a Virginia Corporation with offices at 1101 30th St. NW, Washington, DC 20007.

Klas Limited (Company Number 163303) trading as Klas Telecom, an Irish Limited Liability Company, with its registered office at Fourth Floor, One Kilmainham Square, Inchicore Road, Kilmainham, Dublin 8, Ireland.