[PATCH 4/4] parallels: create VMs in the default place

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

 



Each VM consists of a set of files in PCS: config, hard
disk images, log file, memory dump. All these files are stored
in a per-vm directory. When we create a new VM, we can ether specify
path to the VM or create the VM in a default path
(<default path>/<vm name>.pvm). This default path can be configured
with command
prlsrvctl user set --def-vm-home <path> command.

Currenty parallels driver creates VM in the same place, where first
hard disk is located. Let's change this logic and create VMs in
the default path. It will be much clearer and allow us to create
VMs without hard disks.

Signed-off-by: Dmitry Guryanov <dguryanov@xxxxxxxxxxxxx>
---
 src/parallels/parallels_driver.c | 63 ++--------------------------------------
 1 file changed, 3 insertions(+), 60 deletions(-)

diff --git a/src/parallels/parallels_driver.c b/src/parallels/parallels_driver.c
index 67b28c4..f3ef260 100644
--- a/src/parallels/parallels_driver.c
+++ b/src/parallels/parallels_driver.c
@@ -2175,74 +2175,17 @@ parallelsApplyChanges(virDomainObjPtr dom, virDomainDefPtr new)
 }
 
 static int
-parallelsCreateVm(virConnectPtr conn, virDomainDefPtr def)
+parallelsCreateVm(virConnectPtr conn ATTRIBUTE_UNUSED, virDomainDefPtr def)
 {
-    parallelsConnPtr privconn = conn->privateData;
-    size_t i;
-    virStorageVolDefPtr privvol = NULL;
-    virStoragePoolObjPtr pool = NULL;
-    virStorageVolPtr vol = NULL;
     char uuidstr[VIR_UUID_STRING_BUFLEN];
-    const char *src;
-
-    for (i = 0; i < def->ndisks; i++) {
-        if (def->disks[i]->device != VIR_DOMAIN_DISK_DEVICE_DISK)
-            continue;
-
-        src = virDomainDiskGetSource(def->disks[i]);
-        vol = parallelsStorageVolLookupByPathLocked(conn, src);
-        if (!vol) {
-            virReportError(VIR_ERR_INVALID_ARG,
-                           _("Can't find volume with path '%s'"),
-                           src);
-            return -1;
-        }
-        break;
-    }
-
-    if (!vol) {
-        /* We determine path to VM directory from volume, so
-         * let's report error if no disk until better solution
-         * will be found */
-        virReportError(VIR_ERR_INVALID_ARG,
-                       _("Can't create VM '%s' without hard disks"),
-                       def->name ? def->name : _("(unnamed)"));
-        return -1;
-    }
-
-    pool = virStoragePoolObjFindByName(&privconn->pools, vol->pool);
-    if (!pool) {
-        virReportError(VIR_ERR_INVALID_ARG,
-                       _("Can't find storage pool with name '%s'"),
-                       vol->pool);
-        goto error;
-    }
-
-    privvol = virStorageVolDefFindByPath(pool, src);
-    if (!privvol) {
-        virReportError(VIR_ERR_INVALID_ARG,
-                       _("Can't find storage volume definition for path '%s'"),
-                       src);
-        goto error2;
-    }
 
     virUUIDFormat(def->uuid, uuidstr);
 
-    if (parallelsCmdRun(PRLCTL, "create", def->name, "--dst",
-                        pool->def->target.path, "--no-hdd",
+    if (parallelsCmdRun(PRLCTL, "create", def->name, "--no-hdd",
                         "--uuid", uuidstr, NULL) < 0)
-        goto error2;
-
-    virStoragePoolObjUnlock(pool);
-    virObjectUnref(vol);
+        return -1;
 
     return 0;
-
- error2:
-    virStoragePoolObjUnlock(pool);
- error:
-    virObjectUnref(vol);
-    return -1;
 }
 
 static int
-- 
1.9.0

--
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]