[RFC PATCH 2/7] qemuMigrationCookieNBDXMLFormat: Format empty <nbd/> element

Peter Krempa pkrempa at redhat.com
Tue Apr 13 15:38:22 UTC 2021


Commit 518be41aaa3 refactored qemuMigrationCookieNBDXMLFormat to use
virXMLFormatElement which in comparison to the previous code doesn't
format the element if it's empty.

Unfortunately some crusty bits of our migration code use questionable
logic to assert use of the old-style storage migration parameters which
breaks if no disks are being migrated and the <nbd/> element is not
present.

While later patches will fix the code, re-instate formatting of empty
<nbd/> for increased compatibility.

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

diff --git a/src/qemu/qemu_migration_cookie.c b/src/qemu/qemu_migration_cookie.c
index 41533e4549..52998ddd1b 100644
--- a/src/qemu/qemu_migration_cookie.c
+++ b/src/qemu/qemu_migration_cookie.c
@@ -790,7 +790,7 @@ qemuMigrationCookieNBDXMLFormat(qemuMigrationCookieNBD *nbd,
         virBufferAsprintf(&childBuf, " capacity='%llu'/>\n", nbd->disks[i].capacity);
     }

-    virXMLFormatElement(buf, "nbd", &attrBuf, &childBuf);
+    virXMLFormatElementEmpty(buf, "nbd", &attrBuf, &childBuf);
 }


-- 
2.30.2




More information about the libvir-list mailing list