[PATCH 1/2] devices: filesystems: added volume type

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



New type of <devices> <filesystem type= 'volume'> is introduced.
This patch allows to use volumes for storing the filesystem, that is
accessed from the guest e.g. root directory for container.

To take advantage of volumes as a backend of filesystem volume
and pool names should be specified:
<filesystem type= 'volume'>
 <source pool='pool name' volume='volume name'/>

Signed-off-by: Olga Krishtal <okrishtal@xxxxxxxxxxxxx>
---
 src/conf/domain_audit.c    |  4 ++--
 src/conf/domain_conf.c     | 54 +++++++++++++++++++++++++++++++++++-----------
 src/conf/domain_conf.h     |  4 +++-
 src/libvirt_private.syms   |  1 +
 src/lxc/lxc_cgroup.c       |  2 +-
 src/lxc/lxc_container.c    | 50 +++++++++++++++++++++---------------------
 src/lxc/lxc_controller.c   | 18 ++++++++--------
 src/lxc/lxc_native.c       |  5 +++--
 src/lxc/lxc_process.c      |  2 +-
 src/openvz/openvz_conf.c   |  4 ++--
 src/openvz/openvz_driver.c |  4 ++--
 src/qemu/qemu_command.c    |  2 +-
 src/vbox/vbox_common.c     |  6 +++---
 src/vmx/vmx.c              |  4 ++--
 src/vz/vz_sdk.c            | 10 ++++-----
 15 files changed, 102 insertions(+), 68 deletions(-)

diff --git a/src/conf/domain_audit.c b/src/conf/domain_audit.c
index bd2eeb6..dbfff91 100644
--- a/src/conf/domain_audit.c
+++ b/src/conf/domain_audit.c
@@ -290,8 +290,8 @@ virDomainAuditFS(virDomainObjPtr vm,
                  const char *reason, bool success)
 {
     virDomainAuditGenericDev(vm, "fs",
-                             oldDef ? oldDef->src : NULL,
-                             newDef ? newDef->src : NULL,
+                             oldDef ? oldDef->src->path : NULL,
+                             newDef ? newDef->src->path : NULL,
                              reason, success);
 }
 
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 361e79e..0faf9d1 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -354,7 +354,8 @@ VIR_ENUM_IMPL(virDomainFS, VIR_DOMAIN_FS_TYPE_LAST,
               "file",
               "template",
               "ram",
-              "bind")
+              "bind",
+              "volume")
 
 VIR_ENUM_IMPL(virDomainFSDriver, VIR_DOMAIN_FS_DRIVER_TYPE_LAST,
               "default",
@@ -1670,12 +1671,31 @@ void virDomainControllerDefFree(virDomainControllerDefPtr def)
     VIR_FREE(def);
 }
 
