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

[Xen-changelog] [xen-unstable] libxenlight: remove any uuid dependancies from xl



# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1262680780 0
# Node ID 74ca2cb026a5d5332b980e3f77b7f60e5bae26ff
# Parent  19479955c0741ad4787f5f83bc5fa4612fd7bd44
libxenlight: remove any uuid dependancies from xl

uuid handles in create and now create_device_model need to fill the
uuid field by client. the uuid field happens to be the exact same size
as the standard uuid (sixteen 8 bits values).

stubdom need to have a uuid when created, so using the one in
create_device_model.

this permits the client library to generate the uuid in any way it see
fits (even if it's not compliant to any standard), and simplify
installation of the libxenlight header.

xl converted from libuuid generated uuid to generated through random()
C call.  need to be fixed if anyone plan to use xl for anything
seriously apart from developing libxl.

Signed-off-by: Vincent Hanquez <vincent.hanquez@xxxxxxxxxxxxx>
---
 tools/libxl/xen_uuid.h       |  135 -------------------------------------------
 tools/libxl/Makefile         |    5 -
 tools/libxl/libxl.c          |   39 ++----------
 tools/libxl/libxl.h          |    7 --
 tools/libxl/libxl_internal.h |    6 +
 tools/libxl/libxl_utils.c    |   85 ---------------------------
 tools/libxl/libxl_utils.h    |    8 --
 tools/libxl/xl.c             |   68 +++++++++++++++------
 8 files changed, 66 insertions(+), 287 deletions(-)

diff -r 19479955c074 -r 74ca2cb026a5 tools/libxl/Makefile
--- a/tools/libxl/Makefile      Tue Jan 05 08:38:23 2010 +0000
+++ b/tools/libxl/Makefile      Tue Jan 05 08:39:40 2010 +0000
@@ -12,12 +12,7 @@ CFLAGS += -I. -fPIC
 CFLAGS += -I. -fPIC
 CFLAGS += $(CFLAGS_libxenctrl) $(CFLAGS_libxenguest) $(CFLAGS_libxenstore)
 
-
 LIBS = $(LDFLAGS_libxenctrl) $(LDFLAGS_libxenguest) $(LDFLAGS_libxenstore)
-
-ifeq ($(CONFIG_Linux),y)
-LIBS += -luuid
-endif
 
 LIBCONFIG_URL ?= http://www.hyperrealm.com/libconfig
 LIBCONFIG_SOURCE = libconfig-1.3.2
diff -r 19479955c074 -r 74ca2cb026a5 tools/libxl/libxl.c
--- a/tools/libxl/libxl.c       Tue Jan 05 08:38:23 2010 +0000
+++ b/tools/libxl/libxl.c       Tue Jan 05 08:39:40 2010 +0000
@@ -81,9 +81,9 @@ int libxl_domain_make(struct libxl_ctx *
     xs_transaction_t t;
     xen_domain_handle_t handle;
 
-    uuid_string = libxl_uuid_to_string(ctx, info->uuid);
+    uuid_string = string_of_uuid(ctx, info->uuid);
     if (!uuid_string) {
-        XL_LOG(ctx, XL_LOG_ERROR, "missing uuid");
+        XL_LOG(ctx, XL_LOG_ERROR, "cannot allocate uuid string");
         return ERROR_FAIL;
     }
 
@@ -91,23 +91,6 @@ int libxl_domain_make(struct libxl_ctx *
     flags |= info->hap ? XEN_DOMCTL_CDF_hap : 0;
     *domid = 0;
 
-    /*
-     * info->uuid != xen_domain_handle_t
-     * See: 
-     *      http://www.opengroup.org/dce/info/draft-leach-uuids-guids-01.txt
-     *      http://www.opengroup.org/onlinepubs/009629399/apdxa.htm
-     *
-     * A DCE 1.1 compatible source representation of UUIDs.
-     *
-     * struct uuid {
-     *     uint32_t        time_low;
-     *     uint16_t        time_mid;
-     *     uint16_t        time_hi_and_version;
-     *     uint8_t         clock_seq_hi_and_reserved;
-     *     uint8_t         clock_seq_low;
-     *     uint8_t         node[_UUID_NODE_LEN];
-     * };
-     */
     /* Ultimately, handle is an array of 16 uint8_t, same as uuid */
     memcpy(handle, info->uuid, sizeof(xen_domain_handle_t));
 
@@ -546,9 +529,8 @@ static int libxl_destroy_device_model(st
 
 int libxl_domain_destroy(struct libxl_ctx *ctx, uint32_t domid, int force)
 {
-    char *dom_path, *uuid_str;
+    char *dom_path;
     char *vm_path, *vss_path, *xapi_path;
-    xen_uuid_t *uuid;
     int rc, dm_present;
 
     if (is_hvm(ctx, domid)) {
@@ -564,10 +546,6 @@ int libxl_domain_destroy(struct libxl_ct
     if (!dom_path)
         return -1;
 
-    if (libxl_domid_to_uuid(ctx, &uuid, domid) < 0) {
-        XL_LOG(ctx, XL_LOG_ERROR, "failed ot get uuid for %d", domid);
-        return -1;
-    }
     if (libxl_device_pci_shutdown(ctx, domid) < 0)
         XL_LOG(ctx, XL_LOG_ERROR, "pci shutdown failed for domid %d", domid);
     if (dm_present) {
@@ -589,13 +567,11 @@ int libxl_domain_destroy(struct libxl_ct
     if (!xs_rm(ctx->xsh, XBT_NULL, dom_path))
         XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "xs_rm failed for %s", dom_path);
 
-    uuid_str = libxl_uuid_to_string(ctx, uuid);
-
-    vm_path = libxl_sprintf(ctx, "/vm/%s", uuid_str);
+    vm_path = libxl_xs_read(ctx, XBT_NULL, libxl_sprintf(ctx, 
"/local/domain/%d/vm", domid));
     if (!xs_rm(ctx->xsh, XBT_NULL, vm_path))
         XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "xs_rm failed for %s", vm_path);
 
-    vss_path = libxl_sprintf(ctx, "/vss/%s", uuid_str);
+    vss_path = libxl_xs_read(ctx, XBT_NULL, libxl_sprintf(ctx, 
"/local/domain/%d/vss", domid));
     if (!xs_rm(ctx->xsh, XBT_NULL, vss_path))
         XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "xs_rm failed for %s", vss_path);
 
@@ -856,7 +832,6 @@ static int libxl_create_stubdom(struct l
     libxl_domain_build_state state;
     uint32_t domid;
     char **args;
-    xen_uuid_t uuid[16];
     struct xs_permissions perm[2];
     xs_transaction_t t;
     libxl_device_model_starting *dm_starting = 0;
@@ -868,8 +843,8 @@ static int libxl_create_stubdom(struct l
     memset(&c_info, 0x00, sizeof(libxl_domain_create_info));
     c_info.hvm = 0;
     c_info.name = libxl_sprintf(ctx, "%s-dm", libxl_domid_to_name(ctx, 
info->domid));
-    xen_uuid_generate(uuid);
-    c_info.uuid = uuid;
+    for (i = 0; i < 16; i++)
+        c_info.uuid[i] = info->uuid[i];
 
     memset(&b_info, 0x00, sizeof(libxl_domain_build_info));
     b_info.max_vcpus = 1;
diff -r 19479955c074 -r 74ca2cb026a5 tools/libxl/libxl.h
--- a/tools/libxl/libxl.h       Tue Jan 05 08:38:23 2010 +0000
+++ b/tools/libxl/libxl.h       Tue Jan 05 08:39:40 2010 +0000
@@ -21,12 +21,10 @@
 #include <xenctrl.h>
 #include <xs.h>
 
-#include "xen_uuid.h"
-
 typedef void (*libxl_log_callback)(void *userdata, int loglevel, const char 
*file,
                                    int line, const char *func, char *s);
 struct libxl_dominfo {
-    xen_uuid_t uuid;
+    uint8_t uuid[16];
     uint32_t domid;
     uint8_t dying:1;
     uint8_t paused:1;
@@ -55,7 +53,7 @@ typedef struct {
     bool hap;
     int ssidref;
     char *name;
-    xen_uuid_t *uuid;
+    uint8_t uuid[16];
     char **xsdata;
     char **platformdata;
 } libxl_domain_create_info;
@@ -111,6 +109,7 @@ typedef enum {
 
 typedef struct {
     int domid;
+    uint8_t uuid[16]; /* this is use only with stubdom, and must be different 
from the domain uuid */
     char *dom_name;
     char *device_model;
     char *saved_state;
diff -r 19479955c074 -r 74ca2cb026a5 tools/libxl/libxl_internal.h
--- a/tools/libxl/libxl_internal.h      Tue Jan 05 08:38:23 2010 +0000
+++ b/tools/libxl/libxl_internal.h      Tue Jan 05 08:39:40 2010 +0000
@@ -86,6 +86,12 @@ typedef struct {
 #define PCI_BAR_IO             0x01
 
 #define PRINTF_ATTRIBUTE(x, y) __attribute__((format(printf, x, y)))
+
+#define UUID_FMT 
"%02hhx%02hhx%02hhx%02hhx-%02hhx%02hhx-%02hhx%02hhx-%02hhx%02hhx-%02hhx%02hhx%02hhx%02hhx%02hhx%02hhx"
+#define string_of_uuid(ctx, u) \
+    libxl_sprintf(ctx, UUID_FMT, \
+                (u)[0], (u)[1], (u)[2], (u)[3], (u)[4], (u)[5], (u)[6], 
(u)[7], \
+                (u)[8], (u)[9], (u)[10], (u)[11], (u)[12], (u)[13], (u)[14], 
(u)[15])
 
 /* memory allocation tracking/helpers */
 int libxl_clone_context(struct libxl_ctx *from, struct libxl_ctx *to);
diff -r 19479955c074 -r 74ca2cb026a5 tools/libxl/libxl_utils.c
--- a/tools/libxl/libxl_utils.c Tue Jan 05 08:38:23 2010 +0000
+++ b/tools/libxl/libxl_utils.c Tue Jan 05 08:39:40 2010 +0000
@@ -85,91 +85,6 @@ int libxl_name_to_domid(struct libxl_ctx
     free(dominfo);
     free(l);
     return -1;
-}
-
-int libxl_uuid_to_domid(struct libxl_ctx *ctx, xen_uuid_t *uuid, uint32_t 
*domid)
-{
-    int nb_domain, i;
-    struct libxl_dominfo *info = libxl_domain_list(ctx, &nb_domain);
-    for (i = 0; i < nb_domain; i++) {
-        if (!xen_uuid_compare(&(info[i].uuid), uuid)) {
-            *domid = info[i].domid;
-            free(info);
-            return 0;
-        }
-    }
-    free(info);
-    return -1;
-}
-
-int libxl_domid_to_uuid(struct libxl_ctx *ctx, xen_uuid_t **uuid, uint32_t 
domid)
-{
-    int nb_domain, i;
-    struct libxl_dominfo *info = libxl_domain_list(ctx, &nb_domain);
-    for (i = 0; i < nb_domain; i++) {
-        if (domid == info[i].domid) {
-            *uuid = libxl_zalloc(ctx, sizeof(xen_uuid_t));
-            xen_uuid_copy(*uuid, &(info[i].uuid));
-            free(info);
-            return 0;
-        }
-    }
-    free(info);
-    return -1;
-}
-
-int libxl_is_uuid(char *s)
-{
-    int i;
-    if (!s || strlen(s) != UUID_LEN_STR)
-        return 0;
-    for (i = 0; i < UUID_LEN_STR; i++) {
-        if (i == 8 || i == 13 || i == 18 || i == 23) {
-            if (s[i] != '-')
-                return 0;
-        } else {
-            if (!isxdigit((uint8_t)s[i]))
-                return 0;
-        }
-    }
-    return 1;
-}
-
-xen_uuid_t *libxl_string_to_uuid(struct libxl_ctx *ctx, char *s)
-{
-    xen_uuid_t *uuid;
-    if (!s || !ctx)
-        return NULL;
-    uuid = libxl_zalloc(ctx, sizeof(*uuid));
-    xen_uuid_from_string(uuid, s);
-    return uuid;
-}
-
-char *libxl_uuid_to_string(struct libxl_ctx *ctx, xen_uuid_t *uuid)
-{
-    char uuid_str[UUID_LEN_STR + 3];
-    if (!uuid)
-        return NULL;
-    xen_uuid_to_string(uuid, uuid_str, sizeof(uuid_str));
-    return libxl_sprintf(ctx, "%s", uuid_str);
-}
-
-int libxl_param_to_domid(struct libxl_ctx *ctx, char *p, uint32_t *domid)
-{
-    xen_uuid_t *uuid;
-    uint32_t d;
-
-    if (libxl_is_uuid(p)) {
-        uuid = libxl_string_to_uuid(ctx, p);
-        return libxl_uuid_to_domid(ctx, uuid, domid);
-    }
-    errno = 0;
-    d = strtoul(p, (char **) NULL, 10);
-    if (!errno && d != 0 && d != ULONG_MAX && d != LONG_MIN) {
-        *domid = d;
-        return 0;
-    }
-    return libxl_name_to_domid(ctx, p, domid);
 }
 
 int libxl_get_stubdom_id(struct libxl_ctx *ctx, int guest_domid)
diff -r 19479955c074 -r 74ca2cb026a5 tools/libxl/libxl_utils.h
--- a/tools/libxl/libxl_utils.h Tue Jan 05 08:38:23 2010 +0000
+++ b/tools/libxl/libxl_utils.h Tue Jan 05 08:39:40 2010 +0000
@@ -18,17 +18,9 @@
 
 #include "libxl.h"
 
-#define UUID_FMT 
"%02hhx%02hhx%02hhx%02hhx-%02hhx%02hhx-%02hhx%02hhx-%02hhx%02hhx-%02hhx%02hhx%02hhx%02hhx%02hhx%02hhx"
-
 unsigned long libxl_get_required_shadow_memory(unsigned long maxmem_kb, 
unsigned int smp_cpus);
 int libxl_name_to_domid(struct libxl_ctx *ctx, char *name, uint32_t *domid);
 char *libxl_domid_to_name(struct libxl_ctx *ctx, uint32_t domid);
-int libxl_uuid_to_domid(struct libxl_ctx *ctx, xen_uuid_t *uuid, uint32_t 
*domid);
-int libxl_domid_to_uuid(struct libxl_ctx *ctx, xen_uuid_t **uuid, uint32_t 
domid);
-int libxl_is_uuid(char *s);
-xen_uuid_t *libxl_string_to_uuid(struct libxl_ctx *ctx, char *s);
-char *libxl_uuid_to_string(struct libxl_ctx *ctx, xen_uuid_t *uuid);
-int libxl_param_to_domid(struct libxl_ctx *ctx, char *p, uint32_t *domid);
 int libxl_get_stubdom_id(struct libxl_ctx *ctx, int guest_domid);
 int libxl_is_stubdom(struct libxl_ctx *ctx, int domid);
 int libxl_create_logfile(struct libxl_ctx *ctx, char *name, char **full_name);
diff -r 19479955c074 -r 74ca2cb026a5 tools/libxl/xen_uuid.h
--- a/tools/libxl/xen_uuid.h    Tue Jan 05 08:38:23 2010 +0000
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,135 +0,0 @@
-/* Copyright (c) 2008, XenSource Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *     * Redistributions of source code must retain the above copyright
- *       notice, this list of conditions and the following disclaimer.
- *     * Redistributions in binary form must reproduce the above copyright
- *       notice, this list of conditions and the following disclaimer in the
- *       documentation and/or other materials provided with the distribution.
- *     * Neither the name of XenSource Inc. nor the names of its contributors
- *       may be used to endorse or promote products derived from this software
- *       without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
- * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-#ifndef __XEN_UUID_H__
-#define __XEN_UUID_H__
-
-#if defined(__linux__)
-
-#include <uuid/uuid.h>
-
-typedef struct {
-    uuid_t uuid;
-} xen_uuid_t;
-
-static inline int xen_uuid_is_nil(xen_uuid_t *uuid)
-{
-       return uuid_is_null(uuid->uuid);
-}
-
-static inline void xen_uuid_generate(xen_uuid_t *uuid)
-{
-       uuid_generate(uuid->uuid);
-}
-
-static inline void xen_uuid_to_string(xen_uuid_t *uuid, char *out, size_t size)
-{
-       uuid_unparse(uuid->uuid, out);
-}
-
-static inline void xen_uuid_from_string(xen_uuid_t *uuid, const char *in)
-{
-       uuid_parse(in, uuid->uuid);
-}
-
-static inline void xen_uuid_copy(xen_uuid_t *dst, xen_uuid_t *src)
-{
-       uuid_copy(dst->uuid, src->uuid);
-}
-
-static inline void xen_uuid_clear(xen_uuid_t *uuid)
-{
-       uuid_clear(uuid->uuid);
-}
-
-static inline int xen_uuid_compare(xen_uuid_t *uuid1, xen_uuid_t *uuid2)
-{
-       return uuid_compare(uuid1->uuid, uuid2->uuid);
-}
-
-#elif defined(__NetBSD__)
-
-#include <uuid.h>
-#include <string.h>
-#include <stdlib.h>
-
-typedef uuid_t xen_uuid_t;
-
-static inline int xen_uuid_is_nil(xen_uuid_t *uuid)
-{
-       uint32_t status;
-       return uuid_is_nil((uuid_t *)uuid, &status);
-}
-
-static inline void xen_uuid_generate(xen_uuid_t *uuid)
-{
-       uint32_t status;
-       uuid_create((uuid_t *)uuid, &status);
-}
-
-static inline void xen_uuid_to_string(xen_uuid_t *uuid, char *out, size_t size)
-{
-       uint32_t status;
-       char *_out = NULL;
-       uuid_to_string((uuid_t *)uuid, &_out, &status);
-       strlcpy(out, _out, size);
-       free(_out);
-}
-
-static inline void xen_uuid_from_string(xen_uuid_t *uuid, const char *in)
-{
-       uint32_t status;
-       uuid_from_string(in, (uuid_t *)uuid, &status);
-}
-
-static inline void xen_uuid_copy(xen_uuid_t *dst, xen_uuid_t *src)
-{
-       memcpy((uuid_t *)dst, (uuid_t *)src, sizeof(uuid_t));
-}
-
-static inline void xen_uuid_clear(xen_uuid_t *uuid)
-{
-       memset((uuid_t *)uuid, 0, sizeof(uuid_t));
-}
-
-static inline int xen_uuid_compare(xen_uuid_t *uuid1, xen_uuid_t *uuid2)
-{
-       uint32_t status;
-       return uuid_compare((uuid_t *)uuid1, (uuid_t *)uuid2, &status);
-}
-
-#else
-
-#error "Please update xen_uuid.h for your OS"
-
-#endif
-
-#ifndef UUID_LEN_STR
-#define UUID_LEN_STR  (128 /*bit*/ / 4 /*nibbles*/ + 4 /*hyphens*/)
-#endif /* UUID_LEN_STR */
-
-#endif /* __XEN_UUID_H__ */
diff -r 19479955c074 -r 74ca2cb026a5 tools/libxl/xl.c
--- a/tools/libxl/xl.c  Tue Jan 05 08:38:23 2010 +0000
+++ b/tools/libxl/xl.c  Tue Jan 05 08:39:40 2010 +0000
@@ -20,7 +20,6 @@
 #include <stdlib.h>
 #include <string.h>
 #include <libconfig.h>
-#include "xen_uuid.h"
 #include <unistd.h>
 #include <sys/time.h> /* for time */
 #include <getopt.h>
@@ -31,11 +30,13 @@
 #include <sys/select.h>
 #include <arpa/inet.h>
 #include <xenctrl.h>
-
+#include <ctype.h>
 
 #include "libxl.h"
 #include "libxl_utils.h"
 
+#define UUID_FMT 
"%02hhx%02hhx%02hhx%02hhx-%02hhx%02hhx-%02hhx%02hhx-%02hhx%02hhx-%02hhx%02hhx%02hhx%02hhx%02hhx%02hhx"
+
 int logfile = 2;
 
 void log_callback(void *userdata, int loglevel, const char *file, int line, 
const char *func, char *s)
@@ -44,6 +45,29 @@ void log_callback(void *userdata, int lo
 
     snprintf(str, sizeof(str), "[%d] %s:%d:%s: %s\n", loglevel, file, line, 
func, s);
     write(logfile, str, strlen(str));
+}
+
+static int domain_qualifier_to_domid(struct libxl_ctx *ctx, char *p, uint32_t 
*domid)
+{
+    int i, alldigit;
+
+    alldigit = 1;
+    for (i = 0; p[i]; i++) {
+        if (!isdigit(p[i])) {
+            alldigit = 0;
+            break;
+        }
+    }
+
+    if (i == 0)
+        return -1;
+    if (alldigit) {
+        *domid = strtoul(p, NULL, 10);
+        return 0;
+    } else {
+        /* check here if it's a uuid and do proper conversion */
+    }
+    return libxl_name_to_domid(ctx, p, domid);
 }
 
 #define LOG(_f, _a...)   dolog(__FILE__, __LINE__, __func__, _f, ##_a)
@@ -97,7 +121,12 @@ static void init_dm_info(libxl_device_mo
 static void init_dm_info(libxl_device_model_info *dm_info,
         libxl_domain_create_info *c_info, libxl_domain_build_info *b_info)
 {
+    int i;
     memset(dm_info, '\0', sizeof(*dm_info));
+
+    for (i = 0; i < 16; i++) {
+        dm_info->uuid[i] = rand();
+    }
 
     dm_info->dom_name = c_info->name;
     dm_info->device_model = "/usr/lib/xen/bin/qemu-dm";
@@ -183,14 +212,16 @@ static void printf_info(libxl_domain_cre
                         libxl_device_model_info *dm_info)
 {
     int i;
-    char uuid_str[37];
     printf("*** domain_create_info ***\n");
     printf("hvm: %d\n", c_info->hvm);
     printf("hap: %d\n", c_info->hap);
     printf("ssidref: %d\n", c_info->ssidref);
     printf("name: %s\n", c_info->name);
-    xen_uuid_to_string(c_info->uuid, uuid_str, sizeof(uuid_str));
-    printf("uuid: %s\n", uuid_str);
+    printf("uuid: " UUID_FMT "\n",
+           (c_info->uuid)[0], (c_info->uuid)[1], (c_info->uuid)[2], 
(c_info->uuid)[3],
+           (c_info->uuid)[4], (c_info->uuid)[5], (c_info->uuid)[6], 
(c_info->uuid)[7],
+           (c_info->uuid)[8], (c_info->uuid)[9], (c_info->uuid)[10], 
(c_info->uuid)[11],
+           (c_info->uuid)[12], (c_info->uuid)[13], (c_info->uuid)[14], 
(c_info->uuid)[15]);
     if (c_info->xsdata)
         printf("xsdata: contains data\n");
     else
@@ -363,12 +394,12 @@ static void parse_config_file(const char
                               libxl_device_model_info *dm_info)
 {
     const char *buf;
-    xen_uuid_t uuid[16];
     long l;
     struct config_t config;
     struct config_setting_t *vbds, *nics, *pcis, *cvfbs;
     int pci_power_mgmt = 0;
     int pci_msitranslate = 1;
+    int i;
 
     config_init (&config);
 
@@ -396,8 +427,9 @@ static void parse_config_file(const char
         c_info->name = strdup(buf);
     else
         c_info->name = "test";
-    xen_uuid_generate(uuid);
-    c_info->uuid = uuid;
+    for (i = 0; i < 16; i++) {
+        c_info->uuid[i] = rand();
+    }
 
     init_build_info(b_info, c_info);
 
@@ -945,7 +977,7 @@ void set_memory_target(char *p, char *me
     libxl_ctx_init(&ctx, LIBXL_VERSION);
     libxl_ctx_set_log(&ctx, log_callback, NULL);
 
-    if (libxl_param_to_domid(&ctx, p, &domid) < 0) {
+    if (domain_qualifier_to_domid(&ctx, p, &domid) < 0) {
         fprintf(stderr, "%s is an invalid domain identifier\n", p);
         exit(2);
     }
@@ -987,7 +1019,7 @@ void console(char *p, int cons_num)
     libxl_ctx_init(&ctx, LIBXL_VERSION);
     libxl_ctx_set_log(&ctx, log_callback, NULL);
 
-    if (libxl_param_to_domid(&ctx, p, &domid) < 0) {
+    if (domain_qualifier_to_domid(&ctx, p, &domid) < 0) {
         fprintf(stderr, "%s is an invalid domain identifier\n", p);
         exit(2);
     }
@@ -1004,7 +1036,7 @@ void cd_insert(char *dom, char *virtdev,
     libxl_ctx_init(&ctx, LIBXL_VERSION);
     libxl_ctx_set_log(&ctx, log_callback, NULL);
 
-    if (libxl_param_to_domid(&ctx, dom, &domid) < 0) {
+    if (domain_qualifier_to_domid(&ctx, dom, &domid) < 0) {
         fprintf(stderr, "%s is an invalid domain identifier\n", dom);
         exit(2);
     }
@@ -1137,7 +1169,7 @@ void pcilist(char *dom)
     libxl_ctx_init(&ctx, LIBXL_VERSION);
     libxl_ctx_set_log(&ctx, log_callback, NULL);
 
-    if (libxl_param_to_domid(&ctx, dom, &domid) < 0) {
+    if (domain_qualifier_to_domid(&ctx, dom, &domid) < 0) {
         fprintf(stderr, "%s is an invalid domain identifier\n", dom);
         exit(2);
     }
@@ -1187,7 +1219,7 @@ void pcidetach(char *dom, char *bdf)
     libxl_ctx_init(&ctx, LIBXL_VERSION);
     libxl_ctx_set_log(&ctx, log_callback, NULL);
 
-    if (libxl_param_to_domid(&ctx, dom, &domid) < 0) {
+    if (domain_qualifier_to_domid(&ctx, dom, &domid) < 0) {
         fprintf(stderr, "%s is an invalid domain identifier\n", dom);
         exit(2);
     }
@@ -1233,7 +1265,7 @@ void pciattach(char *dom, char *bdf, cha
     libxl_ctx_init(&ctx, LIBXL_VERSION);
     libxl_ctx_set_log(&ctx, log_callback, NULL);
 
-    if (libxl_param_to_domid(&ctx, dom, &domid) < 0) {
+    if (domain_qualifier_to_domid(&ctx, dom, &domid) < 0) {
         fprintf(stderr, "%s is an invalid domain identifier\n", dom);
         exit(2);
     }
@@ -1281,7 +1313,7 @@ void pause_domain(char *p)
     libxl_ctx_init(&ctx, LIBXL_VERSION);
     libxl_ctx_set_log(&ctx, log_callback, NULL);
 
-    if (libxl_param_to_domid(&ctx, p, &domid) < 0) {
+    if (domain_qualifier_to_domid(&ctx, p, &domid) < 0) {
         fprintf(stderr, "%s is an invalid domain identifier\n", p);
         exit(2);
     }
@@ -1296,7 +1328,7 @@ void unpause_domain(char *p)
     libxl_ctx_init(&ctx, LIBXL_VERSION);
     libxl_ctx_set_log(&ctx, log_callback, NULL);
 
-    if (libxl_param_to_domid(&ctx, p, &domid) < 0) {
+    if (domain_qualifier_to_domid(&ctx, p, &domid) < 0) {
         fprintf(stderr, "%s is an invalid domain identifier\n", p);
         exit(2);
     }
@@ -1311,7 +1343,7 @@ void destroy_domain(char *p)
     libxl_ctx_init(&ctx, LIBXL_VERSION);
     libxl_ctx_set_log(&ctx, log_callback, NULL);
 
-    if (libxl_param_to_domid(&ctx, p, &domid) < 0) {
+    if (domain_qualifier_to_domid(&ctx, p, &domid) < 0) {
         fprintf(stderr, "%s is an invalid domain identifier\n", p);
         exit(2);
     }
@@ -1354,7 +1386,7 @@ int save_domain(char *p, char *filename,
     libxl_ctx_init(&ctx, LIBXL_VERSION);
     libxl_ctx_set_log(&ctx, log_callback, NULL);
 
-    if (libxl_param_to_domid(&ctx, p, &domid) < 0) {
+    if (domain_qualifier_to_domid(&ctx, p, &domid) < 0) {
         fprintf(stderr, "%s is an invalid domain identifier\n", p);
         exit(2);
     }

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.