From: Dmitry Guryanov Date: Wed, 7 May 2014 18:04:09 +0000 (+0400) Subject: parallels: create VMs in the default place X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=4bafe31264f96b3c6c3800646fe7131ba44f4d73;p=libvirt.git parallels: create VMs in the default place 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 (/.pvm). This default path can be configured with command prlsrvctl user set --def-vm-home 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 --- diff --git a/src/parallels/parallels_driver.c b/src/parallels/parallels_driver.c index 4fa8152867..ab595999ba 100644 --- a/src/parallels/parallels_driver.c +++ b/src/parallels/parallels_driver.c @@ -2177,74 +2177,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