+ return -1;
+ }
+
+ pool = virStoragePoolObjFindByName(&privconn->pools, vol->pool);
+ if (!pool) {
+ parallelsError(VIR_ERR_INVALID_ARG,
+ _("Can't find storage pool with name '%s'"),
+ vol->pool);
+ goto error;
+ }
+
+ privvol = virStorageVolDefFindByPath(pool, def->disks[i]->src);
+ if (!privvol) {
+ parallelsError(VIR_ERR_INVALID_ARG,
+ _("Can't find storage volume definition for path
'%s'"),
+ def->disks[i]->src);
+ goto error2;
+ }
+
+ virUUIDFormat(def->uuid, uuidstr);
+
+ if (parallelsCmdRun(PRLCTL, "create", def->name, "--dst",
+ pool->def->target.path, "--no-hdd",
+ "--uuid", uuidstr, NULL) < 0)
+ goto error2;
+
+ if (parallelsCmdRun(PRLCTL, "set", def->name, "--vnc-mode",
"auto", NULL) < 0)
+ goto error2;
+
+ virStoragePoolObjUnlock(pool);
+ virUnrefStorageVol(vol);
+
+ return 0;
+
+ error2:
+ virStoragePoolObjUnlock(pool);
+ error:
+ virUnrefStorageVol(vol);
+ return -1;
+}
+
static virDomainPtr
parallelsDomainDefineXML(virConnectPtr conn, const char *xml)
{
@@ -1153,8 +1221,16 @@ parallelsDomainDefineXML(virConnectPtr conn,
const char *xml)
def = NULL;
} else {
- parallelsError(VIR_ERR_NO_SUPPORT, _("Not implemented yet"));
+ if (parallelsCreateVm(conn, def))
goto cleanup;
+ if (parallelsLoadDomains(privconn, def->name))
+ goto cleanup;
+ dom = virDomainFindByName(&privconn->domains, def->name);
+ if (!dom) {
+ parallelsError(VIR_ERR_INTERNAL_ERROR,
+ _("Domain is not defined after creation"));
+ goto cleanup;
+ }
}
event = virDomainEventNewFromObj(dom,
diff --git a/src/parallels/parallels_driver.h
b/src/parallels/parallels_driver.h
index 6f06ac8..e32ad55 100644
--- a/src/parallels/parallels_driver.h
+++ b/src/parallels/parallels_driver.h
@@ -67,5 +67,9 @@ int parallelsCmdRun(const char *binary, ...)
ATTRIBUTE_NONNULL(1) ATTRIBUTE_SENT
char * parallelsAddFileExt(const char *path, const char *ext);
void parallelsDriverLock(parallelsConnPtr driver);
void parallelsDriverUnlock(parallelsConnPtr driver);
+virStorageVolPtr parallelsStorageVolumeLookupByPathLocked(virConnectPtr
+ conn,
+ const char
+ *path);
#endif
diff --git a/src/parallels/parallels_storage.c
b/src/parallels/parallels_storage.c
index 5a5b366..c86ddaf 100644
--- a/src/parallels/parallels_storage.c
+++ b/src/parallels/parallels_storage.c
@@ -41,10 +41,6 @@ static virStorageVolDefPtr
parallelsStorageVolumeDefine(virStoragePoolObjPtr poo
const char *xmldesc,
const char *xmlfile,
bool is_new);
-static virStorageVolPtr
parallelsStorageVolumeLookupByPathLocked(virConnectPtr
- conn,
- const char
- *path);
static virStorageVolPtr
parallelsStorageVolumeLookupByPath(virConnectPtr conn,
const char
*path);
static int parallelsStoragePoolGetAlloc(virStoragePoolDefPtr def);
@@ -939,7 +935,7 @@ parallelsStorageVolumeLookupByKey(virConnectPtr
conn, const char *key)
return ret;
}
-static virStorageVolPtr
+virStorageVolPtr
parallelsStorageVolumeLookupByPathLocked(virConnectPtr conn, const
char *path)
{
parallelsConnPtr privconn = conn->privateData;