mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-12 13:17:58 +03:00
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>
This commit is contained in:
parent
21a9cb986c
commit
8535a298a2
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user