diff options
author | Ján Tomko <jtomko@redhat.com> | 2019-03-28 14:46:58 +0100 |
---|---|---|
committer | Ján Tomko <jtomko@redhat.com> | 2019-03-29 12:54:41 +0100 |
commit | 8535a298a2df8496bf4fda468bc226c65ca8d1a3 (patch) | |
tree | 31b59ec4933faf689e33f32f96fbb9713d575f99 | |
parent | 21a9cb986cca8cb5d3b640a94a881392823d7f2a (diff) | |
download | libvirt-8535a298a2df8496bf4fda468bc226c65ca8d1a3.tar.gz |
qemu: introduce CHECK_STREQ_NULLABLE in qemuDomainDiskChangeSupported
A macro for comparing string fields of the disk.
https://bugzilla.redhat.com/show_bug.cgi?id=1601677
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Laine Stump <laine@laine.org>
-rw-r--r-- | src/qemu/qemu_domain.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 7e0938e989..f856a5b081 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -9321,6 +9321,18 @@ qemuDomainDiskChangeSupported(virDomainDiskDefPtr disk, } \ } while (0) +#define CHECK_STREQ_NULLABLE(field, field_name) \ + do { \ + if (!disk->field) \ + break; \ + if (STRNEQ_NULLABLE(disk->field, orig_disk->field)) { \ + virReportError(VIR_ERR_OPERATION_UNSUPPORTED, \ + _("cannot modify field '%s' of the disk"), \ + field_name); \ + return false; \ + } \ + } while (0) + CHECK_EQ(device, "device", false); CHECK_EQ(bus, "bus", false); if (STRNEQ(disk->dst, orig_disk->dst)) { @@ -9468,6 +9480,7 @@ qemuDomainDiskChangeSupported(virDomainDiskDefPtr disk, } #undef CHECK_EQ +#undef CHECK_STREQ_NULLABLE return true; } |