mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-10 05:17:59 +03:00
conf: checkpoint: Prepare internals for missing domain definition
Conditionalize code which assumes that the domain definition stored in the checkpoint is present. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
This commit is contained in:
parent
9fd8ba3b2d
commit
392eacfeb1
@ -460,10 +460,10 @@ virDomainCheckpointDefFormatInternal(virBufferPtr buf,
|
||||
virBufferAddLit(buf, "</disks>\n");
|
||||
}
|
||||
|
||||
if (!(flags & VIR_DOMAIN_CHECKPOINT_FORMAT_NO_DOMAIN) &&
|
||||
virDomainDefFormatInternal(def->parent.dom, xmlopt,
|
||||
buf, domainflags) < 0)
|
||||
return -1;
|
||||
if (def->parent.dom && !(flags & VIR_DOMAIN_CHECKPOINT_FORMAT_NO_DOMAIN)) {
|
||||
if (virDomainDefFormatInternal(def->parent.dom, xmlopt, buf, domainflags) < 0)
|
||||
return -1;
|
||||
}
|
||||
|
||||
virBufferAdjustIndent(buf, -2);
|
||||
virBufferAddLit(buf, "</domaincheckpoint>\n");
|
||||
@ -495,23 +495,24 @@ virDomainCheckpointRedefinePrep(virDomainObjPtr vm,
|
||||
virDomainCheckpointDefPtr def,
|
||||
bool *update_current)
|
||||
{
|
||||
char uuidstr[VIR_UUID_STRING_BUFLEN];
|
||||
virDomainMomentObjPtr parent = NULL;
|
||||
|
||||
virUUIDFormat(vm->def->uuid, uuidstr);
|
||||
|
||||
if (virDomainCheckpointCheckCycles(vm->checkpoints, def, vm->def->name) < 0)
|
||||
return -1;
|
||||
|
||||
if (!def->parent.dom ||
|
||||
memcmp(def->parent.dom->uuid, vm->def->uuid, VIR_UUID_BUFLEN)) {
|
||||
virReportError(VIR_ERR_INVALID_ARG,
|
||||
_("definition for checkpoint %s must use uuid %s"),
|
||||
def->parent.name, uuidstr);
|
||||
return -1;
|
||||
if (def->parent.dom) {
|
||||
if (memcmp(def->parent.dom->uuid, vm->def->uuid, VIR_UUID_BUFLEN)) {
|
||||
char uuidstr[VIR_UUID_STRING_BUFLEN];
|
||||
virUUIDFormat(vm->def->uuid, uuidstr);
|
||||
virReportError(VIR_ERR_INVALID_ARG,
|
||||
_("definition for checkpoint %s must use uuid %s"),
|
||||
def->parent.name, uuidstr);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (virDomainCheckpointAlignDisks(def) < 0)
|
||||
return -1;
|
||||
}
|
||||
if (virDomainCheckpointAlignDisks(def) < 0)
|
||||
return -1;
|
||||
|
||||
if (def->parent.parent_name &&
|
||||
(parent = virDomainCheckpointFindByName(vm->checkpoints,
|
||||
|
@ -87,11 +87,6 @@ testCompareXMLToXMLFiles(const char *inxml,
|
||||
formatflags |= VIR_DOMAIN_CHECKPOINT_FORMAT_SIZE;
|
||||
}
|
||||
|
||||
/* Parsing XML does not populate the domain definition; work
|
||||
* around that by not requesting domain on output */
|
||||
if (!def->parent.dom)
|
||||
formatflags |= VIR_DOMAIN_CHECKPOINT_FORMAT_NO_DOMAIN;
|
||||
|
||||
if (!(actual = virDomainCheckpointDefFormat(def,
|
||||
driver.xmlopt,
|
||||
formatflags)))
|
||||
|
Loading…
Reference in New Issue
Block a user