[libvirt] [PATCH] Revert "qemu: Check duplicate WWNs also for hotplugged disks"

Peter Krempa posted 1 patch 6 years, 10 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/5fb3e448c610b7c581c0bc88e33c257c3c809aa1.1498038902.git.pkrempa@redhat.com
src/conf/domain_conf.c | 37 -------------------------------------
1 file changed, 37 deletions(-)
[libvirt] [PATCH] Revert "qemu: Check duplicate WWNs also for hotplugged disks"
Posted by Peter Krempa 6 years, 10 months ago
Similarly to commit 5da28cc3069b573f54f0bcaf8eb75476bcfdc6e9 this check
actually does not make sense since duplicate WWNs are used e.g. when
multipathing disks.

This reverts commit 780fe4e4baf7e2f10f65ba1a34f9274fc547cad2.
---
 src/conf/domain_conf.c | 37 -------------------------------------
 1 file changed, 37 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 0409c62ef..fdf85d5dd 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -25510,34 +25510,6 @@ virDomainDeviceInfoCheckBootIndex(virDomainDefPtr def ATTRIBUTE_UNUSED,
     return 0;
 }

-
-/**
- * virDomainDefGetDiskByWWN:
- * @def: domain definition
- * @wwn: wwn of a disk to find
- *
- * Returns a disk definition pointer corresponding to the given WWN identifier
- * or NULL either if @wwn was NULL or if disk with given WWN is not present in
- * the domain definition.
- */
-static virDomainDiskDefPtr
-virDomainDefGetDiskByWWN(virDomainDefPtr def,
-                         const char *wwn)
-{
-    size_t i;
-
-    if (!wwn)
-        return NULL;
-
-    for (i = 0; i < def->ndisks; i++) {
-        if (STREQ_NULLABLE(def->disks[i]->wwn, wwn))
-            return def->disks[i];
-    }
-
-    return NULL;
-}
-
-
 int
 virDomainDefCompatibleDevice(virDomainDefPtr def,
                              virDomainDeviceDefPtr dev,
@@ -25581,15 +25553,6 @@ virDomainDefCompatibleDevice(virDomainDefPtr def,
         }
     }

-    if (dev->type == VIR_DOMAIN_DEVICE_DISK) {
-        if (!!virDomainDefGetDiskByWWN(def, dev->data.disk->wwn)) {
-            virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
-                           _("Domain already has a disk with wwn '%s'"),
-                           dev->data.disk->wwn);
-            return -1;
-        }
-    }
-
     return 0;
 }

-- 
2.12.2

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] Revert "qemu: Check duplicate WWNs also for hotplugged disks"
Posted by Daniel P. Berrange 6 years, 10 months ago
On Wed, Jun 21, 2017 at 11:55:02AM +0200, Peter Krempa wrote:
> Similarly to commit 5da28cc3069b573f54f0bcaf8eb75476bcfdc6e9 this check
> actually does not make sense since duplicate WWNs are used e.g. when
> multipathing disks.
> 
> This reverts commit 780fe4e4baf7e2f10f65ba1a34f9274fc547cad2.
> ---
>  src/conf/domain_conf.c | 37 -------------------------------------
>  1 file changed, 37 deletions(-)

Is there something we can add to the hotplug test suite to illustrate
and/or validate this valid usage scenario.  

> 
> diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
> index 0409c62ef..fdf85d5dd 100644
> --- a/src/conf/domain_conf.c
> +++ b/src/conf/domain_conf.c
> @@ -25510,34 +25510,6 @@ virDomainDeviceInfoCheckBootIndex(virDomainDefPtr def ATTRIBUTE_UNUSED,
>      return 0;
>  }
> 
> -
> -/**
> - * virDomainDefGetDiskByWWN:
> - * @def: domain definition
> - * @wwn: wwn of a disk to find
> - *
> - * Returns a disk definition pointer corresponding to the given WWN identifier
> - * or NULL either if @wwn was NULL or if disk with given WWN is not present in
> - * the domain definition.
> - */
> -static virDomainDiskDefPtr
> -virDomainDefGetDiskByWWN(virDomainDefPtr def,
> -                         const char *wwn)
> -{
> -    size_t i;
> -
> -    if (!wwn)
> -        return NULL;
> -
> -    for (i = 0; i < def->ndisks; i++) {
> -        if (STREQ_NULLABLE(def->disks[i]->wwn, wwn))
> -            return def->disks[i];
> -    }
> -
> -    return NULL;
> -}
> -
> -
>  int
>  virDomainDefCompatibleDevice(virDomainDefPtr def,
>                               virDomainDeviceDefPtr dev,
> @@ -25581,15 +25553,6 @@ virDomainDefCompatibleDevice(virDomainDefPtr def,
>          }
>      }
> 
> -    if (dev->type == VIR_DOMAIN_DEVICE_DISK) {
> -        if (!!virDomainDefGetDiskByWWN(def, dev->data.disk->wwn)) {
> -            virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
> -                           _("Domain already has a disk with wwn '%s'"),
> -                           dev->data.disk->wwn);
> -            return -1;
> -        }
> -    }
> -
>      return 0;
>  }
> 
> -- 
> 2.12.2
> 
> --
> libvir-list mailing list
> libvir-list@redhat.com
> https://www.redhat.com/mailman/listinfo/libvir-list

Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list