
On Thu, Apr 19, 2012 at 02:33:27PM +0200, Wido den Hollander wrote:
The current storage pools for NFS and iSCSI only require one host to connect to. Future storage pools like RBD and Sheepdog will require multiple hosts.
This patch allows multiple source hosts and rewrites the current storage drivers.
Signed-off-by: Wido den Hollander <wido@widodh.nl> --- src/conf/storage_conf.c | 59 ++++++++++++++++++++++++---------- src/conf/storage_conf.h | 5 ++- src/esx/esx_storage_driver.c | 6 +++- src/storage/storage_backend_fs.c | 12 +++--- src/storage/storage_backend_iscsi.c | 12 +++--- src/test/test_driver.c | 4 +- 6 files changed, 63 insertions(+), 35 deletions(-)
@@ -1677,7 +1700,7 @@ int virStoragePoolSourceFindDuplicate(virStoragePoolObjListPtr pools, break; case VIR_STORAGE_POOL_NETFS: if ((STREQ(pool->def->source.dir, def->source.dir)) \ - && (STREQ(pool->def->source.host.name, def->source.host.name))) + && (STREQ(pool->def->source.hosts[0].name, def->source.hosts[0].name))) matchpool = pool; break; case VIR_STORAGE_POOL_SCSI:
Here we need to add to the conditional check "nhosts == 1" before dereferencing hosts[0].
@@ -1688,7 +1711,7 @@ int virStoragePoolSourceFindDuplicate(virStoragePoolObjListPtr pools, { matchpool = virStoragePoolSourceFindDuplicateDevices(pool, def); if (matchpool) { - if (STREQ(matchpool->def->source.host.name, def->source.host.name)) { + if (STREQ(matchpool->def->source.hosts[0].name, def->source.hosts[0].name)) { if ((matchpool->def->source.initiator.iqn) && (def->source.initiator.iqn)) { if (STREQ(matchpool->def->source.initiator.iqn, def->source.initiator.iqn)) break;
Same here.
diff --git a/src/storage/storage_backend_fs.c b/src/storage/storage_backend_fs.c index 1af12e6..79eefd3 100644 --- a/src/storage/storage_backend_fs.c +++ b/src/storage/storage_backend_fs.c @@ -206,7 +206,7 @@ virStorageBackendFileSystemNetFindPoolSourcesFunc(virStoragePoolObjPtr pool ATTR if (!(src = virStoragePoolSourceListNewSource(&state->list))) goto cleanup;
At the start of this function we need to have if (src->nhosts != 1) { virStorageReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s" "Expected exactly 1 host for the filesystem pool")); goto cleanup; } And similarly at the start of other functions which are referencing src->hosts[0] 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 :|