mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 13:45:38 +00:00
lib: Add API to edit domain's managed save state xml configuration
Similar to domainSaveImageDefineXML this commit adds domainManagedSaveDefineXML API which allows to edit domain's managed save state xml configuration. Signed-off-by: Kothapally Madhu Pavan <kmp@linux.vnet.ibm.com>
This commit is contained in:
parent
a67e3872a6
commit
1558f2584f
@ -1215,6 +1215,10 @@ int virDomainManagedSaveRemove(virDomainPtr dom,
|
||||
unsigned int flags);
|
||||
char * virDomainManagedSaveGetXMLDesc(virDomainPtr domain,
|
||||
unsigned int flags);
|
||||
int virDomainManagedSaveDefineXML(virDomainPtr domain,
|
||||
const char *dxml,
|
||||
unsigned int flags);
|
||||
|
||||
|
||||
/*
|
||||
* Domain core dump
|
||||
|
@ -754,6 +754,11 @@ typedef char *
|
||||
(*virDrvDomainManagedSaveGetXMLDesc)(virDomainPtr domain,
|
||||
unsigned int flags);
|
||||
|
||||
typedef int
|
||||
(*virDrvDomainManagedSaveDefineXML)(virDomainPtr domain,
|
||||
const char *dxml,
|
||||
unsigned int flags);
|
||||
|
||||
typedef virDomainSnapshotPtr
|
||||
(*virDrvDomainSnapshotCreateXML)(virDomainPtr domain,
|
||||
const char *xmlDesc,
|
||||
@ -1433,6 +1438,7 @@ struct _virHypervisorDriver {
|
||||
virDrvDomainHasManagedSaveImage domainHasManagedSaveImage;
|
||||
virDrvDomainManagedSaveRemove domainManagedSaveRemove;
|
||||
virDrvDomainManagedSaveGetXMLDesc domainManagedSaveGetXMLDesc;
|
||||
virDrvDomainManagedSaveDefineXML domainManagedSaveDefineXML;
|
||||
virDrvDomainSnapshotCreateXML domainSnapshotCreateXML;
|
||||
virDrvDomainSnapshotGetXMLDesc domainSnapshotGetXMLDesc;
|
||||
virDrvDomainSnapshotNum domainSnapshotNum;
|
||||
|
@ -9389,6 +9389,63 @@ virDomainManagedSaveGetXMLDesc(virDomainPtr domain, unsigned int flags)
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* virDomainManagedSaveDefineXML:
|
||||
* @domain: a domain object
|
||||
* @dxml: XML config for adjusting guest xml used on restore
|
||||
* @flags: bitwise-OR of virDomainSaveRestoreFlags
|
||||
*
|
||||
* This updates the definition of a domain stored in a saved state
|
||||
* file.
|
||||
*
|
||||
* @dxml can be used to alter host-specific portions of the domain XML
|
||||
* that will be used on the next start of the domain. For example, it is
|
||||
* possible to alter the backing filename that is associated with a
|
||||
* disk device.
|
||||
*
|
||||
* Normally, the saved state file will remember whether the domain was
|
||||
* running or paused, and restore defaults to the same state.
|
||||
* Specifying VIR_DOMAIN_SAVE_RUNNING or VIR_DOMAIN_SAVE_PAUSED in
|
||||
* @flags will override the default saved into the file; omitting both
|
||||
* leaves the file's default unchanged. These two flags are mutually
|
||||
* exclusive.
|
||||
*
|
||||
* Returns 0 in case of success and -1 in case of failure.
|
||||
*/
|
||||
int
|
||||
virDomainManagedSaveDefineXML(virDomainPtr domain, const char *dxml,
|
||||
unsigned int flags)
|
||||
{
|
||||
virConnectPtr conn;
|
||||
|
||||
VIR_DOMAIN_DEBUG(domain, "flags=%x", flags);
|
||||
|
||||
virResetLastError();
|
||||
|
||||
VIR_EXCLUSIVE_FLAGS_GOTO(VIR_DOMAIN_SAVE_RUNNING,
|
||||
VIR_DOMAIN_SAVE_PAUSED,
|
||||
error);
|
||||
|
||||
virCheckDomainReturn(domain, -1);
|
||||
conn = domain->conn;
|
||||
|
||||
if (conn->driver->domainManagedSaveDefineXML) {
|
||||
int ret;
|
||||
ret = conn->driver->domainManagedSaveDefineXML(domain, dxml, flags);
|
||||
|
||||
if (ret < 0)
|
||||
goto error;
|
||||
return ret;
|
||||
}
|
||||
|
||||
virReportUnsupportedError();
|
||||
|
||||
error:
|
||||
virDispatchError(domain->conn);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* virDomainOpenConsole:
|
||||
* @dom: a domain object
|
||||
|
@ -772,5 +772,6 @@ LIBVIRT_3.7.0 {
|
||||
global:
|
||||
virDomainMigrateGetMaxDowntime;
|
||||
virDomainManagedSaveGetXMLDesc;
|
||||
virDomainManagedSaveDefineXML;
|
||||
} LIBVIRT_3.4.0;
|
||||
# .... define new API here using predicted next version number ....
|
||||
|
@ -8412,6 +8412,7 @@ static virHypervisorDriver hypervisor_driver = {
|
||||
.domainHasManagedSaveImage = remoteDomainHasManagedSaveImage, /* 0.8.0 */
|
||||
.domainManagedSaveRemove = remoteDomainManagedSaveRemove, /* 0.8.0 */
|
||||
.domainManagedSaveGetXMLDesc = remoteDomainManagedSaveGetXMLDesc, /* 3.7.0 */
|
||||
.domainManagedSaveDefineXML = remoteDomainManagedSaveDefineXML, /* 3.7.0 */
|
||||
.domainSnapshotCreateXML = remoteDomainSnapshotCreateXML, /* 0.8.0 */
|
||||
.domainSnapshotGetXMLDesc = remoteDomainSnapshotGetXMLDesc, /* 0.8.0 */
|
||||
.domainSnapshotNum = remoteDomainSnapshotNum, /* 0.8.0 */
|
||||
|
@ -2565,6 +2565,12 @@ struct remote_domain_managed_save_get_xml_desc_ret {
|
||||
remote_nonnull_string xml;
|
||||
};
|
||||
|
||||
struct remote_domain_managed_save_define_xml_args {
|
||||
remote_nonnull_domain dom;
|
||||
remote_string dxml;
|
||||
unsigned int flags;
|
||||
};
|
||||
|
||||
struct remote_domain_snapshot_create_xml_args {
|
||||
remote_nonnull_domain dom;
|
||||
remote_nonnull_string xml_desc;
|
||||
@ -6095,5 +6101,12 @@ enum remote_procedure {
|
||||
* @acl: domain:read
|
||||
* @acl: domain:read_secure:VIR_DOMAIN_XML_SECURE
|
||||
*/
|
||||
REMOTE_PROC_DOMAIN_MANAGED_SAVE_GET_XML_DESC = 388
|
||||
REMOTE_PROC_DOMAIN_MANAGED_SAVE_GET_XML_DESC = 388,
|
||||
|
||||
/**
|
||||
* @generate: both
|
||||
* @acl: domain:write
|
||||
* @acl: domain:hibernate
|
||||
*/
|
||||
REMOTE_PROC_DOMAIN_MANAGED_SAVE_DEFINE_XML = 389
|
||||
};
|
||||
|
@ -1977,6 +1977,11 @@ struct remote_domain_managed_save_get_xml_desc_args {
|
||||
struct remote_domain_managed_save_get_xml_desc_ret {
|
||||
remote_nonnull_string xml;
|
||||
};
|
||||
struct remote_domain_managed_save_define_xml_args {
|
||||
remote_nonnull_domain dom;
|
||||
remote_string dxml;
|
||||
u_int flags;
|
||||
};
|
||||
struct remote_domain_snapshot_create_xml_args {
|
||||
remote_nonnull_domain dom;
|
||||
remote_nonnull_string xml_desc;
|
||||
@ -3249,4 +3254,5 @@ enum remote_procedure {
|
||||
REMOTE_PROC_DOMAIN_SET_BLOCK_THRESHOLD = 386,
|
||||
REMOTE_PROC_DOMAIN_MIGRATE_GET_MAX_DOWNTIME = 387,
|
||||
REMOTE_PROC_DOMAIN_MANAGED_SAVE_GET_XML_DESC = 388,
|
||||
REMOTE_PROC_DOMAIN_MANAGED_SAVE_DEFINE_XML = 389,
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user