All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] HVM SMBIOS v2 3/5
@ 2006-07-12 21:27 Andrew D. Ball
  0 siblings, 0 replies; 2+ messages in thread
From: Andrew D. Ball @ 2006-07-12 21:27 UTC (permalink / raw)
  To: xen-devel

[-- Attachment #1: Type: text/plain, Size: 83 bytes --]

This patch adds the UUID as a parameter for the call to xc_hvm_create in 
  xend.


[-- Attachment #2: smbios_3-xend.patch --]
[-- Type: text/plain, Size: 3610 bytes --]

Add UUID as a parameter for HVM domain creation.

Signed-off-by: Andrew D. Ball <aball@us.ibm.com>

diff -r a1c2cede77c7 tools/python/xen/lowlevel/xc/xc.c
--- a/tools/python/xen/lowlevel/xc/xc.c	Mon Jul 10 14:01:49 2006
+++ b/tools/python/xen/lowlevel/xc/xc.c	Wed Jul 12 11:48:37 2006
@@ -371,18 +371,35 @@
     int pae  = 0;
     int acpi = 0;
     int apic = 0;
+    PyObject *uuid_obj = NULL;
+    uint8_t uuid[16];
     unsigned long store_mfn = 0;
+    int i;
+    PyObject *tmp = NULL;
 
     static char *kwd_list[] = { "dom", "store_evtchn",
 				"memsize", "image", "vcpus", "pae", "acpi", "apic",
+                                "uuid",
 				NULL };
-    if ( !PyArg_ParseTupleAndKeywords(args, kwds, "iiisiiii", kwd_list,
+    if ( !PyArg_ParseTupleAndKeywords(args, kwds, "iiisiiiiO", kwd_list,
                                       &dom, &store_evtchn, &memsize,
-                                      &image, &vcpus, &pae, &acpi, &apic) )
-        return NULL;
+                                      &image, &vcpus, &pae, &acpi, &apic,
+                                      &uuid_obj) )
+        return NULL;
+
+    /* convert the UUID array from Python to C if possible */
+    if (!PySequence_Check(uuid_obj) || PySequence_Length(uuid_obj) != 16)
+        return NULL;
+    for (i = 0; i < 16; i++) {
+        tmp = PySequence_GetItem(uuid_obj, i);
+        if (!PyInt_Check(tmp))
+            return NULL;
+        uuid[i] = (uint8_t) PyInt_AsLong(tmp);
+    }
 
     if ( xc_hvm_build(self->xc_handle, dom, memsize, image,
-		      vcpus, pae, acpi, apic, store_evtchn, &store_mfn) != 0 )
+		      vcpus, pae, acpi, apic, store_evtchn, &store_mfn,
+                      uuid) != 0 )
         return PyErr_SetFromErrno(xc_error);
 
     return Py_BuildValue("{s:i}", "store_mfn", store_mfn);
@@ -1050,6 +1067,7 @@
       " dom     [int]:      Identifier of domain to build into.\n"
       " image   [str]:      Name of HVM loader image file.\n"
       " vcpus   [int, 1]:   Number of Virtual CPUS in domain.\n\n"
+      " uuid    [list of 16 ints]: UUID of the domain.\n\n"
       "Returns: [int] 0 on success; -1 on error.\n" },
 
     { "bvtsched_global_set",
diff -r a1c2cede77c7 tools/python/xen/xend/image.py
--- a/tools/python/xen/xend/image.py	Mon Jul 10 14:01:49 2006
+++ b/tools/python/xen/xend/image.py	Wed Jul 12 11:48:37 2006
@@ -224,6 +224,16 @@
 
     def buildDomain(self):
         store_evtchn = self.vm.getStorePort()
+ 
+        # convert the DCE formatted UUID string to an array
+        # of 16 integers
+        uuid_str = self.vm.info['uuid']
+        uuid_str = uuid_str.replace('-','')
+
+        uuid_arr = []
+
+        for i in range(0,32,2):
+            uuid_arr.append(int(uuid_str[i:i+2], 16))
 
         log.debug("dom            = %d", self.vm.getDomid())
         log.debug("image          = %s", self.kernel)
@@ -233,6 +243,7 @@
         log.debug("pae            = %d", self.pae)
         log.debug("acpi           = %d", self.acpi)
         log.debug("apic           = %d", self.apic)
+        log.debug("uuid           = %s", uuid_arr)
 
         self.register_shutdown_watch()
 
@@ -243,7 +254,8 @@
                             vcpus          = self.vm.getVCpuCount(),
                             pae            = self.pae,
                             acpi           = self.acpi,
-                            apic           = self.apic)
+                            apic           = self.apic,
+                            uuid           = uuid_arr)
 
     # Return a list of cmd line args to the device models based on the
     # xm config file

