[libvirt] [PATCH 2/8] parallels: add functions to list domains and get info

Daniel P. Berrange berrange at redhat.com
Fri Jul 27 09:26:14 UTC 2012


On Thu, Jul 26, 2012 at 10:32:01PM +0400, Dmitry Guryanov wrote:
> Parallels driver is 'stateless', like vmware or openvz drivers.
> It collects information about domains during startup using
> command-line utility prlctl. VMs in Parallels are identified by UUIDs
> or unique names, which can be used as respective fields in
> virDomainDef structure. Currently only basic info, like
> description, virtual cpus number and memory amount, is implemented.
> Querying devices information will be added in the next patches.
> 
> Parallels doesn't support non-persistent domains - you can't run
> a domain having only disk image, it must always be registered
> in system.
> 
> Functions for querying domain info have been just copied from
> test driver with some changes - they extract needed data from
> previously created list of virDomainObj objects.
> 
> Signed-off-by: Dmitry Guryanov <dguryanov at parallels.com>

> diff --git a/src/parallels/parallels_driver.c b/src/parallels/parallels_driver.c
> index 00a9074..c716b25 100644
> --- a/src/parallels/parallels_driver.c
> +++ b/src/parallels/parallels_driver.c
> @@ -54,14 +54,28 @@
>  #include "domain_conf.h"
>  #include "storage_conf.h"
>  #include "domain_event.h"
> +#include "virdomainlist.h"
>  
>  #include "parallels_driver.h"
> +#include "parallels_utils.h"
>  
>  #define VIR_FROM_THIS VIR_FROM_PARALLELS
>  
>  #define PRLCTL                      "prlctl"
>  #define PARALLELS_DEFAULT_ARCH      "x86_64"
>  
> +#define parallelsDomNotFoundError(domain)                                \
> +    do {                                                                 \
> +        char uuidstr[VIR_UUID_STRING_BUFLEN];                            \
> +        virUUIDFormat(domain->uuid, uuidstr);                            \
> +        virReportError(VIR_ERR_NO_DOMAIN,                                \
> +                       _("no domain with matching uuid '%s'"), uuidstr); \
> +    } while (0)
> +
> +#define parallelsParseError()                                                  \
> +    virReportErrorHelper(VIR_FROM_TEST, VIR_ERR_OPERATION_FAILED, __FILE__,    \
> +                     __FUNCTION__, __LINE__, _("Can't parse prlctl output"))

ITYM to  s/VIR_FROM_TEST/VIR_FROM_THIS/


Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|




More information about the libvir-list mailing list