Convert the other string comparisons to use the macro.
Signed-off-by: Ján Tomko <jtomko@redhat.com>
---
src/qemu/qemu_domain.c | 44 ++++++++++--------------------------------
1 file changed, 10 insertions(+), 34 deletions(-)
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index e75ea15c91..836e30decf 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -9401,33 +9401,14 @@ qemuDomainDiskChangeSupported(virDomainDiskDefPtr disk,
CHECK_STREQ_NULLABLE(blkdeviotune.group_name,
"blkdeviotune group name");
- if (disk->serial && STRNEQ_NULLABLE(disk->serial, orig_disk->serial)) {
- virReportError(VIR_ERR_OPERATION_UNSUPPORTED,
- _("cannot modify field '%s' of the disk"),
- "serial");
- return false;
- }
-
- if (disk->wwn && STRNEQ_NULLABLE(disk->wwn, orig_disk->wwn)) {
- virReportError(VIR_ERR_OPERATION_UNSUPPORTED,
- _("cannot modify field '%s' of the disk"),
- "wwn");
- return false;
- }
-
- if (disk->vendor && STRNEQ_NULLABLE(disk->vendor, orig_disk->vendor)) {
- virReportError(VIR_ERR_OPERATION_UNSUPPORTED,
- _("cannot modify field '%s' of the disk"),
- "vendor");
- return false;
- }
-
- if (disk->product && STRNEQ_NULLABLE(disk->product, orig_disk->product)) {
- virReportError(VIR_ERR_OPERATION_UNSUPPORTED,
- _("cannot modify field '%s' of the disk"),
- "product");
- return false;
- }
+ CHECK_STREQ_NULLABLE(serial,
+ "serial");
+ CHECK_STREQ_NULLABLE(wwn,
+ "wwn");
+ CHECK_STREQ_NULLABLE(vendor,
+ "vendor");
+ CHECK_STREQ_NULLABLE(product,
+ "product");
CHECK_EQ(cachemode, "cache", true);
CHECK_EQ(error_policy, "error_policy", true);
@@ -9460,13 +9441,8 @@ qemuDomainDiskChangeSupported(virDomainDiskDefPtr disk,
CHECK_EQ(discard, "discard", true);
CHECK_EQ(iothread, "iothread", true);
- if (disk->domain_name &&
- STRNEQ_NULLABLE(disk->domain_name, orig_disk->domain_name)) {
- virReportError(VIR_ERR_OPERATION_UNSUPPORTED,
- _("cannot modify field '%s' of the disk"),
- "backenddomain");
- return false;
- }
+ CHECK_STREQ_NULLABLE(domain_name,
+ "backenddomain");
/* checks for fields stored in disk->src */
/* unfortunately 'readonly' and 'shared' can't be converted to tristate
--
2.20.1
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
On 3/28/19 10:34 AM, Ján Tomko wrote:
> Convert the other string comparisons to use the macro.
>
> Signed-off-by: Ján Tomko <jtomko@redhat.com>
> ---
> src/qemu/qemu_domain.c | 44 ++++++++++--------------------------------
> 1 file changed, 10 insertions(+), 34 deletions(-)
>
> diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
> index e75ea15c91..836e30decf 100644
> --- a/src/qemu/qemu_domain.c
> +++ b/src/qemu/qemu_domain.c
> @@ -9401,33 +9401,14 @@ qemuDomainDiskChangeSupported(virDomainDiskDefPtr disk,
> CHECK_STREQ_NULLABLE(blkdeviotune.group_name,
> "blkdeviotune group name");
>
> - if (disk->serial && STRNEQ_NULLABLE(disk->serial, orig_disk->serial)) {
> - virReportError(VIR_ERR_OPERATION_UNSUPPORTED,
> - _("cannot modify field '%s' of the disk"),
> - "serial");
> - return false;
> - }
Hmmm. Well (to answer my own question from the previous patch) certainly
in the current implementation of all these the meaining of "not
specified" is "do not change", so I guess at the very least you're
preserving current behavior.
Reviewed-by: Laine Stump <laine@laine.org>
> -
> - if (disk->wwn && STRNEQ_NULLABLE(disk->wwn, orig_disk->wwn)) {
> - virReportError(VIR_ERR_OPERATION_UNSUPPORTED,
> - _("cannot modify field '%s' of the disk"),
> - "wwn");
> - return false;
> - }
> -
> - if (disk->vendor && STRNEQ_NULLABLE(disk->vendor, orig_disk->vendor)) {
> - virReportError(VIR_ERR_OPERATION_UNSUPPORTED,
> - _("cannot modify field '%s' of the disk"),
> - "vendor");
> - return false;
> - }
> -
> - if (disk->product && STRNEQ_NULLABLE(disk->product, orig_disk->product)) {
> - virReportError(VIR_ERR_OPERATION_UNSUPPORTED,
> - _("cannot modify field '%s' of the disk"),
> - "product");
> - return false;
> - }
> + CHECK_STREQ_NULLABLE(serial,
> + "serial");
> + CHECK_STREQ_NULLABLE(wwn,
> + "wwn");
> + CHECK_STREQ_NULLABLE(vendor,
> + "vendor");
> + CHECK_STREQ_NULLABLE(product,
> + "product");
>
> CHECK_EQ(cachemode, "cache", true);
> CHECK_EQ(error_policy, "error_policy", true);
> @@ -9460,13 +9441,8 @@ qemuDomainDiskChangeSupported(virDomainDiskDefPtr disk,
> CHECK_EQ(discard, "discard", true);
> CHECK_EQ(iothread, "iothread", true);
>
> - if (disk->domain_name &&
> - STRNEQ_NULLABLE(disk->domain_name, orig_disk->domain_name)) {
> - virReportError(VIR_ERR_OPERATION_UNSUPPORTED,
> - _("cannot modify field '%s' of the disk"),
> - "backenddomain");
> - return false;
> - }
> + CHECK_STREQ_NULLABLE(domain_name,
> + "backenddomain");
>
> /* checks for fields stored in disk->src */
> /* unfortunately 'readonly' and 'shared' can't be converted to tristate
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
© 2016 - 2026 Red Hat, Inc.