From dfccabe1e7a1e6401c0f8ad0e3365215e4f313d3 Mon Sep 17 00:00:00 2001 From: Daniel Veillard Date: Thu, 17 Jul 2008 15:20:28 +0000 Subject: [PATCH] fix pool-create for netfs format 'auto' * src/storage_backend_fs.c: patch from Cole Robinson fixing pool-create for netfs format 'auto' Daniel --- ChangeLog | 5 +++++ src/storage_backend_fs.c | 32 +++++++++++++++++++++++++++++--- 2 files changed, 34 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index fcc2c89f2a..a19085e727 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Thu Jul 17 17:18:24 CEST 2008 Daniel Veillard + + * src/storage_backend_fs.c: patch from Cole Robinson fixing + pool-create for netfs format 'auto' + Thu Jul 17 13:47:56 CEST 2008 Daniel Veillard * src/virsh.c: patch from Evgeniy Sokolov for the undefine command diff --git a/src/storage_backend_fs.c b/src/storage_backend_fs.c index 992649309f..f1950342f9 100644 --- a/src/storage_backend_fs.c +++ b/src/storage_backend_fs.c @@ -487,7 +487,23 @@ static int virStorageBackendFileSystemMount(virConnectPtr conn, virStoragePoolObjPtr pool) { char *src; - const char *mntargv[] = { + const char **mntargv; + + /* 'mount -t auto' doesn't seem to auto determine nfs (or cifs), + * while plain 'mount' does. We have to craft separate argvs to + * accommodate this */ + int netauto = (pool->def->type == VIR_STORAGE_POOL_NETFS && + pool->def->source.format == VIR_STORAGE_POOL_NETFS_AUTO); + int source_index; + + const char *netfs_auto_argv[] = { + MOUNT, + NULL, /* source path */ + pool->def->target.path, + NULL, + }; + + const char *fs_argv[] = { MOUNT, "-t", pool->def->type == VIR_STORAGE_POOL_FS ? @@ -495,10 +511,20 @@ virStorageBackendFileSystemMount(virConnectPtr conn, pool->def->source.format) : virStorageBackendFileSystemNetPoolFormatToString(conn, pool->def->source.format), - NULL, /* Fill in shortly - careful not to add extra fields before this */ + NULL, /* Fill in shortly - careful not to add extra fields + before this */ pool->def->target.path, NULL, }; + + if (netauto) { + mntargv = netfs_auto_argv; + source_index = 1; + } else { + mntargv = fs_argv; + source_index = 3; + } + int ret; if (pool->def->type == VIR_STORAGE_POOL_NETFS) { @@ -543,7 +569,7 @@ virStorageBackendFileSystemMount(virConnectPtr conn, return -1; } } - mntargv[3] = src; + mntargv[source_index] = src; if (virRun(conn, (char**)mntargv, NULL) < 0) { VIR_FREE(src);