I am using.

virsh -c qemu:///system edit VM-Name

And adding comments.

<!-- test comment here -->

It won't complain.* But the comment is removed.

*Usually if you make a syntax error (for example add an extra >) somewhere), it says something like this.

error: (domain_definition):75: Extra content at the end of the document
 Failed. Try again? [y,n,f,?]:

Is there any way to preserve comments in virsh / libvirt xml files?


It appears that now you can, copy your xml file somewhere, tell virsh to use it :

virsh define ~/vm.xml

and comment what you want.

When you launch the vm, virsh will make a copy of the file in /etc/libvirt, remove comments there and start the vm, thus not touching your original xml file /etc/libvirt.


Until the current version, you can't use comments.

  • 2
    One-line answers are often not the most helpful. Consider expanding your answer to include some links/explanation or documentation which support your assertion. – HalosGhost Aug 28 '14 at 15:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.