Re: [PATCH 1/4] parallels: add support of containers to the driver

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

 



On Mon, Sep 10, 2012 at 07:22:42PM +0400, Dmitry Guryanov wrote:
> This patch makes parallelsLoadDomains to be able to load information
> about containers. So functions, which return different information
> and change state will work.
> 
> parallelsDomainDefineXML will be fixed in separate patch.
> 
> Signed-off-by: Dmitry Guryanov <dguryanov@xxxxxxxxxxxxx>
> ---
>  src/parallels/parallels_driver.c |   27 ++++++++++++++++++++++++---
>  1 files changed, 24 insertions(+), 3 deletions(-)
> 
> diff --git a/src/parallels/parallels_driver.c b/src/parallels/parallels_driver.c
> index 06a75b3..45a3d82 100644
> --- a/src/parallels/parallels_driver.c
> +++ b/src/parallels/parallels_driver.c
> @@ -130,6 +130,15 @@ parallelsBuildCapabilities(void)
>                                        "parallels", NULL, NULL, 0, NULL) == NULL)
>          goto no_memory;
>  
> +    if ((guest = virCapabilitiesAddGuest(caps, "exe", PARALLELS_DEFAULT_ARCH,
> +                                         64, "parallels",
> +                                         NULL, 0, NULL)) == NULL)
> +        goto no_memory;
> +
> +    if (virCapabilitiesAddGuestDomain(guest,
> +                                      "parallels", NULL, NULL, 0, NULL) == NULL)
> +        goto no_memory;
> +
>      caps->defaultConsoleTargetType = parallelsDefaultConsoleType;
>      return caps;
>  
> @@ -490,8 +499,20 @@ parallelsLoadDomain(parallelsConnPtr privconn, virJSONValuePtr jobj)
>      def->mem.max_balloon <<= 10;
>      def->mem.cur_balloon = def->mem.max_balloon;
>  
> -    if (!(def->os.type = strdup("hvm")))
> -        goto no_memory;
> +    if (!(tmp = virJSONValueObjectGetString(jobj, "Type"))) {
> +        parallelsParseError();
> +        goto cleanup;
> +    }
> +
> +    if (STREQ(tmp, "CT")) {
> +        if (!(def->os.type = strdup("exe")))
> +            goto no_memory;
> +        if (!(def->os.init = strdup("/sbin/init")))
> +            goto no_memory;

  okay so you end up with an hypervisor type of parallels but <os>exe</os>
for those kind of domains. That sounds fine.

> +    } else if (STREQ(tmp, "VM")) {
> +        if (!(def->os.type = strdup("hvm")))
> +            goto no_memory;
> +    }
>  
>      if (!(def->os.arch = strdup(PARALLELS_DEFAULT_ARCH)))
>          goto no_memory;
> @@ -577,7 +598,7 @@ parallelsLoadDomains(parallelsConnPtr privconn, const char *domain_name)
>      int ret = -1;
>  
>      jobj = parallelsParseOutput(PRLCTL, "list", "-j", "-a", "-i", "-H",
> -                                "--vmtype", "vm", domain_name, NULL);
> +                                "--vmtype", "all", domain_name, NULL);

  and here you ask to list both kind of domains,

>      if (!jobj) {
>          parallelsParseError();
>          goto cleanup;

  That sounds right, ACK,

Daniel

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

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