[PATCH 2/4] virDomainBackupDiskDefFormat: Format internal disk state only when valid

Peter Krempa pkrempa at redhat.com
Tue Jul 7 15:23:01 UTC 2020


Format the disk state only when it isn't _NONE.

Signed-off-by: Peter Krempa <pkrempa at redhat.com>
---
 src/conf/backup_conf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/conf/backup_conf.c b/src/conf/backup_conf.c
index 781dd53f6b..5e4144d371 100644
--- a/src/conf/backup_conf.c
+++ b/src/conf/backup_conf.c
@@ -370,7 +370,7 @@ virDomainBackupDiskDefFormat(virBufferPtr buf,

     virBufferEscapeString(&attrBuf, " name='%s'", disk->name);
     virBufferAsprintf(&attrBuf, " backup='%s'", virTristateBoolTypeToString(disk->backup));
-    if (internal)
+    if (internal && disk->state != VIR_DOMAIN_BACKUP_DISK_STATE_NONE)
         virBufferAsprintf(&attrBuf, " state='%s'", virDomainBackupDiskStateTypeToString(disk->state));

     if (disk->backup == VIR_TRISTATE_BOOL_YES) {
-- 
2.26.2




More information about the libvir-list mailing list