[libvirt] [PATCH v4 05/13] parallels: create storage pools by VM list

Daniel Veillard veillard at redhat.com
Tue Dec 11 07:53:57 UTC 2012


On Tue, Dec 04, 2012 at 05:43:05PM +0400, Dmitry Guryanov wrote:
> There are no storage pools in Parallels Cloud Server -
> All VM data stored in a single directory: config, snapshots,
> memory dump together with disk images.
> 
> Let's look through list of VMs and create a storage pool for
> each directory, containing VMs.
> 
> So if you have 3 vms: /var/parallels/vm-1.pvm,
> /var/parallels/vm-2.pvm and /root/test.pvm - 2 storage pools
> appear: -var-parallels and -root. xml descriptions of the pools
> will be saved in /etc/libvirt/parallels-storage, so UUIDs will
> not change netween connections to libvirt.
> 
> Signed-off-by: Dmitry Guryanov <dguryanov at parallels.com>
> ---
>  src/parallels/parallels_driver.c  |    9 ++
>  src/parallels/parallels_storage.c |  155 +++++++++++++++++++++++++++++++++++++
>  src/parallels/parallels_utils.h   |    1 +
>  3 files changed, 165 insertions(+), 0 deletions(-)
> 
> diff --git a/src/parallels/parallels_driver.c b/src/parallels/parallels_driver.c
> index 11c5b83..fe91968 100644
> --- a/src/parallels/parallels_driver.c
> +++ b/src/parallels/parallels_driver.c
> @@ -104,6 +104,7 @@ parallelsDomObjFreePrivate(void *p)
>          return;
>  
>      VIR_FREE(pdom->uuid);
> +    VIR_FREE(pdom->home);
>      VIR_FREE(p);
>  };
>  
> @@ -666,6 +667,14 @@ parallelsLoadDomain(parallelsConnPtr privconn, virJSONValuePtr jobj)
>      if (!(pdom->uuid = strdup(tmp)))
>          goto no_memory;
>  
> +    if (!(tmp = virJSONValueObjectGetString(jobj, "Home"))) {
> +        parallelsParseError();
> +        goto cleanup;
> +    }
> +
> +    if (!(pdom->home = strdup(tmp)))
> +        goto no_memory;
> +
>      if (!(tmp = virJSONValueObjectGetString(jobj, "OS")))
>          goto cleanup;
>  
> diff --git a/src/parallels/parallels_storage.c b/src/parallels/parallels_storage.c
> index 90c425a..148d870 100644
> --- a/src/parallels/parallels_storage.c
> +++ b/src/parallels/parallels_storage.c
> @@ -25,6 +25,7 @@
>  #include <stdlib.h>
>  #include <dirent.h>
>  #include <sys/statvfs.h>
> +#include <libgen.h>

  okay, I was a bit worried by ortability there, but apparently we
  already use this for cgroup support so as long as parallels platform
is linux only we should be safe there,

>  #include "datatypes.h"
>  #include "memory.h"
> @@ -114,12 +115,159 @@ cleanup:

 ACK,

Daniel

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




More information about the libvir-list mailing list