On Tue, Dec 04, 2012 at 05:43:13PM +0400, Dmitry Guryanov wrote: > If some hard disk is not found in new domain configuration, it > should be removed. > > Signed-off-by: Dmitry Guryanov <dguryanov@xxxxxxxxxxxxx> > --- > src/parallels/parallels_driver.c | 28 ++++++++++++++++++++++++---- > 1 files changed, 24 insertions(+), 4 deletions(-) > > diff --git a/src/parallels/parallels_driver.c b/src/parallels/parallels_driver.c > index 64bf409..bbbc9d5 100644 > --- a/src/parallels/parallels_driver.c > +++ b/src/parallels/parallels_driver.c > @@ -1576,6 +1576,22 @@ cleanup: > 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 > parallelsApplyDisksParams(virConnectPtr conn, parallelsDomObjPtr pdom, > virDomainDiskDefPtr *olddisks, int nold, > @@ -1592,10 +1608,14 @@ parallelsApplyDisksParams(virConnectPtr conn, parallelsDomObjPtr pdom, > } > > if (!newdisk) { > - virReportError(VIR_ERR_ARGUMENT_UNSUPPORTED, > - _("There is no disk with source '%s' " > - "in the specified config"), olddisks[i]->serial); > - return -1; > + if (parallelsRemoveHdd(pdom, olddisk)) { > + virReportError(VIR_ERR_ARGUMENT_UNSUPPORTED, > + _("Can't remove disk '%s' " > + "in the specified config"), olddisks[i]->serial); > + return -1; > + } > + > + continue; > } > > if (olddisk->bus != newdisk->bus || ACK, Daniel -- Daniel Veillard | Open Source and Standards, Red Hat veillard@xxxxxxxxxx | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ http://veillard.com/ | virtualization library http://libvirt.org/ -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list