[-- Attachment #3: Type: text/plain, Size: 138 bytes --]

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

^ permalink raw reply	[flat|nested] 2+ messages in thread
* [PATCH] HVM SMBIOS v2 3/5
@ 2006-07-12 20:31 aball
  0 siblings, 0 replies; 2+ messages in thread
From: aball @ 2006-07-12 20:31 UTC (permalink / raw)
  To: xen-devel

[-- Attachment #1: Type: text/plain, Size: 3730 bytes --]

[HVM] Add UUID as a parameter for HVM domain creation.

Signed-off-by: Andrew D. Ball <aball@us.ibm.com>

diff -r a1c2cede77c7 tools/python/xen/lowlevel/xc/xc.c
--- a/tools/python/xen/lowlevel/xc/xc.c	Mon Jul 10 14:01:49 2006
+++ b/tools/python/xen/lowlevel/xc/xc.c	Wed Jul 12 11:48:37 2006
@@ -371,18 +371,35 @@
      int pae  = 0;
      int acpi = 0;
      int apic = 0;
+    PyObject *uuid_obj = NULL;
+    uint8_t uuid[16];
      unsigned long store_mfn = 0;
+    int i;
+    PyObject *tmp = NULL;

      static char *kwd_list[] = { "dom", "store_evtchn",
  				"memsize", "image", "vcpus", "pae", "acpi", "apic",
+                                "uuid",
  				NULL };
-    if ( !PyArg_ParseTupleAndKeywords(args, kwds, "iiisiiii", kwd_list,
+    if ( !PyArg_ParseTupleAndKeywords(args, kwds, "iiisiiiiO", kwd_list,
                                        &dom, &store_evtchn, &memsize,
-                                      &image, &vcpus, &pae, &acpi, &apic) )
-        return NULL;
+                                      &image, &vcpus, &pae, &acpi, &apic,
+                                      &uuid_obj) )
+        return NULL;
+
+    /* convert the UUID array from Python to C if possible */
+    if (!PySequence_Check(uuid_obj) || PySequence_Length(uuid_obj) != 16)
+        return NULL;
+    for (i = 0; i < 16; i++) {
+        tmp = PySequence_GetItem(uuid_obj, i);
+        if (!PyInt_Check(tmp))
+            return NULL;
+        uuid[i] = (uint8_t) PyInt_AsLong(tmp);
+    }

      if ( xc_hvm_build(self->xc_handle, dom, memsize, image,
-		      vcpus, pae, acpi, apic, store_evtchn, &store_mfn) != 0 )
+		      vcpus, pae, acpi, apic, store_evtchn, &store_mfn,
+                      uuid) != 0 )
          return PyErr_SetFromErrno(xc_error);

      return Py_BuildValue("{s:i}", "store_mfn", store_mfn);
@@ -1050,6 +1067,7 @@
        " dom     [int]:      Identifier of domain to build into.\n"
        " image   [str]:      Name of HVM loader image file.\n"
        " vcpus   [int, 1]:   Number of Virtual CPUS in domain.\n\n"
+      " uuid    [list of 16 ints]: UUID of the domain.\n\n"
        "Returns: [int] 0 on success; -1 on error.\n" },

      { "bvtsched_global_set",
diff -r a1c2cede77c7 tools/python/xen/xend/image.py
--- a/tools/python/xen/xend/image.py	Mon Jul 10 14:01:49 2006
+++ b/tools/python/xen/xend/image.py	Wed Jul 12 11:48:37 2006
@@ -224,6 +224,16 @@

      def buildDomain(self):
          store_evtchn = self.vm.getStorePort()
+
+        # convert the DCE formatted UUID string to an array
+        # of 16 integers
+        uuid_str = self.vm.info['uuid']
+        uuid_str = uuid_str.replace('-','')
+
+        uuid_arr = []
+
+        for i in range(0,32,2):
+            uuid_arr.append(int(uuid_str[i:i+2], 16))

          log.debug("dom            = %d", self.vm.getDomid())
          log.debug("image          = %s", self.kernel)
@@ -233,6 +243,7 @@
          log.debug("pae            = %d", self.pae)
          log.debug("acpi           = %d", self.acpi)
          log.debug("apic           = %d", self.apic)
+        log.debug("uuid           = %s", uuid_arr)

          self.register_shutdown_watch()

@@ -243,7 +254,8 @@
                              vcpus          = self.vm.getVCpuCount(),
                              pae            = self.pae,
                              acpi           = self.acpi,
-                            apic           = self.apic)
+                            apic           = self.apic,
+                            uuid           = uuid_arr)

      # Return a list of cmd line args to the device models based on the
      # xm config file


