qemu: Implement qemuDomainManagedSaveDefineXML

This commit adds qemu driver implementation to edit xml
configuration of managed save state file of a domain.

Signed-off-by: Kothapally Madhu Pavan <kmp@linux.vnet.ibm.com>
This commit is contained in:
Kothapally Madhu Pavan 2017-08-08 13:32:52 +05:30 committed by Peter Krempa
parent 18d4cafef7
commit 021f7c132b

View File

@ -6841,6 +6841,39 @@ qemuDomainManagedSaveGetXMLDesc(virDomainPtr dom, unsigned int flags)
return ret;
}
static int
qemuDomainManagedSaveDefineXML(virDomainPtr dom, const char *dxml,
unsigned int flags)
{
virQEMUDriverPtr driver = dom->conn->privateData;
virConnectPtr conn = dom->conn;
virDomainObjPtr vm;
char *path = NULL;
int ret = -1;
if (!(vm = qemuDomObjFromDomain(dom)))
return -1;
if (virDomainManagedSaveDefineXMLEnsureACL(conn, vm->def) < 0)
goto cleanup;
if (!(path = qemuDomainManagedSavePath(driver, vm)))
goto cleanup;
if (!virFileExists(path)) {
virReportError(VIR_ERR_OPERATION_INVALID, "%s",
_("domain does not have managed save image"));
goto cleanup;
}
ret = qemuDomainSaveImageDefineXML(conn, path, dxml, flags);
cleanup:
virDomainObjEndAPI(&vm);
VIR_FREE(path);
return ret;
}
/* Return 0 on success, 1 if incomplete saved image was silently unlinked,
* and -1 on failure with error raised. */
static int
@ -20945,6 +20978,7 @@ static virHypervisorDriver qemuHypervisorDriver = {
.domainHasManagedSaveImage = qemuDomainHasManagedSaveImage, /* 0.8.0 */
.domainManagedSaveRemove = qemuDomainManagedSaveRemove, /* 0.8.0 */
.domainManagedSaveGetXMLDesc = qemuDomainManagedSaveGetXMLDesc, /* 3.7.0 */
.domainManagedSaveDefineXML = qemuDomainManagedSaveDefineXML, /* 3.7.0 */
.domainSnapshotCreateXML = qemuDomainSnapshotCreateXML, /* 0.8.0 */
.domainSnapshotGetXMLDesc = qemuDomainSnapshotGetXMLDesc, /* 0.8.0 */
.domainSnapshotNum = qemuDomainSnapshotNum, /* 0.8.0 */