This can be used to specify disk where to place vmstate data. Signed-off-by: Nikolay Shirokovskiy <nikolay.shirokovskiy@xxxxxxxxxx> --- src/conf/snapshot_conf.c | 13 +++++++++++++ src/conf/snapshot_conf.h | 1 + 2 files changed, 14 insertions(+) diff --git a/src/conf/snapshot_conf.c b/src/conf/snapshot_conf.c index 80946beba9..8c9ee03942 100644 --- a/src/conf/snapshot_conf.c +++ b/src/conf/snapshot_conf.c @@ -117,6 +117,7 @@ virDomainSnapshotDefDispose(void *obj) size_t i; g_free(def->memorysnapshotfile); + g_free(def->memorydisk); for (i = 0; i < def->ndisks; i++) virDomainSnapshotDiskDefClear(&def->disks[i]); g_free(def->disks); @@ -305,6 +306,7 @@ virDomainSnapshotDefParse(xmlXPathContextPtr ctxt, if ((memoryNode = virXPathNode("./memory", ctxt))) { def->memorysnapshotfile = virXMLPropString(memoryNode, "file"); + def->memorydisk = virXMLPropString(memoryNode, "disk"); if (virXMLPropEnumDefault(memoryNode, "snapshot", virDomainSnapshotLocationTypeFromString, @@ -323,6 +325,8 @@ virDomainSnapshotDefParse(xmlXPathContextPtr ctxt, if (def->memory == VIR_DOMAIN_SNAPSHOT_LOCATION_DEFAULT) { if (def->memorysnapshotfile) { def->memory = VIR_DOMAIN_SNAPSHOT_LOCATION_EXTERNAL; + } else if (def->memorydisk) { + def->memory = VIR_DOMAIN_SNAPSHOT_LOCATION_INTERNAL; } else if (flags & VIR_DOMAIN_SNAPSHOT_PARSE_REDEFINE) { if (offline) { def->memory = VIR_DOMAIN_SNAPSHOT_LOCATION_NO; @@ -347,6 +351,14 @@ virDomainSnapshotDefParse(xmlXPathContextPtr ctxt, return NULL; } + if (def->memorydisk && + def->memory != VIR_DOMAIN_SNAPSHOT_LOCATION_INTERNAL) { + virReportError(VIR_ERR_XML_ERROR, + _("memory disk '%s' requires internal snapshot"), + def->memorydisk); + return NULL; + } + if (offline && def->memory != VIR_DOMAIN_SNAPSHOT_LOCATION_DEFAULT && def->memory != VIR_DOMAIN_SNAPSHOT_LOCATION_NO) { @@ -844,6 +856,7 @@ virDomainSnapshotDefFormatInternal(virBuffer *buf, virBufferAsprintf(buf, "<memory snapshot='%s'", virDomainSnapshotLocationTypeToString(def->memory)); virBufferEscapeString(buf, " file='%s'", def->memorysnapshotfile); + virBufferEscapeString(buf, " disk='%s'", def->memorydisk); virBufferAddLit(buf, "/>\n"); } diff --git a/src/conf/snapshot_conf.h b/src/conf/snapshot_conf.h index 1f787f1a94..b7b448a071 100644 --- a/src/conf/snapshot_conf.h +++ b/src/conf/snapshot_conf.h @@ -72,6 +72,7 @@ struct _virDomainSnapshotDef { virDomainSnapshotLocation memory; char *memorysnapshotfile; /* memory state file when snapshot is external */ + char *memorydisk; /* memory state disk when snapshot is internal */ size_t ndisks; /* should not exceed dom->ndisks */ virDomainSnapshotDiskDef *disks; -- 2.35.1