mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-08 12:41:29 +00:00
conf: checkpoint: Add a flag storing whether disk 'size' is valid
Avoid printing '0' size in case when we weren't able to determine the backup size by adding a flag whether the size is valid and interlock printing of the field according to the flag. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com>
This commit is contained in:
parent
459a60823e
commit
a94997c476
@ -430,7 +430,7 @@ virDomainCheckpointDiskDefFormat(virBufferPtr buf,
|
|||||||
virDomainCheckpointTypeToString(disk->type));
|
virDomainCheckpointTypeToString(disk->type));
|
||||||
if (disk->bitmap) {
|
if (disk->bitmap) {
|
||||||
virBufferEscapeString(buf, " bitmap='%s'", disk->bitmap);
|
virBufferEscapeString(buf, " bitmap='%s'", disk->bitmap);
|
||||||
if (flags & VIR_DOMAIN_CHECKPOINT_FORMAT_SIZE)
|
if (flags & VIR_DOMAIN_CHECKPOINT_FORMAT_SIZE && disk->sizeValid)
|
||||||
virBufferAsprintf(buf, " size='%llu'", disk->size);
|
virBufferAsprintf(buf, " size='%llu'", disk->size);
|
||||||
}
|
}
|
||||||
virBufferAddLit(buf, "/>\n");
|
virBufferAddLit(buf, "/>\n");
|
||||||
|
@ -46,6 +46,7 @@ struct _virDomainCheckpointDiskDef {
|
|||||||
int type; /* virDomainCheckpointType */
|
int type; /* virDomainCheckpointType */
|
||||||
char *bitmap; /* bitmap name, if type is bitmap */
|
char *bitmap; /* bitmap name, if type is bitmap */
|
||||||
unsigned long long size; /* current checkpoint size in bytes */
|
unsigned long long size; /* current checkpoint size in bytes */
|
||||||
|
bool sizeValid;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Stores the complete checkpoint metadata */
|
/* Stores the complete checkpoint metadata */
|
||||||
|
@ -83,6 +83,7 @@ testCompareXMLToXMLFiles(const char *inxml,
|
|||||||
}
|
}
|
||||||
if (flags & TEST_SIZE) {
|
if (flags & TEST_SIZE) {
|
||||||
def->disks[0].size = 1048576;
|
def->disks[0].size = 1048576;
|
||||||
|
def->disks[0].sizeValid = true;
|
||||||
formatflags |= VIR_DOMAIN_CHECKPOINT_FORMAT_SIZE;
|
formatflags |= VIR_DOMAIN_CHECKPOINT_FORMAT_SIZE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user