[libvirt] [PATCH v3 1/4] filesystem: adds possibility to use storage pool as fs source
maxim nestratov
mnestratov at virtuozzo.com
Mon Jul 18 20:03:07 UTC 2016
14-Jul-16 16:52, Olga Krishtal пишет:
> Signed-off-by: Olga Krishtal <okrishtal at virtuozzo.com>
> ---
> src/conf/domain_audit.c | 4 ++--
> src/conf/domain_conf.c | 34 ++++++++++++++++++++++++-------
> src/conf/domain_conf.h | 3 ++-
> 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 | 4 ++--
> src/openvz/openvz_conf.c | 6 +++---
> src/openvz/openvz_driver.c | 4 ++--
> src/qemu/qemu_command.c | 2 +-
> src/vbox/vbox_common.c | 6 +++---
> src/vmx/vmx.c | 6 +++---
> src/vz/vz_sdk.c | 12 +++++------
> 15 files changed, 90 insertions(+), 67 deletions(-)
>
> diff --git a/src/conf/domain_audit.c b/src/conf/domain_audit.c
> index 6ad0acb..53a58ac 100644
> --- a/src/conf/domain_audit.c
> +++ b/src/conf/domain_audit.c
> @@ -296,8 +296,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 9f7b906..0b33b3b 100644
> --- a/src/conf/domain_conf.c
> +++ b/src/conf/domain_conf.c
> @@ -1698,12 +1698,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);
>
> @@ -8528,7 +8547,7 @@ virDomainFSDefParseXML(xmlNodePtr node,
>
> ctxt->node = node;
>
> - if (VIR_ALLOC(def) < 0)
> + if (!(def = virDomainFSDefNew()))
> return NULL;
>
> type = virXMLPropString(node, "type");
> @@ -8655,7 +8674,7 @@ virDomainFSDefParseXML(xmlNodePtr node,
> goto error;
> }
>
> - def->src = source;
> + def->src->path = source;
> source = NULL;
> def->dst = target;
> target = NULL;
> @@ -20144,6 +20163,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,
> @@ -20180,22 +20200,22 @@ 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:
> diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
> index ba0ad5f..281abba 100644
> --- a/src/conf/domain_conf.h
> +++ b/src/conf/domain_conf.h
> @@ -802,7 +802,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;
> @@ -2474,6 +2474,7 @@ virDomainDiskDefPtr virDomainDiskFindByBusAndDst(virDomainDefPtr def,
> int bus,
> char *dst);
> void virDomainControllerDefFree(virDomainControllerDefPtr def);
> +virDomainFSDefPtr virDomainFSDefNew(void);
> virDomainControllerDefPtr
> virDomainControllerDefNew(virDomainControllerType type);
> void virDomainFSDefFree(virDomainFSDefPtr def);
> diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
> index ccb4c5e..5f3a809 100644
> --- a/src/libvirt_private.syms
> +++ b/src/libvirt_private.syms
> @@ -292,6 +292,7 @@ virDomainDiskSetDriver;
> virDomainDiskSetFormat;
> virDomainDiskSetSource;
> virDomainDiskSetType;
> +virDomainFSDefNew;
Incorrect alphabetical order
> virDomainFSDefFree;
> virDomainFSIndexByName;
> virDomainFSInsert;
> diff --git a/src/lxc/lxc_cgroup.c b/src/lxc/lxc_cgroup.c
> index ea86d36..1c42ab5 100644
> --- a/src/lxc/lxc_cgroup.c
> +++ b/src/lxc/lxc_cgroup.c
> @@ -412,7 +412,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 916a37b..a39e24f 100644
> --- a/src/lxc/lxc_container.c
> +++ b/src/lxc/lxc_container.c
> @@ -619,27 +619,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;
> }
> @@ -647,10 +647,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;
> }
> @@ -698,8 +698,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;
> }
> @@ -711,7 +711,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) {
> @@ -720,7 +720,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) {
> @@ -751,18 +751,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;
> }
> }
> @@ -1179,9 +1179,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) {
> @@ -1514,9 +1514,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);
> @@ -1622,14 +1622,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;
>
> @@ -1777,7 +1777,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 e58ff1b..f55aadc 100644
> --- a/src/lxc/lxc_controller.c
> +++ b/src/lxc/lxc_controller.c
> @@ -424,18 +424,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;
> @@ -485,21 +485,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;
> }
> @@ -635,7 +635,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 acbc20b..ed92049 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 28313f0..6761394 100644
> --- a/src/lxc/lxc_process.c
> +++ b/src/lxc/lxc_process.c
> @@ -1153,12 +1153,12 @@ virLXCProcessEnsureRootFS(virDomainObjPtr vm)
> if (root)
> return 0;
>
> - if (VIR_ALLOC(root) < 0)
> + if (!(root = virDomainFSDefNew()) < 0)
> goto error;
>
> 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 50f4902..da67488 100644
> --- a/src/openvz/openvz_conf.c
> +++ b/src/openvz/openvz_conf.c
> @@ -351,11 +351,11 @@ openvzReadFSConf(virDomainDefPtr def,
> veid);
> goto error;
> } else if (ret > 0) {
> - if (VIR_ALLOC(fs) < 0)
> + if (!(fs = virDomainFSDefNew()) < 0)
> 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 48c264b..2bb9db0 100644
> --- a/src/openvz/openvz_driver.c
> +++ b/src/openvz/openvz_driver.c
> @@ -206,7 +206,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;
> @@ -2050,7 +2050,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 3898ed7..1c50c4c 100644
> --- a/src/qemu/qemu_command.c
> +++ b/src/qemu/qemu_command.c
> @@ -2087,7 +2087,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 8e49268..0996a1e 100644
> --- a/src/vbox/vbox_common.c
> +++ b/src/vbox/vbox_common.c
> @@ -1839,7 +1839,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,
> @@ -3448,7 +3448,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;
> @@ -4159,7 +4159,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 d443dd0..f910f4f 100644
> --- a/src/vmx/vmx.c
> +++ b/src/vmx/vmx.c
> @@ -2422,7 +2422,7 @@ int virVMXParseFileSystem(virConfPtr conf, int number, virDomainFSDefPtr *def)
> return -1;
> }
>
> - if (VIR_ALLOC(*def) < 0)
> + if (!(*def = virDomainFSDefNew()))
> return -1;
>
> (*def)->type = VIR_DOMAIN_FS_TYPE_MOUNT;
> @@ -2450,7 +2450,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 */
> @@ -3690,7 +3690,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 eff6114..b13b84d 100644
> --- a/src/vz/vz_sdk.c
> +++ b/src/vz/vz_sdk.c
> @@ -658,7 +658,7 @@ prlsdkGetFSInfo(PRL_HANDLE prldisk,
> if (!(buf = prlsdkGetStringParamVar(PrlVmDev_GetImagePath, prldisk)))
> goto cleanup;
>
> - fs->src = buf;
> + fs->src->path = buf;
> buf = NULL;
>
> if (!(buf = prlsdkGetStringParamVar(PrlVmDevHd_GetMountPoint, prldisk)))
> @@ -699,7 +699,7 @@ prlsdkAddDomainHardDisksInfo(vzDriverPtr driver, PRL_HANDLE sdkdom, virDomainDef
>
> if (PDT_USE_REAL_DEVICE != emulatedType && IS_CT(def)) {
>
> - if (VIR_ALLOC(fs) < 0)
> + if (!(fs = virDomainFSDefNew()))
> goto error;
>
> if (prlsdkGetFSInfo(hdd, fs) < 0)
> @@ -3533,13 +3533,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);
> @@ -3892,7 +3892,7 @@ prlsdkCreateCt(vzDriverPtr driver, 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);
>
> }
A small nit inline otherwise look good.
Maxim
More information about the libvir-list
mailing list