Re: [PATCH] vz: implementation of domainCreateXML callback

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

 



On Fri, 2015-11-20 at 16:52 +0300, Mikhail Feoktistov wrote:
> ---
>  src/vz/vz_driver.c | 33 +++++++++++++++++++++++++++++++++
>  1 file changed, 33 insertions(+)
> 
> diff --git a/src/vz/vz_driver.c b/src/vz/vz_driver.c
> index 39f58a4..31dfb6a 100644
> --- a/src/vz/vz_driver.c
> +++ b/src/vz/vz_driver.c
> @@ -979,6 +979,38 @@ vzDomainUndefine(virDomainPtr domain)
>      return vzDomainUndefineFlags(domain, 0);
>  }
>  
> +static virDomainPtr
> +vzDomainCreateXML(virConnectPtr conn,
> +                  const char *xml,
> +                  unsigned int flags)
> +{
> +    virDomainPtr domain;
> +    int ret;
> +
> +    virCheckFlags(VIR_DOMAIN_START_PAUSED, NULL);
> +
> +    domain = vzDomainDefineXMLFlags(conn, xml, 0);
> +    if (domain == NULL)
> +        return domain;
> +
> +    ret = vzDomainCreate(domain);
> +    if (ret != 0) {
> +        vzDomainUndefine(domain);
> +        return NULL;
> +    }
> +
> +    if (flags & VIR_DOMAIN_START_PAUSED) {
> +        ret = vzDomainSuspend(domain);
> +        if (ret != 0) {
> +            vzDomainDestroy(domain);
> +            vzDomainUndefine(domain);
> +            return NULL;
> +        }

I think we shouldn't allow this start paused operation. Because it means that
domain shouldn't run any code before being paused, and with this implementation
we start a domain, it does some work and only that you suspend it. Also suspend
and paused states are different and we only support paused state for VMs.

> +    }
> +
> +    return domain;
> +}
> +
>  static int
>  vzDomainHasManagedSaveImage(virDomainPtr domain, unsigned int flags)
>  {
> @@ -1493,6 +1525,7 @@ static virHypervisorDriver vzDriver = {
>      .domainShutdown = vzDomainShutdown, /* 0.10.0 */
>      .domainCreate = vzDomainCreate,    /* 0.10.0 */
>      .domainCreateWithFlags = vzDomainCreateWithFlags, /* 1.2.10 */
> +    .domainCreateXML = vzDomainCreateXML, /* 1.2.22 */
>      .domainReboot = vzDomainReboot, /* 1.2.22 */
>      .domainDefineXML = vzDomainDefineXML,      /* 0.10.0 */
>      .domainDefineXMLFlags = vzDomainDefineXMLFlags, /* 1.2.12 */
-- 
Dmitry Guryanov

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