qemuMigrationCookieNBDXMLFormat: Format empty <nbd/> element

Commit 518be41aaa 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@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Tested-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
Peter Krempa 2021-04-13 16:16:44 +02:00
parent 1ac21ab7ea
commit 7c6d462aae

View File

@ -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);
}