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

Re: [libvirt] [PATCH] parallels: implement containers creation



On Wed, Sep 12, 2012 at 04:40:54PM +0400, Dmitry Guryanov wrote:
> Add separate function parallelsCreateCt, which creates container.
> Also add example xml configuration domain-parallels-ct-simple.xml.
> 
> Signed-off-by: Dmitry Guryanov <dguryanov parallels com>
> ---
>  src/parallels/parallels_driver.c                   |   41 +++++++++++++++++++-
>  .../domain-parallels-ct-simple.xml                 |   27 +++++++++++++
>  2 files changed, 67 insertions(+), 1 deletions(-)
>  create mode 100644 tests/domainschemadata/domain-parallels-ct-simple.xml
> 
> diff --git a/src/parallels/parallels_driver.c b/src/parallels/parallels_driver.c
> index 9eb2526..0dd13fe 100644
> --- a/src/parallels/parallels_driver.c
> +++ b/src/parallels/parallels_driver.c
> @@ -1663,6 +1663,36 @@ parallelsCreateVm(virConnectPtr conn, virDomainDefPtr def)
>      return -1;
>  }
>  
> +static int
> +parallelsCreateCt(virConnectPtr conn ATTRIBUTE_UNUSED, virDomainDefPtr def)
> +{
> +    char uuidstr[VIR_UUID_STRING_BUFLEN];
> +
> +    virUUIDFormat(def->uuid, uuidstr);
> +
> +    if (def->nfss != 1 ||
> +        def->fss[0]->type != VIR_DOMAIN_FS_TYPE_TEMPLATE) {
> +
> +        virReportError(VIR_ERR_INVALID_ARG, "%s",
> +                       _("There must be only 1 template FS for "
> +                         "container creation"));
> +        goto error;
> +    }
> +
> +    if (parallelsCmdRun(PRLCTL, "create", def->name, "--vmtype", "ct",
> +                        "--uuid", uuidstr,
> +                        "--ostemplate", def->fss[0]->src, NULL) < 0)
> +        goto error;
> +
> +    if (parallelsCmdRun(PRLCTL, "set", def->name, "--vnc-mode", "auto", NULL) < 0)
> +        goto error;
> +
> +    return 0;
> +
> +error:
> +    return -1;
> +}
> +
>  static virDomainPtr
>  parallelsDomainDefineXML(virConnectPtr conn, const char *xml)
>  {
> @@ -1703,8 +1733,17 @@ parallelsDomainDefineXML(virConnectPtr conn, const char *xml)
>  
>          def = NULL;
>      } else {
> -        if (parallelsCreateVm(conn, def))
> +        if (STREQ(def->os.type, "hvm")) {
> +            if (parallelsCreateVm(conn, def))
> +                goto cleanup;
> +        } else if (STREQ(def->os.type, "exe")) {
> +            if (parallelsCreateCt(conn, def))
> +                goto cleanup;
> +        } else {
> +            virReportError(VIR_ERR_INVALID_ARG,
> +                           _("Unsupported OS type: %s"), def->os.type);
>              goto cleanup;
> +        }
>          if (parallelsLoadDomains(privconn, def->name))
>              goto cleanup;
>          dom = virDomainFindByName(&privconn->domains, def->name);
> diff --git a/tests/domainschemadata/domain-parallels-ct-simple.xml b/tests/domainschemadata/domain-parallels-ct-simple.xml
> new file mode 100644
> index 0000000..a2b87ce
> --- /dev/null
> +++ b/tests/domainschemadata/domain-parallels-ct-simple.xml
> @@ -0,0 +1,27 @@
> +<domain type='parallels'>
> +  <name>1010</name>
> +  <uuid>88576506-d611-41c2-b6b6-c9043704a0dd</uuid>
> +  <description></description>
> +  <memory unit='KiB'>262144</memory>
> +  <currentMemory unit='KiB'>262144</currentMemory>
> +  <vcpu placement='static'>8</vcpu>
> +  <os>
> +      <type arch='x86_64'>exe</type>
> +      <init>/sbin/init</init>
> +  </os>
> +  <clock offset='utc'/>
> +  <on_poweroff>destroy</on_poweroff>
> +  <on_reboot>destroy</on_reboot>
> +  <on_crash>destroy</on_crash>
> +  <devices>
> +    <filesystem type='template'>
> +        <source name='centos-6-x86_64'/>
> +        <target dir='/'/>
> +    </filesystem>
> +    <video>
> +      <model type='vga' vram='16777216' heads='1'>
> +        <acceleration accel3d='no' accel2d='no'/>
> +      </model>
> +    </video>
> +  </devices>
> +</domain>

  Seems to be the 4/4 part of the series

  ACK, looks fine, I pushed the 4 patches set as a result

   thanks !

Daniel

-- 
Daniel Veillard      | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
daniel veillard com  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/


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