mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 13:45:38 +00:00
lib: Add API to dump xml configuration of managed save state domain
Similar to domainSaveImageGetXMLDesc this commit adds domainManagedSaveGetXMLDesc API which allows to get the xml of managed save state domain. Signed-off-by: Kothapally Madhu Pavan <kmp@linux.vnet.ibm.com>
This commit is contained in:
parent
3ee9bdbe35
commit
a67e3872a6
@ -1213,6 +1213,8 @@ int virDomainHasManagedSaveImage(virDomainPtr dom,
|
|||||||
unsigned int flags);
|
unsigned int flags);
|
||||||
int virDomainManagedSaveRemove(virDomainPtr dom,
|
int virDomainManagedSaveRemove(virDomainPtr dom,
|
||||||
unsigned int flags);
|
unsigned int flags);
|
||||||
|
char * virDomainManagedSaveGetXMLDesc(virDomainPtr domain,
|
||||||
|
unsigned int flags);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Domain core dump
|
* Domain core dump
|
||||||
|
@ -750,6 +750,10 @@ typedef int
|
|||||||
(*virDrvDomainManagedSaveRemove)(virDomainPtr domain,
|
(*virDrvDomainManagedSaveRemove)(virDomainPtr domain,
|
||||||
unsigned int flags);
|
unsigned int flags);
|
||||||
|
|
||||||
|
typedef char *
|
||||||
|
(*virDrvDomainManagedSaveGetXMLDesc)(virDomainPtr domain,
|
||||||
|
unsigned int flags);
|
||||||
|
|
||||||
typedef virDomainSnapshotPtr
|
typedef virDomainSnapshotPtr
|
||||||
(*virDrvDomainSnapshotCreateXML)(virDomainPtr domain,
|
(*virDrvDomainSnapshotCreateXML)(virDomainPtr domain,
|
||||||
const char *xmlDesc,
|
const char *xmlDesc,
|
||||||
@ -1428,6 +1432,7 @@ struct _virHypervisorDriver {
|
|||||||
virDrvDomainManagedSave domainManagedSave;
|
virDrvDomainManagedSave domainManagedSave;
|
||||||
virDrvDomainHasManagedSaveImage domainHasManagedSaveImage;
|
virDrvDomainHasManagedSaveImage domainHasManagedSaveImage;
|
||||||
virDrvDomainManagedSaveRemove domainManagedSaveRemove;
|
virDrvDomainManagedSaveRemove domainManagedSaveRemove;
|
||||||
|
virDrvDomainManagedSaveGetXMLDesc domainManagedSaveGetXMLDesc;
|
||||||
virDrvDomainSnapshotCreateXML domainSnapshotCreateXML;
|
virDrvDomainSnapshotCreateXML domainSnapshotCreateXML;
|
||||||
virDrvDomainSnapshotGetXMLDesc domainSnapshotGetXMLDesc;
|
virDrvDomainSnapshotGetXMLDesc domainSnapshotGetXMLDesc;
|
||||||
virDrvDomainSnapshotNum domainSnapshotNum;
|
virDrvDomainSnapshotNum domainSnapshotNum;
|
||||||
|
@ -9339,6 +9339,55 @@ virDomainManagedSaveRemove(virDomainPtr dom, unsigned int flags)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* virDomainManagedSaveGetXMLDesc:
|
||||||
|
* @domain: a domain object
|
||||||
|
* @flags: bitwise-OR of subset of virDomainXMLFlags
|
||||||
|
*
|
||||||
|
* This method will extract the XML description of the managed save
|
||||||
|
* state file of a domain.
|
||||||
|
*
|
||||||
|
* No security-sensitive data will be included unless @flags contains
|
||||||
|
* VIR_DOMAIN_XML_SECURE; this flag is rejected on read-only
|
||||||
|
* connections. For this API, @flags should not contain either
|
||||||
|
* VIR_DOMAIN_XML_INACTIVE or VIR_DOMAIN_XML_UPDATE_CPU.
|
||||||
|
*
|
||||||
|
* Returns a 0 terminated UTF-8 encoded XML instance, or NULL in case of
|
||||||
|
* error. The caller must free() the returned value.
|
||||||
|
*/
|
||||||
|
char *
|
||||||
|
virDomainManagedSaveGetXMLDesc(virDomainPtr domain, unsigned int flags)
|
||||||
|
{
|
||||||
|
virConnectPtr conn;
|
||||||
|
|
||||||
|
VIR_DOMAIN_DEBUG(domain, "flags=%x", flags);
|
||||||
|
|
||||||
|
virResetLastError();
|
||||||
|
|
||||||
|
virCheckDomainReturn(domain, NULL);
|
||||||
|
conn = domain->conn;
|
||||||
|
|
||||||
|
if ((conn->flags & VIR_CONNECT_RO) && (flags & VIR_DOMAIN_XML_SECURE)) {
|
||||||
|
virReportError(VIR_ERR_OPERATION_DENIED, "%s",
|
||||||
|
_("virDomainManagedSaveGetXMLDesc with secure flag"));
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (conn->driver->domainManagedSaveGetXMLDesc) {
|
||||||
|
char *ret;
|
||||||
|
ret = conn->driver->domainManagedSaveGetXMLDesc(domain, flags);
|
||||||
|
if (!ret)
|
||||||
|
goto error;
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
virReportUnsupportedError();
|
||||||
|
|
||||||
|
error:
|
||||||
|
virDispatchError(domain->conn);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* virDomainOpenConsole:
|
* virDomainOpenConsole:
|
||||||
|
@ -771,5 +771,6 @@ LIBVIRT_3.4.0 {
|
|||||||
LIBVIRT_3.7.0 {
|
LIBVIRT_3.7.0 {
|
||||||
global:
|
global:
|
||||||
virDomainMigrateGetMaxDowntime;
|
virDomainMigrateGetMaxDowntime;
|
||||||
|
virDomainManagedSaveGetXMLDesc;
|
||||||
} LIBVIRT_3.4.0;
|
} LIBVIRT_3.4.0;
|
||||||
# .... define new API here using predicted next version number ....
|
# .... define new API here using predicted next version number ....
|
||||||
|
@ -8411,6 +8411,7 @@ static virHypervisorDriver hypervisor_driver = {
|
|||||||
.domainManagedSave = remoteDomainManagedSave, /* 0.8.0 */
|
.domainManagedSave = remoteDomainManagedSave, /* 0.8.0 */
|
||||||
.domainHasManagedSaveImage = remoteDomainHasManagedSaveImage, /* 0.8.0 */
|
.domainHasManagedSaveImage = remoteDomainHasManagedSaveImage, /* 0.8.0 */
|
||||||
.domainManagedSaveRemove = remoteDomainManagedSaveRemove, /* 0.8.0 */
|
.domainManagedSaveRemove = remoteDomainManagedSaveRemove, /* 0.8.0 */
|
||||||
|
.domainManagedSaveGetXMLDesc = remoteDomainManagedSaveGetXMLDesc, /* 3.7.0 */
|
||||||
.domainSnapshotCreateXML = remoteDomainSnapshotCreateXML, /* 0.8.0 */
|
.domainSnapshotCreateXML = remoteDomainSnapshotCreateXML, /* 0.8.0 */
|
||||||
.domainSnapshotGetXMLDesc = remoteDomainSnapshotGetXMLDesc, /* 0.8.0 */
|
.domainSnapshotGetXMLDesc = remoteDomainSnapshotGetXMLDesc, /* 0.8.0 */
|
||||||
.domainSnapshotNum = remoteDomainSnapshotNum, /* 0.8.0 */
|
.domainSnapshotNum = remoteDomainSnapshotNum, /* 0.8.0 */
|
||||||
|
@ -2556,6 +2556,15 @@ struct remote_domain_managed_save_remove_args {
|
|||||||
unsigned int flags;
|
unsigned int flags;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct remote_domain_managed_save_get_xml_desc_args {
|
||||||
|
remote_nonnull_domain dom;
|
||||||
|
unsigned int flags;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct remote_domain_managed_save_get_xml_desc_ret {
|
||||||
|
remote_nonnull_string xml;
|
||||||
|
};
|
||||||
|
|
||||||
struct remote_domain_snapshot_create_xml_args {
|
struct remote_domain_snapshot_create_xml_args {
|
||||||
remote_nonnull_domain dom;
|
remote_nonnull_domain dom;
|
||||||
remote_nonnull_string xml_desc;
|
remote_nonnull_string xml_desc;
|
||||||
@ -6079,6 +6088,12 @@ enum remote_procedure {
|
|||||||
* @generate: both
|
* @generate: both
|
||||||
* @acl: domain:migrate
|
* @acl: domain:migrate
|
||||||
*/
|
*/
|
||||||
REMOTE_PROC_DOMAIN_MIGRATE_GET_MAX_DOWNTIME = 387
|
REMOTE_PROC_DOMAIN_MIGRATE_GET_MAX_DOWNTIME = 387,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @generate: both
|
||||||
|
* @acl: domain:read
|
||||||
|
* @acl: domain:read_secure:VIR_DOMAIN_XML_SECURE
|
||||||
|
*/
|
||||||
|
REMOTE_PROC_DOMAIN_MANAGED_SAVE_GET_XML_DESC = 388
|
||||||
};
|
};
|
||||||
|
@ -1970,6 +1970,13 @@ struct remote_domain_managed_save_remove_args {
|
|||||||
remote_nonnull_domain dom;
|
remote_nonnull_domain dom;
|
||||||
u_int flags;
|
u_int flags;
|
||||||
};
|
};
|
||||||
|
struct remote_domain_managed_save_get_xml_desc_args {
|
||||||
|
remote_nonnull_domain dom;
|
||||||
|
u_int flags;
|
||||||
|
};
|
||||||
|
struct remote_domain_managed_save_get_xml_desc_ret {
|
||||||
|
remote_nonnull_string xml;
|
||||||
|
};
|
||||||
struct remote_domain_snapshot_create_xml_args {
|
struct remote_domain_snapshot_create_xml_args {
|
||||||
remote_nonnull_domain dom;
|
remote_nonnull_domain dom;
|
||||||
remote_nonnull_string xml_desc;
|
remote_nonnull_string xml_desc;
|
||||||
@ -3241,4 +3248,5 @@ enum remote_procedure {
|
|||||||
REMOTE_PROC_DOMAIN_EVENT_BLOCK_THRESHOLD = 385,
|
REMOTE_PROC_DOMAIN_EVENT_BLOCK_THRESHOLD = 385,
|
||||||
REMOTE_PROC_DOMAIN_SET_BLOCK_THRESHOLD = 386,
|
REMOTE_PROC_DOMAIN_SET_BLOCK_THRESHOLD = 386,
|
||||||
REMOTE_PROC_DOMAIN_MIGRATE_GET_MAX_DOWNTIME = 387,
|
REMOTE_PROC_DOMAIN_MIGRATE_GET_MAX_DOWNTIME = 387,
|
||||||
|
REMOTE_PROC_DOMAIN_MANAGED_SAVE_GET_XML_DESC = 388,
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user