]> xenbits.xensource.com Git - libvirt.git/commitdiff
fix pool-create for netfs format 'auto'
authorDaniel Veillard <veillard@redhat.com>
Thu, 17 Jul 2008 15:20:28 +0000 (15:20 +0000)
committerDaniel Veillard <veillard@redhat.com>
Thu, 17 Jul 2008 15:20:28 +0000 (15:20 +0000)
* src/storage_backend_fs.c: patch from Cole Robinson fixing
  pool-create for netfs format 'auto'
Daniel

ChangeLog
src/storage_backend_fs.c

index fcc2c89f2addecfb0919950cb5dc12ae8767ca47..a19085e727fb63c0c7fd33fc382093858817cc1b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Thu Jul 17 17:18:24 CEST 2008 Daniel Veillard <veillard@redhat.com>
+
+       * 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 <veillard@redhat.com>
 
        * src/virsh.c: patch from Evgeniy Sokolov for the undefine command
index 992649309f0fd8c40df4787d9bd77723e9a11525..f1950342f953e5ac2ed5ef5739fccaee5648d46f 100644 (file)
@@ -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);