domain: how long is new xml in saved file

Vincent Wu vincentwu0101 at qq.com
Fri Apr 24 04:38:08 UTC 2020


Hi administrator,
	I am a cloud compute developer. I need some help from you about libvirt.
	I have a work to modify a image file which is saved by virDomainSave() or virDomainSaveFlags(). So virDomainSaveImageGetXMLDesc() and virDomainSaveImageDefineXML() are APIs I choosed to do.
	Because I found a sentence: A save file can be inspected or modified slightly with virDomainSaveImageGetXMLDesc() and virDomainSaveImageDefineXML().
	But an error is happened when I do like that.  libvirt: QEMU Driver error: operation failed: new xml too large to fit in file.
	
	I found that if I increase strlen(xml_old) to strlen(xml_new).
	if (strlen(xml_new) - strlen(xml_old) <= 29) {
		this is right;
	}
	but if (strlen(xml_new) - strlen(xml_old) >= 50) {
		this is error;
	}
	But I don't choose to find an accurate number.  I think this value will be affected by some factors.
	For example: memory alignment, range safety or other rules.


	++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
	+                                                           strlen(xml_old)                                                  +  free space  +
	++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
	+                                                             strlen(xml_new)                                                                     +
	++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
	I really want to know how long free space I can use. Can you convert slightly to a precise number?
	Thank you for taking so long to read my Email.
	Looking forward to your reply.
	
	ps:
		OS: CentOS7.4
		libvirt: 4.5.0
		hypervisor: KVM
	
	Sincerely, 
	Vincent Wu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/libvirt-users/attachments/20200424/590d604f/attachment.htm>


More information about the libvirt-users mailing list