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>
virDomainCheckpointTypeToString(disk->type));
if (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);
}
virBufferAddLit(buf, "/>\n");
int type; /* virDomainCheckpointType */
char *bitmap; /* bitmap name, if type is bitmap */
unsigned long long size; /* current checkpoint size in bytes */
+ bool sizeValid;
};
/* Stores the complete checkpoint metadata */
}
if (flags & TEST_SIZE) {
def->disks[0].size = 1048576;
+ def->disks[0].sizeValid = true;
formatflags |= VIR_DOMAIN_CHECKPOINT_FORMAT_SIZE;
}