提交 84e27a6f 编写于 作者: D Dmitry Guryanov 提交者: Daniel Veillard

parallels: add support of removing disks

If some hard disk is not found in new domain configuration, it
should be removed.
Signed-off-by: NDmitry Guryanov <dguryanov@parallels.com>
上级 d5c4783c
...@@ -1576,6 +1576,22 @@ cleanup: ...@@ -1576,6 +1576,22 @@ cleanup:
return ret; return ret;
} }
static int parallelsRemoveHdd(parallelsDomObjPtr pdom,
virDomainDiskDefPtr disk)
{
char prlname[16];
prlname[15] = '\0';
snprintf(prlname, 15, "hdd%d", virDiskNameToIndex(disk->dst));
if (parallelsCmdRun(PRLCTL, "set", pdom->uuid,
"--device-del", prlname,
"--detach-only", NULL))
return -1;
return 0;
}
static int static int
parallelsApplyDisksParams(virConnectPtr conn, parallelsDomObjPtr pdom, parallelsApplyDisksParams(virConnectPtr conn, parallelsDomObjPtr pdom,
virDomainDiskDefPtr *olddisks, int nold, virDomainDiskDefPtr *olddisks, int nold,
...@@ -1594,10 +1610,14 @@ parallelsApplyDisksParams(virConnectPtr conn, parallelsDomObjPtr pdom, ...@@ -1594,10 +1610,14 @@ parallelsApplyDisksParams(virConnectPtr conn, parallelsDomObjPtr pdom,
} }
if (!newdisk) { if (!newdisk) {
virReportError(VIR_ERR_ARGUMENT_UNSUPPORTED, if (parallelsRemoveHdd(pdom, olddisk)) {
_("There is no disk with source '%s' " virReportError(VIR_ERR_ARGUMENT_UNSUPPORTED,
"in the specified config"), olddisks[i]->serial); _("Can't remove disk '%s' "
return -1; "in the specified config"), olddisks[i]->serial);
return -1;
}
continue;
} }
if (olddisk->bus != newdisk->bus || if (olddisk->bus != newdisk->bus ||
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册