[libvirt] [PATCH 7/9] storage: Add duplicate host check for Sheepdog pool def

John Ferlan jferlan at redhat.com
Mon Apr 13 21:07:23 UTC 2015

On 04/13/2015 06:23 AM, Peter Krempa wrote:
> On Thu, Apr 02, 2015 at 13:39:44 -0400, John Ferlan wrote:
>> Check proposed pool definitions to ensure they aren't trying to use the
>> same host as currently defined definitions - disallow the duplicate
> This statement is invalid. Multiple pols can be hosted on a single host.

Hmm - brain shorthand...  How about:

Check the proposed pool source host XML definition against existing sheepdog
pools to ensure the incoming definition doesn't use the same source host XML
definition as an existing pool.

> The check needs to do better than just check the host name. Port and
> pool path may differ denoting a different pool.

Hmm.. yes 'port' is something I could add to virStoragePoolSourceMatchSingleHost
and it's also extendable to iSCSI... doesn't make sense for NETFS, but would
also be usable for gluster

I'll squeeze in a patch in order to handle.

> Btw same host can be described using multiple host strings so it also
> isn't absolute.

Yep... That's where we're trying to get, but it takes a bit to get there!
For example, I use "' for my '<host name='...'/> string; however,
if I add to /etc/hosts: test1

and then use 'test1' in a different definition - the new code will fail to
match, but they are essentially the same thing...  There's a bz for that
which I'm working to fix, but was trying to avoid a 20 patch series to do
so...  Gotta start somewhere.


BTW: It gets worse once IPv6 is added into the mix.

>> Signed-off-by: John Ferlan <jferlan at redhat.com>
>> ---
>>  src/conf/storage_conf.c | 5 ++++-
>>  1 file changed, 4 insertions(+), 1 deletion(-)
>> diff --git a/src/conf/storage_conf.c b/src/conf/storage_conf.c
>> index 5f1c151..5db7478 100644
>> --- a/src/conf/storage_conf.c
>> +++ b/src/conf/storage_conf.c
>> @@ -2427,9 +2427,12 @@ virStoragePoolSourceFindDuplicate(virConnectPtr conn,
>>          case VIR_STORAGE_POOL_DISK:
>>              matchpool = virStoragePoolSourceFindDuplicateDevices(pool, def);
>>              break;
>> +            if (matchPoolSourceHost(&pool->def->source, &def->source))
>> +                matchpool = pool;
>> +            break;
> Peter

More information about the libvir-list mailing list