[-- Attachment #2: smbios_3-xend.patch --]
[-- Type: text/x-patch, Size: 3709 bytes --]

[HVM] Add UUID as a parameter for HVM domain creation.

Signed-off-by: Andrew D. Ball <aball@us.ibm.com>

diff -r a1c2cede77c7 tools/python/xen/lowlevel/xc/xc.c
--- a/tools/python/xen/lowlevel/xc/xc.c	Mon Jul 10 14:01:49 2006
+++ b/tools/python/xen/lowlevel/xc/xc.c	Wed Jul 12 11:48:37 2006
@@ -371,18 +371,35 @@
     int pae  = 0;
     int acpi = 0;
     int apic = 0;
+    PyObject *uuid_obj = NULL;
+    uint8_t uuid[16];
     unsigned long store_mfn = 0;
+    int i;
+    PyObject *tmp = NULL;
 
     static char *kwd_list[] = { "dom", "store_evtchn",
 				"memsize", "image", "vcpus", "pae", "acpi", "apic",
+                                "uuid",
 				NULL };
-    if ( !PyArg_ParseTupleAndKeywords(args, kwds, "iiisiiii", kwd_list,
+    if ( !PyArg_ParseTupleAndKeywords(args, kwds, "iiisiiiiO", kwd_list,
                                       &dom, &store_evtchn, &memsize,
-                                      &image, &vcpus, &pae, &acpi, &apic) )
-        return NULL;
+                                      &image, &vcpus, &pae, &acpi, &apic,
+                                      &uuid_obj) )
+        return NULL;
+
+    /* convert the UUID array from Python to C if possible */
+    if (!PySequence_Check(uuid_obj) || PySequence_Length(uuid_obj) != 16)
+        return NULL;
+    for (i = 0; i < 16; i++) {
+        tmp = PySequence_GetItem(uuid_obj, i);
+        if (!PyInt_Check(tmp))
+            return NULL;
+        uuid[i] = (uint8_t) PyInt_AsLong(tmp);
+    }
 
     if ( xc_hvm_build(self->xc_handle, dom, memsize, image,
-		      vcpus, pae, acpi, apic, store_evtchn, &store_mfn) != 0 )
+		      vcpus, pae, acpi, apic, store_evtchn, &store_mfn,
+                      uuid) != 0 )
         return PyErr_SetFromErrno(xc_error);
 
     return Py_BuildValue("{s:i}", "store_mfn", store_mfn);
@@ -1050,6 +1067,7 @@
       " dom     [int]:      Identifier of domain to build into.\n"
       " image   [str]:      Name of HVM loader image file.\n"
       " vcpus   [int, 1]:   Number of Virtual CPUS in domain.\n\n"
+      " uuid    [list of 16 ints]: UUID of the domain.\n\n"
       "Returns: [int] 0 on success; -1 on error.\n" },
 
     { "bvtsched_global_set",
diff -r a1c2cede77c7 tools/python/xen/xend/image.py
--- a/tools/python/xen/xend/image.py	Mon Jul 10 14:01:49 2006
+++ b/tools/python/xen/xend/image.py	Wed Jul 12 11:48:37 2006
@@ -224,6 +224,16 @@
 
     def buildDomain(self):
         store_evtchn = self.vm.getStorePort()
+ 
+        # convert the DCE formatted UUID string to an array
+        # of 16 integers
+        uuid_str = self.vm.info['uuid']
+        uuid_str = uuid_str.replace('-','')
+
+        uuid_arr = []
+
+        for i in range(0,32,2):
+            uuid_arr.append(int(uuid_str[i:i+2], 16))
 
         log.debug("dom            = %d", self.vm.getDomid())
         log.debug("image          = %s", self.kernel)
@@ -233,6 +243,7 @@
         log.debug("pae            = %d", self.pae)
         log.debug("acpi           = %d", self.acpi)
         log.debug("apic           = %d", self.apic)
+        log.debug("uuid           = %s", uuid_arr)
 
         self.register_shutdown_watch()
 
@@ -243,7 +254,8 @@
                             vcpus          = self.vm.getVCpuCount(),
                             pae            = self.pae,
                             acpi           = self.acpi,
-                            apic           = self.apic)
+                            apic           = self.apic,
+                            uuid           = uuid_arr)
 
     # Return a list of cmd line args to the device models based on the
     # xm config file

[-- Attachment #3: Type: text/plain, Size: 138 bytes --]

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2006-07-12 21:27 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-07-12 21:27 [PATCH] HVM SMBIOS v2 3/5 Andrew D. Ball
  -- strict thread matches above, loose matches on Subject: below --
2006-07-12 20:31 aball

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.