[libvirt] [PATCH] Fix storage pool source comparison to avoid comparing with self

From: "Daniel P. Berrange" <berrange@redhat.com> If we are comparing storage pools we must skip comparing with ourself, so that re-defining an existing pool works * conf/storage_conf.c: Skip self when comparing --- src/conf/storage_conf.c | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-) diff --git a/src/conf/storage_conf.c b/src/conf/storage_conf.c index e893b2d..eb39198 100644 --- a/src/conf/storage_conf.c +++ b/src/conf/storage_conf.c @@ -1730,6 +1730,10 @@ int virStoragePoolSourceFindDuplicate(virStoragePoolObjListPtr pools, if (def->type != pool->def->type) continue; + /* Don't mach against ourself if re-defining existing pool ! */ + if (STREQ(pool->def->name, def->name)) + continue; + virStoragePoolObjLock(pool); switch (pool->def->type) { -- 1.7.6.4

On 10/11/2011 04:26 AM, Daniel P. Berrange wrote:
From: "Daniel P. Berrange"<berrange@redhat.com>
If we are comparing storage pools we must skip comparing with ourself, so that re-defining an existing pool works
* conf/storage_conf.c: Skip self when comparing --- src/conf/storage_conf.c | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/src/conf/storage_conf.c b/src/conf/storage_conf.c index e893b2d..eb39198 100644 --- a/src/conf/storage_conf.c +++ b/src/conf/storage_conf.c @@ -1730,6 +1730,10 @@ int virStoragePoolSourceFindDuplicate(virStoragePoolObjListPtr pools, if (def->type != pool->def->type) continue;
+ /* Don't mach against ourself if re-defining existing pool ! */ + if (STREQ(pool->def->name, def->name)) + continue;
ACK. -- Eric Blake eblake@redhat.com +1-801-349-2682 Libvirt virtualization library http://libvirt.org

Hi Daniel, On Tue, Oct 11, 2011 at 11:26:59AM +0100, Daniel P. Berrange wrote:
From: "Daniel P. Berrange" <berrange@redhat.com>
If we are comparing storage pools we must skip comparing with ourself, so that re-defining an existing pool works
* conf/storage_conf.c: Skip self when comparing --- src/conf/storage_conf.c | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/src/conf/storage_conf.c b/src/conf/storage_conf.c index e893b2d..eb39198 100644 --- a/src/conf/storage_conf.c +++ b/src/conf/storage_conf.c @@ -1730,6 +1730,10 @@ int virStoragePoolSourceFindDuplicate(virStoragePoolObjListPtr pools, if (def->type != pool->def->type) continue;
+ /* Don't mach against ourself if re-defining existing pool ! */ + if (STREQ(pool->def->name, def->name)) + continue; + virStoragePoolObjLock(pool);
switch (pool->def->type) {
This one didn't get applied yet but it seems to fix some libvirt-tck failures. Is this just an omission? Cheers, -- Guido

On Tue, Nov 01, 2011 at 12:08:58PM +0100, Guido Günther wrote:
Hi Daniel,
On Tue, Oct 11, 2011 at 11:26:59AM +0100, Daniel P. Berrange wrote:
From: "Daniel P. Berrange" <berrange@redhat.com>
If we are comparing storage pools we must skip comparing with ourself, so that re-defining an existing pool works
* conf/storage_conf.c: Skip self when comparing --- src/conf/storage_conf.c | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/src/conf/storage_conf.c b/src/conf/storage_conf.c index e893b2d..eb39198 100644 --- a/src/conf/storage_conf.c +++ b/src/conf/storage_conf.c @@ -1730,6 +1730,10 @@ int virStoragePoolSourceFindDuplicate(virStoragePoolObjListPtr pools, if (def->type != pool->def->type) continue;
+ /* Don't mach against ourself if re-defining existing pool ! */ + if (STREQ(pool->def->name, def->name)) + continue; + virStoragePoolObjLock(pool);
switch (pool->def->type) {
This one didn't get applied yet but it seems to fix some libvirt-tck failures. Is this just an omission?
Opps, forgot to push it. Done now Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|
participants (3)
-
Daniel P. Berrange
-
Eric Blake
-
Guido Günther