mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 10:11:27 +01:00
[HVM] HVM is now a flag parameter to domain-creation hypercall.
This cleans up HVM start-of-day in Xen and means that the HVM status of a domain is maintained from cradle to grave. Signed-off-by: Keir Fraser <keir@xensource.com>
This commit is contained in:
1 parent
54ab7bfb1a
commit
3f4c0e0087
35 files changed
+189
-145
No files matched your search
@@ -65,18 +65,17 @@ static PyObject *pyxc_domain_create(XcObject *self,
|
||||
PyObject *args,
|
||||
PyObject *kwds)
|
||||
{
|
||||
uint32_t dom = 0;
|
||||
int ret, i;
|
||||
uint32_t ssidref = 0;
|
||||
uint32_t dom = 0, ssidref = 0, flags = 0;
|
||||
int ret, i, hvm = 0;
|
||||
PyObject *pyhandle = NULL;
|
||||
xen_domain_handle_t handle = {
|
||||
0xde, 0xad, 0xbe, 0xef, 0xde, 0xad, 0xbe, 0xef,
|
||||
0xde, 0xad, 0xbe, 0xef, 0xde, 0xad, 0xbe, 0xef };
|
||||
|
||||
static char *kwd_list[] = { "domid", "ssidref", "handle", NULL };
|
||||
static char *kwd_list[] = { "domid", "ssidref", "handle", "hvm", NULL };
|
||||
|
||||
if ( !PyArg_ParseTupleAndKeywords(args, kwds, "|iiO", kwd_list,
|
||||
&dom, &ssidref, &pyhandle))
|
||||
if ( !PyArg_ParseTupleAndKeywords(args, kwds, "|iiOi", kwd_list,
|
||||
&dom, &ssidref, &pyhandle, &hvm))
|
||||
return NULL;
|
||||
|
||||
if ( pyhandle != NULL )
|
||||
@@ -94,7 +93,11 @@ static PyObject *pyxc_domain_create(XcObject *self,
|
||||
}
|
||||
}
|
||||
|
||||
if ( (ret = xc_domain_create(self->xc_handle, ssidref, handle, &dom)) < 0 )
|
||||
if ( hvm )
|
||||
flags |= XEN_DOMCTL_CDF_hvm_guest;
|
||||
|
||||
if ( (ret = xc_domain_create(self->xc_handle, ssidref,
|
||||
handle, flags, &dom)) < 0 )
|
||||
return PyErr_SetFromErrno(xc_error);
|
||||
|
||||
return PyInt_FromLong(dom);
|
||||
|
||||
@@ -1198,10 +1198,20 @@ class XendDomainInfo:
|
||||
|
||||
log.debug('XendDomainInfo.constructDomain')
|
||||
|
||||
hvm = (self._infoIsSet('image') and
|
||||
sxp.name(self.info['image']) == "hvm")
|
||||
if hvm:
|
||||
info = xc.xeninfo()
|
||||
if not 'hvm' in info['xen_caps']:
|
||||
raise VmError("HVM guest support is unavailable: is VT/AMD-V "
|
||||
"supported by your CPU and enabled in your "
|
||||
"BIOS?")
|
||||
|
||||
self.domid = xc.domain_create(
|
||||
domid = 0,
|
||||
ssidref = security.get_security_info(self.info, 'ssidref'),
|
||||
handle = uuid.fromString(self.info['uuid']))
|
||||
handle = uuid.fromString(self.info['uuid']),
|
||||
hvm = int(hvm))
|
||||
|
||||
if self.domid < 0:
|
||||
raise VmError('Creating domain failed: name=%s' %
|
||||
|
||||