Re: [PATCH 1/3] vz: delete domains when undefine is called

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

 



On Tue, 2015-12-22 at 18:29 +0300, Maxim Nestratov wrote:
> Currently vz driver unregisters domains when undefine is called,
> which is wrong because it contradicts with expected behavior.
> All vz domains are persistent, which means that when one is
> defined a new bundle directory containing meta data is created.
> Undefining domains in a way we do now leaves those directories
> undeleted, which prevents subsequent define call for the same
> domain xml. I.e. the following sequence define->undefine->define
> doesn't work now.
> The patch fixes the problem by calling PrlVm_Delete instead of
> PrlVm_Unreg detaching all disks prior actually doing this to
> prevent images deletion.

ACK

> 
> Signed-off-by: Maxim Nestratov <mnestratov@xxxxxxxxxxxxx>
> ---
>  src/vz/vz_sdk.c | 45 ++++++++++++++++++++++++++++++++++++++++++++-
>  1 file changed, 44 insertions(+), 1 deletion(-)
> 
> diff --git a/src/vz/vz_sdk.c b/src/vz/vz_sdk.c
> index 2b031c9..12c8be9 100644
> --- a/src/vz/vz_sdk.c
> +++ b/src/vz/vz_sdk.c
> @@ -3718,6 +3718,46 @@ prlsdkCreateCt(virConnectPtr conn, virDomainDefPtr def)
>      return ret;
>  }
>  
> +/**
> + * prlsdkDetachDomainHardDisks:
> + *
> + * @sdkdom: domain handle
> + *
> + * Returns 0 if hard disks were successfully detached or not detected.
> + */
> +static int
> +prlsdkDetachDomainHardDisks(PRL_HANDLE sdkdom)
> +{
> +    int ret = -1;
> +    PRL_RESULT pret;
> +    PRL_UINT32 hddCount;
> +    PRL_UINT32 i;
> +    PRL_HANDLE job;
> +
> +    job = PrlVm_BeginEdit(sdkdom);
> +    if (PRL_FAILED(waitJob(job)))
> +        goto cleanup;
> +
> +    pret = PrlVmCfg_GetHardDisksCount(sdkdom, &hddCount);
> +    prlsdkCheckRetGoto(pret, cleanup);
> +
> +    for (i = 0; i < hddCount; ++i) {
> +        ret = prlsdkDelDisk(sdkdom, i);
> +        if (ret)
> +            goto cleanup;
> +    }
> +
> +    job = PrlVm_CommitEx(sdkdom, PVCF_DETACH_HDD_BUNDLE);
> +    if (PRL_FAILED(waitJob(job)))
> +        ret = -1;
> +
> + cleanup:
> +
> +    return ret;
> +}
> +
> +
> +
>  int
>  prlsdkUnregisterDomain(vzConnPtr privconn, virDomainObjPtr dom)
>  {
> @@ -3728,7 +3768,10 @@ prlsdkUnregisterDomain(vzConnPtr privconn, virDomainObjPtr
> dom)
>      for (i = 0; i < dom->def->nnets; i++)
>          prlsdkCleanupBridgedNet(privconn, dom->def->nets[i]);
>  
> -    job = PrlVm_Unreg(privdom->sdkdom);
> +    if (prlsdkDetachDomainHardDisks(privdom->sdkdom))
> +        return -1;
> +
> +    job = PrlVm_Delete(privdom->sdkdom, PRL_INVALID_HANDLE);
>      if (PRL_FAILED(waitJob(job)))
>          return -1;
>  

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