+virDomainFSDefPtr
+virDomainFSDefNew(void)
+{
+    virDomainFSDefPtr ret;
+
+    if (VIR_ALLOC(ret) < 0)
+        return NULL;
+
+    if (VIR_ALLOC(ret->src) < 0)
+        goto cleanup;
+
+    return ret;
+
+ cleanup:
+    virDomainFSDefFree(ret);
+    return NULL;
+
+}
+
 void virDomainFSDefFree(virDomainFSDefPtr def)
 {
     if (!def)
         return;
 
-    VIR_FREE(def->src);
+    virStorageSourceFree(def->src);
     VIR_FREE(def->dst);
     virDomainDeviceInfoClear(&def->info);
 
@@ -8142,7 +8162,6 @@ virDomainNetGenerateMAC(virDomainXMLOptionPtr xmlopt,
     virMacAddrGenerate(xmlopt->config.macPrefix, mac);
 }
 
-
 /* Parse the XML definition for a disk
  * @param node XML nodeset to parse for disk definition
  */
@@ -8165,7 +8184,7 @@ virDomainFSDefParseXML(xmlNodePtr node,
 
     ctxt->node = node;
 
-    if (VIR_ALLOC(def) < 0)
+    if (!(def = virDomainFSDefNew()))
         return NULL;
 
     type = virXMLPropString(node, "type");
@@ -8218,6 +8237,10 @@ virDomainFSDefParseXML(xmlNodePtr node,
                 } else if (def->type == VIR_DOMAIN_FS_TYPE_RAM) {
                     usage = virXMLPropString(cur, "usage");
                     units = virXMLPropString(cur, "units");
+                } else if (def->type == VIR_DOMAIN_FS_TYPE_VOLUME) {
+                    def->src->type = VIR_STORAGE_TYPE_VOLUME;
+                    if (virDomainDiskSourcePoolDefParse(cur, &def->src->srcpool) < 0)
+                        goto error;
                 }
             } else if (!target &&
                        xmlStrEqual(cur->name, BAD_CAST "target")) {
@@ -8262,8 +8285,8 @@ virDomainFSDefParseXML(xmlNodePtr node,
         def->wrpolicy = VIR_DOMAIN_FS_WRPOLICY_DEFAULT;
     }
 
-    if (source == NULL &&
-        def->type != VIR_DOMAIN_FS_TYPE_RAM) {
+    if (source == NULL && def->type != VIR_DOMAIN_FS_TYPE_RAM
+        && def->type != VIR_DOMAIN_FS_TYPE_VOLUME) {
         virReportError(VIR_ERR_NO_SOURCE,
                        target ? "%s" : NULL, target);
         goto error;
@@ -8292,7 +8315,7 @@ virDomainFSDefParseXML(xmlNodePtr node,
             goto error;
     }
 
-    def->src = source;
+    def->src->path = source;
     source = NULL;
     def->dst = target;
     target = NULL;
@@ -19397,6 +19420,7 @@ virDomainFSDefFormat(virBufferPtr buf,
     const char *accessmode = virDomainFSAccessModeTypeToString(def->accessmode);
     const char *fsdriver = virDomainFSDriverTypeToString(def->fsdriver);
     const char *wrpolicy = virDomainFSWrpolicyTypeToString(def->wrpolicy);
+    const char *src = def->src->path;
 
     if (!type) {
         virReportError(VIR_ERR_INTERNAL_ERROR,
@@ -19433,30 +19457,36 @@ virDomainFSDefFormat(virBufferPtr buf,
     case VIR_DOMAIN_FS_TYPE_MOUNT:
     case VIR_DOMAIN_FS_TYPE_BIND:
         virBufferEscapeString(buf, "<source dir='%s'/>\n",
-                              def->src);
+                              src);
         break;
 
     case VIR_DOMAIN_FS_TYPE_BLOCK:
         virBufferEscapeString(buf, "<source dev='%s'/>\n",
-                              def->src);
+                              src);
         break;
 
     case VIR_DOMAIN_FS_TYPE_FILE:
         virBufferEscapeString(buf, "<source file='%s'/>\n",
-                              def->src);
+                              src);
         break;
 
     case VIR_DOMAIN_FS_TYPE_TEMPLATE:
         virBufferEscapeString(buf, "<source name='%s'/>\n",
-                              def->src);
+                              src);
         break;
 
     case VIR_DOMAIN_FS_TYPE_RAM:
         virBufferAsprintf(buf, "<source usage='%lld' units='KiB'/>\n",
                           def->usage / 1024);
         break;
-    }
 
+    case VIR_DOMAIN_FS_TYPE_VOLUME:
+        virBufferAddLit(buf, "<source");
+        virBufferEscapeString(buf, " pool='%s'", def->src->srcpool->pool);
+        virBufferEscapeString(buf, " volume='%s'", def->src->srcpool->volume);
+        virBufferAddLit(buf, "/>\n");
+        break;
+    }
     virBufferEscapeString(buf, "<target dir='%s'/>\n",
                           def->dst);
 
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 83bdd67..7ebc494 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -859,6 +859,7 @@ typedef enum {
     VIR_DOMAIN_FS_TYPE_TEMPLATE, /* Expands a OS template to a guest dir */
     VIR_DOMAIN_FS_TYPE_RAM,   /* Mount a RAM filesystem on a guest dir */
     VIR_DOMAIN_FS_TYPE_BIND,  /* Binds a guest dir to another guest dir */
+    VIR_DOMAIN_FS_TYPE_VOLUME, /* Mounts storage pool volume to a guest */
 
     VIR_DOMAIN_FS_TYPE_LAST
 } virDomainFSType;
@@ -902,7 +903,7 @@ struct _virDomainFSDef {
     int wrpolicy; /* enum virDomainFSWrpolicy */
     int format; /* virStorageFileFormat */
     unsigned long long usage; /* in bytes */
-    char *src;
+    virStorageSourcePtr src;
     char *dst;
     bool readonly;
     virDomainDeviceInfo info;
@@ -2529,6 +2530,7 @@ virDomainDiskDefPtr virDomainDiskFindByBusAndDst(virDomainDefPtr def,
                                                  int bus,
                                                  char *dst);
 void virDomainControllerDefFree(virDomainControllerDefPtr def);
+virDomainFSDefPtr virDomainFSDefNew(void);
 void virDomainFSDefFree(virDomainFSDefPtr def);
 void virDomainActualNetDefFree(virDomainActualNetDefPtr def);
 void virDomainNetDefFree(virDomainNetDefPtr def);
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 1da256d..be5df1c 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -288,6 +288,7 @@ virDomainDiskSetFormat;
 virDomainDiskSetSource;
 virDomainDiskSetType;
 virDomainDiskSourceIsBlockType;
+virDomainFSDefNew;
 virDomainFSDefFree;
 virDomainFSIndexByName;
 virDomainFSInsert;
diff --git a/src/lxc/lxc_cgroup.c b/src/lxc/lxc_cgroup.c
index 4afe7e2..80c873d 100644
--- a/src/lxc/lxc_cgroup.c
+++ b/src/lxc/lxc_cgroup.c
@@ -411,7 +411,7 @@ static int virLXCCgroupSetupDeviceACL(virDomainDefPtr def,
             continue;
 
         if (virCgroupAllowDevicePath(cgroup,
-                                     def->fss[i]->src,
+                                     def->fss[i]->src->path,
                                      def->fss[i]->readonly ?
                                      VIR_CGROUP_DEVICE_READ :
                                      VIR_CGROUP_DEVICE_RW, false) < 0)
diff --git a/src/lxc/lxc_container.c b/src/lxc/lxc_container.c
index 348bbfb..a60ec87 100644
--- a/src/lxc/lxc_container.c
+++ b/src/lxc/lxc_container.c
@@ -649,27 +649,27 @@ static int lxcContainerResolveSymlinks(virDomainFSDefPtr fs, bool gentle)
     if (!fs->src || fs->symlinksResolved)
         return 0;
 
-    if (access(fs->src, F_OK)) {
+    if (access(fs->src->path, F_OK)) {
         if (gentle) {
             /* Just ignore the error for the while, we'll try again later */
-            VIR_DEBUG("Skipped unaccessible '%s'", fs->src);
+            VIR_DEBUG("Skipped unaccessible '%s'", fs->src->path);
             return 0;
         } else {
             virReportSystemError(errno,
-                                 _("Failed to access '%s'"), fs->src);
+                                 _("Failed to access '%s'"), fs->src->path);
             return -1;
         }
     }
 
-    VIR_DEBUG("Resolving '%s'", fs->src);
-    if (virFileResolveAllLinks(fs->src, &newroot) < 0) {
+    VIR_DEBUG("Resolving '%s'", fs->src->path);
+    if (virFileResolveAllLinks(fs->src->path, &newroot) < 0) {
         if (gentle) {
-            VIR_DEBUG("Skipped non-resolvable '%s'", fs->src);
+            VIR_DEBUG("Skipped non-resolvable '%s'", fs->src->path);
             return 0;
         } else {
             virReportSystemError(errno,
                                  _("Failed to resolve symlink at %s"),
-                                 fs->src);
+                                 fs->src->path);
         }
         return -1;
     }
@@ -677,10 +677,10 @@ static int lxcContainerResolveSymlinks(virDomainFSDefPtr fs, bool gentle)
     /* Mark it resolved to skip it the next time */
     fs->symlinksResolved = true;
 
-    VIR_DEBUG("Resolved '%s' to %s", fs->src, newroot);
+    VIR_DEBUG("Resolved '%s' to %s", fs->src->path, newroot);
 
-    VIR_FREE(fs->src);
-    fs->src = newroot;
+    VIR_FREE(fs->src->path);
+    fs->src->path = newroot;
 
     return 0;
 }
@@ -728,8 +728,8 @@ static int lxcContainerPrepareRoot(virDomainDefPtr def,
 
     root->dst = tmp;
     root->type = VIR_DOMAIN_FS_TYPE_MOUNT;
-    VIR_FREE(root->src);
-    root->src = dst;
+    VIR_FREE(root->src->path);
+    root->src->path = dst;
 
     return 0;
 }
@@ -741,7 +741,7 @@ static int lxcContainerPivotRoot(virDomainFSDefPtr root)
 
     ret = -1;
 
-    VIR_DEBUG("Pivot via %s", root->src);
+    VIR_DEBUG("Pivot via %s", root->src->path);
 
     /* root->parent must be private, so make / private. */
     if (mount("", "/", NULL, MS_PRIVATE|MS_REC, NULL) < 0) {
@@ -750,7 +750,7 @@ static int lxcContainerPivotRoot(virDomainFSDefPtr root)
         goto err;
     }
 
-    if (virAsprintf(&oldroot, "%s/.oldroot", root->src) < 0)
+    if (virAsprintf(&oldroot, "%s/.oldroot", root->src->path) < 0)
         goto err;
 
     if (virFileMakePath(oldroot) < 0) {
@@ -781,18 +781,18 @@ static int lxcContainerPivotRoot(virDomainFSDefPtr root)
     }
 
     /* ... and mount our root onto it */
-    if (mount(root->src, newroot, NULL, MS_BIND|MS_REC, NULL) < 0) {
+    if (mount(root->src->path, newroot, NULL, MS_BIND|MS_REC, NULL) < 0) {
         virReportSystemError(errno,
                              _("Failed to bind %s to new root %s"),
-                             root->src, newroot);
+                             root->src->path, newroot);
         goto err;
     }
 
     if (root->readonly) {
-        if (mount(root->src, newroot, NULL, MS_BIND|MS_REC|MS_RDONLY|MS_REMOUNT, NULL) < 0) {
+        if (mount(root->src->path, newroot, NULL, MS_BIND|MS_REC|MS_RDONLY|MS_REMOUNT, NULL) < 0) {
             virReportSystemError(errno,
                                  _("Failed to make new root %s readonly"),
-                                 root->src);
+                                 root->src->path);
             goto err;
         }
     }
@@ -1209,9 +1209,9 @@ static int lxcContainerMountFSBind(virDomainFSDefPtr fs,
     int ret = -1;
     struct stat st;
 
-    VIR_DEBUG("src=%s dst=%s", fs->src, fs->dst);
+    VIR_DEBUG("src=%s dst=%s", fs->src->path, fs->dst);
 
-    if (virAsprintf(&src, "%s%s", srcprefix, fs->src) < 0)
+    if (virAsprintf(&src, "%s%s", srcprefix, fs->src->path) < 0)
         goto cleanup;
 
     if (stat(fs->dst, &st) < 0) {
@@ -1544,9 +1544,9 @@ static int lxcContainerMountFSBlock(virDomainFSDefPtr fs,
     char *src = NULL;
     int ret = -1;
 
-    VIR_DEBUG("src=%s dst=%s", fs->src, fs->dst);
+    VIR_DEBUG("src=%s dst=%s", fs->src->path, fs->dst);
 
-    if (virAsprintf(&src, "%s%s", srcprefix, fs->src) < 0)
+    if (virAsprintf(&src, "%s%s", srcprefix, fs->src->path) < 0)
         goto cleanup;
 
     ret = lxcContainerMountFSBlockHelper(fs, src, srcprefix, sec_mount_options);
@@ -1652,14 +1652,14 @@ static int lxcContainerMountAllFS(virDomainDefPtr vmDef,
         if (STREQ(vmDef->fss[i]->dst, "/"))
             continue;
 
-        VIR_DEBUG("Mounting '%s' -> '%s'", vmDef->fss[i]->src, vmDef->fss[i]->dst);
+        VIR_DEBUG("Mounting '%s' -> '%s'", vmDef->fss[i]->src->path, vmDef->fss[i]->dst);
 
         if (lxcContainerResolveSymlinks(vmDef->fss[i], false) < 0)
             return -1;
 
 
         if (!(vmDef->fss[i]->src &&
-              STRPREFIX(vmDef->fss[i]->src, vmDef->fss[i]->dst)) &&
+              STRPREFIX(vmDef->fss[i]->src->path, vmDef->fss[i]->dst)) &&
             lxcContainerUnmountSubtree(vmDef->fss[i]->dst, false) < 0)
             return -1;
 
@@ -1807,7 +1807,7 @@ static int lxcContainerSetupPivotRoot(virDomainDefPtr vmDef,
 
     /* FIXME: we should find a way to unmount these mounts for container
      * even user namespace is enabled. */
-    if (STREQ(root->src, "/") && (!vmDef->idmap.nuidmap) &&
+    if (STREQ(root->src->path, "/") && (!vmDef->idmap.nuidmap) &&
         lxcContainerUnmountForSharedRoot(stateDir, vmDef->name) < 0)
         goto cleanup;
 
diff --git a/src/lxc/lxc_controller.c b/src/lxc/lxc_controller.c
index 8b5ec4c..457724f 100644
--- a/src/lxc/lxc_controller.c
+++ b/src/lxc/lxc_controller.c
@@ -417,18 +417,18 @@ static int virLXCControllerSetupLoopDeviceFS(virDomainFSDefPtr fs)
     int lofd;
     char *loname = NULL;
 
-    if ((lofd = virFileLoopDeviceAssociate(fs->src, &loname)) < 0)
+    if ((lofd = virFileLoopDeviceAssociate(fs->src->path, &loname)) < 0)
         return -1;
 
     VIR_DEBUG("Changing fs %s to use type=block for dev %s",
-              fs->src, loname);
+              fs->src->path, loname);
     /*
      * We now change it into a block device type, so that
      * the rest of container setup 'just works'
      */
     fs->type = VIR_DOMAIN_FS_TYPE_BLOCK;
-    VIR_FREE(fs->src);
-    fs->src = loname;
+    VIR_FREE(fs->src->path);
+    fs->src->path = loname;
     loname = NULL;
 
     return lofd;
@@ -478,21 +478,21 @@ static int virLXCControllerSetupNBDDeviceFS(virDomainFSDefPtr fs)
         return -1;
     }
 
-    if (virFileNBDDeviceAssociate(fs->src,
+    if (virFileNBDDeviceAssociate(fs->src->path,
                                   fs->format,
                                   fs->readonly,
                                   &dev) < 0)
         return -1;
 
     VIR_DEBUG("Changing fs %s to use type=block for dev %s",
-              fs->src, dev);
+              fs->src->path, dev);
     /*
      * We now change it into a block device type, so that
      * the rest of container setup 'just works'
      */
     fs->type = VIR_DOMAIN_FS_TYPE_BLOCK;
-    VIR_FREE(fs->src);
-    fs->src = dev;
+    VIR_FREE(fs->src->path);
+    fs->src->path = dev;
 
     return 0;
 }
@@ -628,7 +628,7 @@ static int virLXCControllerSetupLoopDevices(virLXCControllerPtr ctrl)
             /* The NBD device will be cleaned up while the cgroup will end.
              * For this we need to remember the qemu-nbd pid and add it to
              * the cgroup*/
-            if (virLXCControllerAppendNBDPids(ctrl, fs->src) < 0)
+            if (virLXCControllerAppendNBDPids(ctrl, fs->src->path) < 0)
                 goto cleanup;
         } else {
             virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
diff --git a/src/lxc/lxc_native.c b/src/lxc/lxc_native.c
index ef92c7d..53ce3f9 100644
--- a/src/lxc/lxc_native.c
+++ b/src/lxc/lxc_native.c
@@ -32,6 +32,7 @@
 #include "util/virlog.h"
 #include "util/virstring.h"
 #include "util/virconf.h"
+#include "conf/domain_conf.h"
 
 #define VIR_FROM_THIS VIR_FROM_LXC
 
@@ -46,12 +47,12 @@ lxcCreateFSDef(int type,
 {
     virDomainFSDefPtr def;
 
-    if (VIR_ALLOC(def) < 0)
+    if (!(def = virDomainFSDefNew()))
         return NULL;
 
     def->type = type;
     def->accessmode = VIR_DOMAIN_FS_ACCESSMODE_PASSTHROUGH;
-    if (src && VIR_STRDUP(def->src, src) < 0)
+    if (src && VIR_STRDUP(def->src->path, src) < 0)
         goto error;
     if (VIR_STRDUP(def->dst, dst) < 0)
         goto error;
diff --git a/src/lxc/lxc_process.c b/src/lxc/lxc_process.c
index 5e0bbe2..83ba0f3 100644
--- a/src/lxc/lxc_process.c
+++ b/src/lxc/lxc_process.c
@@ -1135,7 +1135,7 @@ virLXCProcessEnsureRootFS(virDomainObjPtr vm)
 
     root->type = VIR_DOMAIN_FS_TYPE_MOUNT;
 
-    if (VIR_STRDUP(root->src, "/") < 0 ||
+    if (VIR_STRDUP(root->src->path, "/") < 0 ||
         VIR_STRDUP(root->dst, "/") < 0)
         goto error;
 
diff --git a/src/openvz/openvz_conf.c b/src/openvz/openvz_conf.c
index 4103d69..b863f23 100644
--- a/src/openvz/openvz_conf.c
+++ b/src/openvz/openvz_conf.c
@@ -355,7 +355,7 @@ openvzReadFSConf(virDomainDefPtr def,
             goto error;
 
         fs->type = VIR_DOMAIN_FS_TYPE_TEMPLATE;
-        if (VIR_STRDUP(fs->src, temp) < 0)
+        if (VIR_STRDUP(fs->src->path, temp) < 0)
             goto error;
     } else {
         /* OSTEMPLATE was not found, VE was booted from a private dir directly */
@@ -374,7 +374,7 @@ openvzReadFSConf(virDomainDefPtr def,
             goto error;
 
         fs->type = VIR_DOMAIN_FS_TYPE_MOUNT;
-        if (!(fs->src = virStringReplace(temp, "$VEID", veid_str)))
+        if (!(fs->src->path = virStringReplace(temp, "$VEID", veid_str)))
             goto error;
 
         VIR_FREE(veid_str);
diff --git a/src/openvz/openvz_driver.c b/src/openvz/openvz_driver.c
index e154a0f..ef489c3 100644
--- a/src/openvz/openvz_driver.c
+++ b/src/openvz/openvz_driver.c
@@ -203,7 +203,7 @@ static int openvzSetInitialConfig(virDomainDefPtr vmdef)
             goto cleanup;
         }
 
-        if (openvzWriteVPSConfigParam(vpsid, "VE_PRIVATE", vmdef->fss[0]->src) < 0) {
+        if (openvzWriteVPSConfigParam(vpsid, "VE_PRIVATE", vmdef->fss[0]->src->path) < 0) {
             virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
                            _("Could not set the source dir for the filesystem"));
             goto cleanup;
@@ -2047,7 +2047,7 @@ openvzUpdateDevice(virDomainDefPtr vmdef,
         cur = vmdef->fss[pos];
 
         /* We only allow updating the quota */
-        if (STRNEQ(cur->src, fs->src)
+        if (STRNEQ(cur->src->path, fs->src->path)
             || cur->type != fs->type
             || cur->accessmode != fs->accessmode
             || cur->wrpolicy != fs->wrpolicy
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index eb02553..1483512 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -2033,7 +2033,7 @@ qemuBuildFSStr(virDomainFSDefPtr fs,
     }
 
     virBufferAsprintf(&opt, ",id=%s%s", QEMU_FSDEV_HOST_PREFIX, fs->info.alias);
-    virBufferAsprintf(&opt, ",path=%s", fs->src);
+    virBufferAsprintf(&opt, ",path=%s", fs->src->path);
 
     if (fs->readonly) {
         if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_FSDEV_READONLY)) {
diff --git a/src/vbox/vbox_common.c b/src/vbox/vbox_common.c
index c305eb5..7f76ab7 100644
--- a/src/vbox/vbox_common.c
+++ b/src/vbox/vbox_common.c
@@ -1837,7 +1837,7 @@ vboxAttachSharedFolder(virDomainDefPtr def, vboxGlobalData *data, IMachine *mach
             continue;
 
         VBOX_UTF8_TO_UTF16(def->fss[i]->dst, &nameUtf16);
-        VBOX_UTF8_TO_UTF16(def->fss[i]->src, &hostPathUtf16);
+        VBOX_UTF8_TO_UTF16(def->fss[i]->src->path, &hostPathUtf16);
         writable = !def->fss[i]->readonly;
 
         gVBoxAPI.UIMachine.CreateSharedFolder(machine, nameUtf16, hostPathUtf16,
@@ -3445,7 +3445,7 @@ vboxDumpSharedFolders(virDomainDefPtr def, vboxGlobalData *data, IMachine *machi
 
         gVBoxAPI.UISharedFolder.GetHostPath(sharedFolder, &hostPathUtf16);
         VBOX_UTF16_TO_UTF8(hostPathUtf16, &hostPath);
-        if (VIR_STRDUP(def->fss[i]->src, hostPath) < 0) {
+        if (VIR_STRDUP(def->fss[i]->src->path, hostPath) < 0) {
             VBOX_UTF8_FREE(hostPath);
             VBOX_UTF16_FREE(hostPathUtf16);
             goto sharedFoldersCleanup;
@@ -4156,7 +4156,7 @@ static int vboxDomainAttachDeviceImpl(virDomainPtr dom,
             PRBool writable;
 
             VBOX_UTF8_TO_UTF16(dev->data.fs->dst, &nameUtf16);
-            VBOX_UTF8_TO_UTF16(dev->data.fs->src, &hostPathUtf16);
+            VBOX_UTF8_TO_UTF16(dev->data.fs->src->path, &hostPathUtf16);
             writable = !dev->data.fs->readonly;
 
             rc = gVBoxAPI.UIMachine.CreateSharedFolder(machine, nameUtf16, hostPathUtf16,
diff --git a/src/vmx/vmx.c b/src/vmx/vmx.c
index f77a7a4..e350bed 100644
--- a/src/vmx/vmx.c
+++ b/src/vmx/vmx.c
@@ -2451,7 +2451,7 @@ int virVMXParseFileSystem(virConfPtr conf, int number, virDomainFSDefPtr *def)
     if (virVMXGetConfigString(conf, hostPath_name, &hostPath, false) < 0)
         goto cleanup;
 
-    (*def)->src = hostPath;
+    (*def)->src->path = hostPath;
     hostPath = NULL;
 
     /* vmx:guestName */
@@ -3663,7 +3663,7 @@ virVMXFormatFileSystem(virDomainFSDefPtr def, int number, virBufferPtr buffer)
     virBufferAsprintf(buffer, "sharedFolder%d.writeAccess = \"%s\"\n", number,
                       def->readonly ? "false" : "true");
     virBufferAsprintf(buffer, "sharedFolder%d.hostPath = \"%s\"\n", number,
-                      def->src);
+                      def->src->path);
     virBufferAsprintf(buffer, "sharedFolder%d.guestName = \"%s\"\n", number,
                       def->dst);
 
diff --git a/src/vz/vz_sdk.c b/src/vz/vz_sdk.c
index 8691887..00f42b8 100644
--- a/src/vz/vz_sdk.c
+++ b/src/vz/vz_sdk.c
@@ -589,7 +589,7 @@ prlsdkGetFSInfo(PRL_HANDLE prldisk,
     pret = PrlVmDev_GetImagePath(prldisk, buf, &buflen);
     prlsdkCheckRetGoto(pret, cleanup);
 
-    fs->src = buf;
+    fs->src->path = buf;
     buf = NULL;
 
     pret = PrlVmDevHd_GetMountPoint(prldisk, NULL, &buflen);
@@ -3282,13 +3282,13 @@ prlsdkAddFS(PRL_HANDLE sdkdom, virDomainFSDefPtr fs)
     pret = PrlVmDev_SetEmulatedType(sdkdisk, PDT_USE_IMAGE_FILE);
     prlsdkCheckRetGoto(pret, cleanup);
 
-    pret = PrlVmDev_SetSysName(sdkdisk, fs->src);
+    pret = PrlVmDev_SetSysName(sdkdisk, fs->src->path);
     prlsdkCheckRetGoto(pret, cleanup);
 
-    pret = PrlVmDev_SetImagePath(sdkdisk, fs->src);
+    pret = PrlVmDev_SetImagePath(sdkdisk, fs->src->path);
     prlsdkCheckRetGoto(pret, cleanup);
 
-    pret = PrlVmDev_SetFriendlyName(sdkdisk, fs->src);
+    pret = PrlVmDev_SetFriendlyName(sdkdisk, fs->src->path);
     prlsdkCheckRetGoto(pret, cleanup);
 
     pret = PrlVmDevHd_SetMountPoint(sdkdisk, fs->dst);
@@ -3537,7 +3537,7 @@ prlsdkCreateCt(virConnectPtr conn, virDomainDefPtr def)
     prlsdkCheckRetGoto(pret, cleanup);
 
     if (useTemplate) {
-        pret = PrlVmCfg_SetOsTemplate(sdkdom, def->fss[0]->src);
+        pret = PrlVmCfg_SetOsTemplate(sdkdom, def->fss[0]->src->path);
         prlsdkCheckRetGoto(pret, cleanup);
 
     }
-- 
1.8.3.1

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]