From: aball@linux.ibm.com Subject: [PATCH] HVM SMBIOS v2 3/5 Date: Wed, 12 Jul 2006 16:31:22 -0400 Message-ID: <20060712163122.c51gh1ng0sc40c44@imap.linux.ibm.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=_5kz2doo59cg8" Content-Transfer-Encoding: 7bit Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org This message is in MIME format. --=_5kz2doo59cg8 Content-Type: text/plain; charset=ISO-8859-1; DelSp="Yes"; format="flowed" Content-Disposition: inline Content-Transfer-Encoding: quoted-printable [HVM] Add UUID as a parameter for HVM domain creation. Signed-off-by: Andrew D. Ball diff -r a1c2cede77c7 tools/python/xen/lowlevel/xc/xc.c --- a/tools/python/xen/lowlevel/xc/xc.c=09Mon Jul 10 14:01:49 2006 +++ b/tools/python/xen/lowlevel/xc/xc.c=09Wed Jul 12 11:48:37 2006 @@ -371,18 +371,35 @@ int pae =3D 0; int acpi =3D 0; int apic =3D 0; + PyObject *uuid_obj =3D NULL; + uint8_t uuid[16]; unsigned long store_mfn =3D 0; + int i; + PyObject *tmp =3D NULL; static char *kwd_list[] =3D { "dom", "store_evtchn", =09=09=09=09"memsize", "image", "vcpus", "pae", "acpi", "apic", + "uuid", =09=09=09=09NULL }; - 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) !=3D 16) + return NULL; + for (i =3D 0; i < 16; i++) { + tmp =3D PySequence_GetItem(uuid_obj, i); + if (!PyInt_Check(tmp)) + return NULL; + uuid[i] =3D (uint8_t) PyInt_AsLong(tmp); + } if ( xc_hvm_build(self->xc_handle, dom, memsize, image, -=09=09 vcpus, pae, acpi, apic, store_evtchn, &store_mfn) !=3D 0 ) +=09=09 vcpus, pae, acpi, apic, store_evtchn, &store_mfn, + uuid) !=3D 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=09Mon Jul 10 14:01:49 2006 +++ b/tools/python/xen/xend/image.py=09Wed Jul 12 11:48:37 2006 @@ -224,6 +224,16 @@ def buildDomain(self): store_evtchn =3D self.vm.getStorePort() + + # convert the DCE formatted UUID string to an array + # of 16 integers + uuid_str =3D self.vm.info['uuid'] + uuid_str =3D uuid_str.replace('-','') + + uuid_arr =3D [] + + for i in range(0,32,2): + uuid_arr.append(int(uuid_str[i:i+2], 16)) log.debug("dom =3D %d", self.vm.getDomid()) log.debug("image =3D %s", self.kernel) @@ -233,6 +243,7 @@ log.debug("pae =3D %d", self.pae) log.debug("acpi =3D %d", self.acpi) log.debug("apic =3D %d", self.apic) + log.debug("uuid =3D %s", uuid_arr) self.register_shutdown_watch() @@ -243,7 +254,8 @@ vcpus =3D self.vm.getVCpuCount(), pae =3D self.pae, acpi =3D self.acpi, - apic =3D self.apic) + apic =3D self.apic, + uuid =3D uuid_arr) # Return a list of cmd line args to the device models based on the # xm config file --=_5kz2doo59cg8 Content-Type: text/x-patch; charset=UTF-8; name="smbios_3-xend.patch" Content-Disposition: attachment; filename="smbios_3-xend.patch" Content-Transfer-Encoding: quoted-printable [HVM] Add UUID as a parameter for HVM domain creation. Signed-off-by: Andrew D. Ball diff -r a1c2cede77c7 tools/python/xen/lowlevel/xc/xc.c --- a/tools/python/xen/lowlevel/xc/xc.c=09Mon Jul 10 14:01:49 2006 +++ b/tools/python/xen/lowlevel/xc/xc.c=09Wed Jul 12 11:48:37 2006 @@ -371,18 +371,35 @@ int pae =3D 0; int acpi =3D 0; int apic =3D 0; + PyObject *uuid_obj =3D NULL; + uint8_t uuid[16]; unsigned long store_mfn =3D 0; + int i; + PyObject *tmp =3D NULL; =20 static char *kwd_list[] =3D { "dom", "store_evtchn", =09=09=09=09"memsize", "image", "vcpus", "pae", "acpi", "apic", + "uuid", =09=09=09=09NULL }; - 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) !=3D 16) + return NULL; + for (i =3D 0; i < 16; i++) { + tmp =3D PySequence_GetItem(uuid_obj, i); + if (!PyInt_Check(tmp)) + return NULL; + uuid[i] =3D (uint8_t) PyInt_AsLong(tmp); + } =20 if ( xc_hvm_build(self->xc_handle, dom, memsize, image, -=09=09 vcpus, pae, acpi, apic, store_evtchn, &store_mfn) !=3D 0 ) +=09=09 vcpus, pae, acpi, apic, store_evtchn, &store_mfn, + uuid) !=3D 0 ) return PyErr_SetFromErrno(xc_error); =20 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" }, =20 { "bvtsched_global_set", diff -r a1c2cede77c7 tools/python/xen/xend/image.py --- a/tools/python/xen/xend/image.py=09Mon Jul 10 14:01:49 2006 +++ b/tools/python/xen/xend/image.py=09Wed Jul 12 11:48:37 2006 @@ -224,6 +224,16 @@ =20 def buildDomain(self): store_evtchn =3D self.vm.getStorePort() +=20 + # convert the DCE formatted UUID string to an array + # of 16 integers + uuid_str =3D self.vm.info['uuid'] + uuid_str =3D uuid_str.replace('-','') + + uuid_arr =3D [] + + for i in range(0,32,2): + uuid_arr.append(int(uuid_str[i:i+2], 16)) =20 log.debug("dom =3D %d", self.vm.getDomid()) log.debug("image =3D %s", self.kernel) @@ -233,6 +243,7 @@ log.debug("pae =3D %d", self.pae) log.debug("acpi =3D %d", self.acpi) log.debug("apic =3D %d", self.apic) + log.debug("uuid =3D %s", uuid_arr) =20 self.register_shutdown_watch() =20 @@ -243,7 +254,8 @@ vcpus =3D self.vm.getVCpuCount(), pae =3D self.pae, acpi =3D self.acpi, - apic =3D self.apic) + apic =3D self.apic, + uuid =3D uuid_arr) =20 # Return a list of cmd line args to the device models based on the # xm config file --=_5kz2doo59cg8 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --=_5kz2doo59cg8--