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

Re: [libvirt] [PATCH v4 12/13] parallels: apply config after VM creation



On Tue, Dec 04, 2012 at 05:43:12PM +0400, Dmitry Guryanov wrote:
> New VM will have default values for all parameters, like
> cpu number, we have to change its configuration as provided
> by xml definition, given to parallelsDomainDefineXML.
> 
> Signed-off-by: Dmitry Guryanov <dguryanov parallels com>
> ---
>  src/parallels/parallels_driver.c |   33 +++++++++++++++++----------------
>  1 files changed, 17 insertions(+), 16 deletions(-)
> 
> diff --git a/src/parallels/parallels_driver.c b/src/parallels/parallels_driver.c
> index fe034f6..64bf409 100644
> --- a/src/parallels/parallels_driver.c
> +++ b/src/parallels/parallels_driver.c
> @@ -2011,20 +2011,6 @@ parallelsDomainDefineXML(virConnectPtr conn, const char *xml)
>  
>      if (dupVM == 1) {
>          olddom = virDomainFindByUUID(&privconn->domains, def->uuid);
> -        if (parallelsApplyChanges(conn, olddom, def) < 0) {
> -            virDomainObjUnlock(olddom);
> -            goto cleanup;
> -        }
> -        virDomainObjUnlock(olddom);
> -
> -        if (!(dom = virDomainAssignDef(privconn->caps,
> -                                       &privconn->domains, def, false))) {
> -            virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
> -                           _("Can't allocate domobj"));
> -            goto cleanup;
> -        }
> -
> -        def = NULL;
>      } else {
>          if (STREQ(def->os.type, "hvm")) {
>              if (parallelsCreateVm(conn, def))
> @@ -2039,8 +2025,8 @@ parallelsDomainDefineXML(virConnectPtr conn, const char *xml)
>          }
>          if (parallelsLoadDomains(privconn, def->name))
>              goto cleanup;
> -        dom = virDomainFindByName(&privconn->domains, def->name);
> -        if (!dom) {
> +        olddom = virDomainFindByName(&privconn->domains, def->name);
> +        if (!olddom) {
>              virReportError(VIR_ERR_INTERNAL_ERROR,
>                             _("Domain for '%s' is not defined after creation"),
>                             def->name ? def->name : _("(unnamed)"));
> @@ -2048,6 +2034,21 @@ parallelsDomainDefineXML(virConnectPtr conn, const char *xml)
>          }
>      }
>  
> +    if (parallelsApplyChanges(conn, olddom, def) < 0) {
> +        virDomainObjUnlock(olddom);
> +        goto cleanup;
> +    }
> +    virDomainObjUnlock(olddom);
> +
> +    if (!(dom = virDomainAssignDef(privconn->caps,
> +                                   &privconn->domains, def, false))) {
> +        virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
> +                       _("Can't allocate domobj"));
> +        goto cleanup;
> +    }
> +
> +    def = NULL;
> +
>      ret = virGetDomain(conn, dom->def->name, dom->def->uuid);
>      if (ret)
>          ret->id = dom->def->id;

  ACK,

Daniel

-- 
Daniel Veillard      | Open Source and Standards, Red Hat
veillard redhat com  | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | virtualization library  http://libvirt.org/


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