Convert Xen domain VCPU driver methods to use virDomainDefPtr

Introduce use of a virDomainDefPtr in the domain VCPU
APIs to simplify introduction of ACL security checks.
The virDomainPtr cannot be safely used, since the app
may have supplied mis-matching name/uuid/id fields. eg
the name points to domain X, while the uuid points to
domain Y. Resolving the virDomainPtr to a virDomainDefPtr
ensures a consistent name/uuid/id set.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
This commit is contained in:
Daniel P. Berrange 2013-05-01 18:37:29 +01:00
parent 18b14012e4
commit 95e18efddd
7 changed files with 152 additions and 80 deletions

View File

@ -1199,6 +1199,8 @@ xenUnifiedDomainSetVcpusFlags(virDomainPtr dom, unsigned int nvcpus,
unsigned int flags)
{
xenUnifiedPrivatePtr priv = dom->conn->privateData;
virDomainDefPtr def = NULL;
int ret = -1;
virCheckFlags(VIR_DOMAIN_VCPU_LIVE |
VIR_DOMAIN_VCPU_CONFIG |
@ -1219,13 +1221,20 @@ xenUnifiedDomainSetVcpusFlags(virDomainPtr dom, unsigned int nvcpus,
return -1;
}
if (!(def = xenGetDomainDefForDom(dom)))
goto cleanup;
/* Try non-hypervisor methods first, then hypervisor direct method
* as a last resort.
*/
if (dom->id < 0 && priv->xendConfigVersion < XEND_CONFIG_VERSION_3_0_4)
return xenXMDomainSetVcpusFlags(dom, nvcpus, flags);
ret = xenXMDomainSetVcpusFlags(dom->conn, def, nvcpus, flags);
else
return xenDaemonDomainSetVcpusFlags(dom, nvcpus, flags);
ret = xenDaemonDomainSetVcpusFlags(dom->conn, def, nvcpus, flags);
cleanup:
virDomainDefFree(def);
return ret;
}
static int
@ -1248,15 +1257,24 @@ xenUnifiedDomainPinVcpu(virDomainPtr dom, unsigned int vcpu,
unsigned char *cpumap, int maplen)
{
xenUnifiedPrivatePtr priv = dom->conn->privateData;
virDomainDefPtr def = NULL;
int ret = -1;
if (!(def = xenGetDomainDefForDom(dom)))
goto cleanup;
if (dom->id < 0) {
if (priv->xendConfigVersion < XEND_CONFIG_VERSION_3_0_4)
return xenXMDomainPinVcpu(dom, vcpu, cpumap, maplen);
ret = xenXMDomainPinVcpu(dom->conn, def, vcpu, cpumap, maplen);
else
return xenDaemonDomainPinVcpu(dom, vcpu, cpumap, maplen);
ret = xenDaemonDomainPinVcpu(dom->conn, def, vcpu, cpumap, maplen);
} else {
return xenHypervisorPinVcpu(dom, vcpu, cpumap, maplen);
ret = xenHypervisorPinVcpu(dom->conn, def, vcpu, cpumap, maplen);
}
cleanup:
virDomainDefFree(def);
return ret;
}
static int
@ -1265,39 +1283,58 @@ xenUnifiedDomainGetVcpus(virDomainPtr dom,
unsigned char *cpumaps, int maplen)
{
xenUnifiedPrivatePtr priv = dom->conn->privateData;
virDomainDefPtr def = NULL;
int ret = -1;
if (!(def = xenGetDomainDefForDom(dom)))
goto cleanup;
if (dom->id < 0) {
if (priv->xendConfigVersion < XEND_CONFIG_VERSION_3_0_4) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("Cannot get VCPUs of inactive domain"));
return -1;
goto cleanup;
} else {
return xenDaemonDomainGetVcpus(dom, info, maxinfo, cpumaps, maplen);
ret = xenDaemonDomainGetVcpus(dom->conn, def, info, maxinfo, cpumaps, maplen);
}
} else {
return xenHypervisorGetVcpus(dom, info, maxinfo, cpumaps, maplen);
ret = xenHypervisorGetVcpus(dom->conn, def, info, maxinfo, cpumaps, maplen);
}
cleanup:
virDomainDefFree(def);
return ret;
}
static int
xenUnifiedDomainGetVcpusFlags(virDomainPtr dom, unsigned int flags)
{
xenUnifiedPrivatePtr priv = dom->conn->privateData;
virDomainDefPtr def = NULL;
int ret = -1;
virCheckFlags(VIR_DOMAIN_VCPU_LIVE |
VIR_DOMAIN_VCPU_CONFIG |
VIR_DOMAIN_VCPU_MAXIMUM, -1);
if (!(def = xenGetDomainDefForDom(dom)))
goto cleanup;
if (dom->id < 0) {
if (priv->xendConfigVersion < XEND_CONFIG_VERSION_3_0_4)
return xenXMDomainGetVcpusFlags(dom, flags);
ret = xenXMDomainGetVcpusFlags(dom->conn, def, flags);
else
return xenDaemonDomainGetVcpusFlags(dom, flags);
ret = xenDaemonDomainGetVcpusFlags(dom->conn, def, flags);
} else {
if (flags == (VIR_DOMAIN_VCPU_CONFIG | VIR_DOMAIN_VCPU_MAXIMUM))
return xenHypervisorGetVcpuMax(dom);
ret = xenHypervisorGetVcpuMax(dom->conn, def);
else
return xenDaemonDomainGetVcpusFlags(dom, flags);
ret = xenDaemonDomainGetVcpusFlags(dom->conn, def, flags);
}
cleanup:
virDomainDefFree(def);
return ret;
}
static int

View File

@ -2931,16 +2931,16 @@ xenHypervisorSetMaxMemory(virConnectPtr conn,
*/
int
xenHypervisorPinVcpu(virDomainPtr domain, unsigned int vcpu,
unsigned char *cpumap, int maplen)
xenHypervisorPinVcpu(virConnectPtr conn,
virDomainDefPtr def,
unsigned int vcpu,
unsigned char *cpumap,
int maplen)
{
int ret;
xenUnifiedPrivatePtr priv = domain->conn->privateData;
xenUnifiedPrivatePtr priv = conn->privateData;
if (domain->id < 0)
return -1;
ret = virXen_setvcpumap(priv->handle, domain->id, vcpu,
ret = virXen_setvcpumap(priv->handle, def->id, vcpu,
cpumap, maplen);
if (ret < 0)
return -1;
@ -2967,7 +2967,8 @@ xenHypervisorPinVcpu(virDomainPtr domain, unsigned int vcpu,
* Returns the number of info filled in case of success, -1 in case of failure.
*/
int
xenHypervisorGetVcpus(virDomainPtr domain,
xenHypervisorGetVcpus(virConnectPtr conn,
virDomainDefPtr def,
virVcpuInfoPtr info,
int maxinfo,
unsigned char *cpumaps,
@ -2975,22 +2976,22 @@ xenHypervisorGetVcpus(virDomainPtr domain,
{
xen_getdomaininfo dominfo;
int ret;
xenUnifiedPrivatePtr priv = domain->conn->privateData;
xenUnifiedPrivatePtr priv = conn->privateData;
virVcpuInfoPtr ipt;
int nbinfo, i;
if (domain->id < 0 || sizeof(cpumap_t) & 7) {
if (sizeof(cpumap_t) & 7) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("domain shut off or invalid"));
_("invalid cpumap_t size"));
return -1;
}
/* first get the number of virtual CPUs in this domain */
XEN_GETDOMAININFO_CLEAR(dominfo);
ret = virXen_getdomaininfo(priv->handle, domain->id,
ret = virXen_getdomaininfo(priv->handle, def->id,
&dominfo);
if ((ret < 0) || (XEN_GETDOMAININFO_DOMAIN(dominfo) != domain->id)) {
if ((ret < 0) || (XEN_GETDOMAININFO_DOMAIN(dominfo) != def->id)) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("cannot get domain details"));
return -1;
@ -3003,7 +3004,7 @@ xenHypervisorGetVcpus(virDomainPtr domain,
for (i = 0, ipt = info; i < nbinfo; i++, ipt++) {
if ((cpumaps != NULL) && (i < maxinfo)) {
ret = virXen_getvcpusinfo(priv->handle, domain->id, i,
ret = virXen_getvcpusinfo(priv->handle, def->id, i,
ipt,
(unsigned char *)VIR_GET_CPUMAP(cpumaps, maplen, i),
maplen);
@ -3013,7 +3014,7 @@ xenHypervisorGetVcpus(virDomainPtr domain,
return -1;
}
} else {
ret = virXen_getvcpusinfo(priv->handle, domain->id, i,
ret = virXen_getvcpusinfo(priv->handle, def->id, i,
ipt, NULL, 0);
if (ret < 0) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
@ -3034,22 +3035,23 @@ xenHypervisorGetVcpus(virDomainPtr domain,
* the maximum number of virtual CPUs the guest was booted with.
*/
int
xenHypervisorGetVcpuMax(virDomainPtr domain)
xenHypervisorGetVcpuMax(virConnectPtr conn,
virDomainDefPtr def)
{
xen_getdomaininfo dominfo;
int ret;
int maxcpu;
xenUnifiedPrivatePtr priv = domain->conn->privateData;
xenUnifiedPrivatePtr priv = conn->privateData;
/* inactive domain */
if (domain->id < 0) {
if (def->id < 0) {
maxcpu = MAX_VIRT_CPUS;
} else {
XEN_GETDOMAININFO_CLEAR(dominfo);
ret = virXen_getdomaininfo(priv->handle, domain->id,
ret = virXen_getdomaininfo(priv->handle, def->id,
&dominfo);
if ((ret < 0) || (XEN_GETDOMAININFO_DOMAIN(dominfo) != domain->id))
if ((ret < 0) || (XEN_GETDOMAININFO_DOMAIN(dominfo) != def->id))
return -1;
maxcpu = XEN_GETDOMAININFO_MAXCPUID(dominfo) + 1;
}

View File

@ -89,18 +89,21 @@ int xenHypervisorSetMaxMemory (virConnectPtr conn,
ATTRIBUTE_NONNULL (1);
int xenHypervisorCheckID (virConnectPtr conn,
int id);
int xenHypervisorPinVcpu (virDomainPtr domain,
int xenHypervisorPinVcpu (virConnectPtr conn,
virDomainDefPtr def,
unsigned int vcpu,
unsigned char *cpumap,
int maplen)
ATTRIBUTE_NONNULL (1);
int xenHypervisorGetVcpus (virDomainPtr domain,
int xenHypervisorGetVcpus (virConnectPtr conn,
virDomainDefPtr def,
virVcpuInfoPtr info,
int maxinfo,
unsigned char *cpumaps,
int maplen)
ATTRIBUTE_NONNULL (1);
int xenHypervisorGetVcpuMax (virDomainPtr domain)
int xenHypervisorGetVcpuMax (virConnectPtr conn,
virDomainDefPtr def)
ATTRIBUTE_NONNULL (1);
char * xenHypervisorGetSchedulerType (virDomainPtr domain,

View File

@ -1772,7 +1772,8 @@ xenDaemonNodeGetTopology(virConnectPtr conn, virCapsPtr caps)
/**
* xenDaemonDomainSetVcpusFlags:
* @domain: pointer to domain object
* @conn: the connection object
* @def: domain configuration
* @nvcpus: the new number of virtual CPUs for this domain
* @flags: bitwise-ORd from virDomainVcpuFlags
*
@ -1781,7 +1782,8 @@ xenDaemonNodeGetTopology(virConnectPtr conn, virCapsPtr caps)
* Returns 0 on success, -1 if an error message was issued
*/
int
xenDaemonDomainSetVcpusFlags(virDomainPtr domain,
xenDaemonDomainSetVcpusFlags(virConnectPtr conn,
virDomainDefPtr def,
unsigned int vcpus,
unsigned int flags)
{
@ -1797,7 +1799,7 @@ xenDaemonDomainSetVcpusFlags(virDomainPtr domain,
return -1;
}
if (domain->id < 0) {
if (def->id < 0) {
if (flags & VIR_DOMAIN_VCPU_LIVE) {
virReportError(VIR_ERR_OPERATION_INVALID, "%s",
_("domain not running"));
@ -1815,7 +1817,7 @@ xenDaemonDomainSetVcpusFlags(virDomainPtr domain,
/* Unfortunately, xend_op does not validate whether this exceeds
* the maximum. */
flags |= VIR_DOMAIN_VCPU_MAXIMUM;
if ((max = xenDaemonDomainGetVcpusFlags(domain, flags)) < 0) {
if ((max = xenDaemonDomainGetVcpusFlags(conn, def, flags)) < 0) {
virReportError(VIR_ERR_OPERATION_INVALID, "%s",
_("could not determine max vcpus for the domain"));
return -1;
@ -1828,13 +1830,14 @@ xenDaemonDomainSetVcpusFlags(virDomainPtr domain,
}
snprintf(buf, sizeof(buf), "%d", vcpus);
return xend_op(domain->conn, domain->name, "op", "set_vcpus", "vcpus",
return xend_op(conn, def->name, "op", "set_vcpus", "vcpus",
buf, NULL);
}
/**
* xenDaemonDomainPinCpu:
* @domain: pointer to domain object
* @conn: the connection object
* @minidef: minimal domain configuration
* @vcpu: virtual CPU number
* @cpumap: pointer to a bit map of real CPUs (in 8-bit bytes)
* @maplen: length of cpumap in bytes
@ -1849,14 +1852,15 @@ xenDaemonDomainSetVcpusFlags(virDomainPtr domain,
* Returns 0 for success; -1 (with errno) on error
*/
int
xenDaemonDomainPinVcpu(virDomainPtr domain,
xenDaemonDomainPinVcpu(virConnectPtr conn,
virDomainDefPtr minidef,
unsigned int vcpu,
unsigned char *cpumap,
int maplen)
{
char buf[VIR_UUID_BUFLEN], mapstr[sizeof(cpumap_t) * 64];
int i, j, ret;
xenUnifiedPrivatePtr priv = domain->conn->privateData;
xenUnifiedPrivatePtr priv = conn->privateData;
virDomainDefPtr def = NULL;
if (maplen > (int)sizeof(cpumap_t)) {
@ -1884,12 +1888,12 @@ xenDaemonDomainPinVcpu(virDomainPtr domain,
snprintf(buf, sizeof(buf), "%d", vcpu);
ret = xend_op(domain->conn, domain->name, "op", "pincpu", "vcpu", buf,
ret = xend_op(conn, minidef->name, "op", "pincpu", "vcpu", buf,
"cpumap", mapstr, NULL);
if (!(def = xenDaemonDomainFetch(domain->conn,
domain->id,
domain->name,
if (!(def = xenDaemonDomainFetch(conn,
minidef->id,
minidef->name,
NULL)))
goto cleanup;
@ -1921,7 +1925,8 @@ cleanup:
/**
* xenDaemonDomainGetVcpusFlags:
* @domain: pointer to domain object
* @conn: the connection object
* @def: domain configuration
* @flags: bitwise-ORd from virDomainVcpuFlags
*
* Extract information about virtual CPUs of domain according to flags.
@ -1931,7 +1936,9 @@ cleanup:
*/
int
xenDaemonDomainGetVcpusFlags(virDomainPtr domain, unsigned int flags)
xenDaemonDomainGetVcpusFlags(virConnectPtr conn,
virDomainDefPtr def,
unsigned int flags)
{
struct sexpr *root;
int ret;
@ -1940,13 +1947,13 @@ xenDaemonDomainGetVcpusFlags(virDomainPtr domain, unsigned int flags)
VIR_DOMAIN_VCPU_CONFIG |
VIR_DOMAIN_VCPU_MAXIMUM, -1);
if (domain->id < 0 && (flags & VIR_DOMAIN_VCPU_LIVE)) {
if (def->id < 0 && (flags & VIR_DOMAIN_VCPU_LIVE)) {
virReportError(VIR_ERR_OPERATION_INVALID, "%s",
_("domain not active"));
return -1;
}
root = sexpr_get(domain->conn, "/xend/domain/%s?detail=1", domain->name);
root = sexpr_get(conn, "/xend/domain/%s?detail=1", def->name);
if (root == NULL)
return -1;
@ -1964,7 +1971,8 @@ xenDaemonDomainGetVcpusFlags(virDomainPtr domain, unsigned int flags)
/**
* virDomainGetVcpus:
* @domain: pointer to domain object, or NULL for Domain0
* @conn: the connection object
* @def: domain configuration
* @info: pointer to an array of virVcpuInfo structures (OUT)
* @maxinfo: number of structures in info array
* @cpumaps: pointer to a bit map of real CPUs for all vcpus of this domain (in 8-bit bytes) (OUT)
@ -1982,7 +1990,8 @@ xenDaemonDomainGetVcpusFlags(virDomainPtr domain, unsigned int flags)
* Returns the number of info filled in case of success, -1 in case of failure.
*/
int
xenDaemonDomainGetVcpus(virDomainPtr domain,
xenDaemonDomainGetVcpus(virConnectPtr conn,
virDomainDefPtr def,
virVcpuInfoPtr info,
int maxinfo,
unsigned char *cpumaps,
@ -1994,7 +2003,7 @@ xenDaemonDomainGetVcpus(virDomainPtr domain,
unsigned char *cpumap;
int vcpu, cpu;
root = sexpr_get(domain->conn, "/xend/domain/%s?op=vcpuinfo", domain->name);
root = sexpr_get(conn, "/xend/domain/%s?op=vcpuinfo", def->name);
if (root == NULL)
return -1;

View File

@ -147,18 +147,23 @@ int xenDaemonDomainCreate(virConnectPtr conn,
int xenDaemonDomainUndefine(virConnectPtr conn,
virDomainDefPtr def);
int xenDaemonDomainSetVcpus (virDomainPtr domain,
int xenDaemonDomainSetVcpus (virConnectPtr conn,
virDomainDefPtr def,
unsigned int vcpus);
int xenDaemonDomainSetVcpusFlags (virDomainPtr domain,
int xenDaemonDomainSetVcpusFlags (virConnectPtr conn,
virDomainDefPtr def,
unsigned int vcpus,
unsigned int flags);
int xenDaemonDomainPinVcpu (virDomainPtr domain,
int xenDaemonDomainPinVcpu (virConnectPtr conn,
virDomainDefPtr def,
unsigned int vcpu,
unsigned char *cpumap,
int maplen);
int xenDaemonDomainGetVcpusFlags (virDomainPtr domain,
int xenDaemonDomainGetVcpusFlags (virConnectPtr conn,
virDomainDefPtr def,
unsigned int flags);
int xenDaemonDomainGetVcpus (virDomainPtr domain,
int xenDaemonDomainGetVcpus (virConnectPtr conn,
virDomainDefPtr def,
virVcpuInfoPtr info,
int maxinfo,
unsigned char *cpumaps,

View File

@ -648,7 +648,8 @@ cleanup:
/*
* xenXMDomainSetVcpusFlags:
* @domain: pointer to domain object
* @conn: the connection object
* @def: domain configuration
* @nvcpus: number of vcpus
* @flags: bitwise-ORd from virDomainVcpuFlags
*
@ -657,11 +658,12 @@ cleanup:
* Returns 0 on success, -1 if an error message was issued
*/
int
xenXMDomainSetVcpusFlags(virDomainPtr domain,
xenXMDomainSetVcpusFlags(virConnectPtr conn,
virDomainDefPtr def,
unsigned int vcpus,
unsigned int flags)
{
xenUnifiedPrivatePtr priv = domain->conn->privateData;
xenUnifiedPrivatePtr priv = conn->privateData;
const char *filename;
xenXMConfCachePtr entry;
int ret = -1;
@ -679,14 +681,14 @@ xenXMDomainSetVcpusFlags(virDomainPtr domain,
xenUnifiedLock(priv);
if (!(filename = virHashLookup(priv->nameConfigMap, domain->name)))
if (!(filename = virHashLookup(priv->nameConfigMap, def->name)))
goto cleanup;
if (!(entry = virHashLookup(priv->configCache, filename)))
goto cleanup;
/* Hypervisor maximum. */
if ((max = xenUnifiedConnectGetMaxVcpus(domain->conn, NULL)) < 0) {
if ((max = xenUnifiedConnectGetMaxVcpus(conn, NULL)) < 0) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("could not determine max vcpus for the domain"));
goto cleanup;
@ -713,7 +715,7 @@ xenXMDomainSetVcpusFlags(virDomainPtr domain,
/* If this fails, should we try to undo our changes to the
* in-memory representation of the config file. I say not!
*/
if (xenXMConfigSaveFile(domain->conn, entry->filename, entry->def) < 0)
if (xenXMConfigSaveFile(conn, entry->filename, entry->def) < 0)
goto cleanup;
ret = 0;
@ -724,7 +726,8 @@ cleanup:
/**
* xenXMDomainGetVcpusFlags:
* @domain: pointer to domain object
* @conn: the connection object
* @def: domain configuration
* @flags: bitwise-ORd from virDomainVcpuFlags
*
* Extract information about virtual CPUs of domain according to flags.
@ -733,12 +736,14 @@ cleanup:
* issued
*/
int
xenXMDomainGetVcpusFlags(virDomainPtr domain, unsigned int flags)
xenXMDomainGetVcpusFlags(virConnectPtr conn,
virDomainDefPtr def,
unsigned int flags)
{
xenUnifiedPrivatePtr priv = domain->conn->privateData;
xenUnifiedPrivatePtr priv = conn->privateData;
const char *filename;
xenXMConfCachePtr entry;
int ret = -2;
int ret = -1;
virCheckFlags(VIR_DOMAIN_VCPU_LIVE |
VIR_DOMAIN_VCPU_CONFIG |
@ -751,7 +756,7 @@ xenXMDomainGetVcpusFlags(virDomainPtr domain, unsigned int flags)
xenUnifiedLock(priv);
if (!(filename = virHashLookup(priv->nameConfigMap, domain->name)))
if (!(filename = virHashLookup(priv->nameConfigMap, def->name)))
goto cleanup;
if (!(entry = virHashLookup(priv->configCache, filename)))
@ -767,7 +772,8 @@ cleanup:
/**
* xenXMDomainPinVcpu:
* @domain: pointer to domain object
* @conn: the connection object
* @def: domain configuration
* @vcpu: virtual CPU number (reserved)
* @cpumap: pointer to a bit map of real CPUs (in 8-bit bytes)
* @maplen: length of cpumap in bytes
@ -777,12 +783,13 @@ cleanup:
* Returns 0 for success; -1 (with errno) on error
*/
int
xenXMDomainPinVcpu(virDomainPtr domain,
xenXMDomainPinVcpu(virConnectPtr conn,
virDomainDefPtr def,
unsigned int vcpu ATTRIBUTE_UNUSED,
unsigned char *cpumap,
int maplen)
{
xenUnifiedPrivatePtr priv = domain->conn->privateData;
xenUnifiedPrivatePtr priv = conn->privateData;
const char *filename;
xenXMConfCachePtr entry;
int ret = -1;
@ -794,7 +801,7 @@ xenXMDomainPinVcpu(virDomainPtr domain,
xenUnifiedLock(priv);
if (!(filename = virHashLookup(priv->nameConfigMap, domain->name))) {
if (!(filename = virHashLookup(priv->nameConfigMap, def->name))) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("virHashLookup"));
goto cleanup;
}
@ -808,7 +815,7 @@ xenXMDomainPinVcpu(virDomainPtr domain,
entry->def->cpumask = virBitmapNewData(cpumap, maplen);
if (!entry->def->cpumask)
goto cleanup;
if (xenXMConfigSaveFile(domain->conn, entry->filename, entry->def) < 0)
if (xenXMConfigSaveFile(conn, entry->filename, entry->def) < 0)
goto cleanup;
ret = 0;

View File

@ -54,12 +54,21 @@ int xenXMDomainSetMaxMemory(virConnectPtr conn,
unsigned long memory);
unsigned long long xenXMDomainGetMaxMemory(virConnectPtr conn,
virDomainDefPtr def);
int xenXMDomainSetVcpus(virDomainPtr domain, unsigned int vcpus);
int xenXMDomainSetVcpusFlags(virDomainPtr domain, unsigned int vcpus,
int xenXMDomainSetVcpus(virConnectPtr conn,
virDomainDefPtr def,
unsigned int vcpus);
int xenXMDomainSetVcpusFlags(virConnectPtr conn,
virDomainDefPtr def,
unsigned int vcpus,
unsigned int flags);
int xenXMDomainGetVcpusFlags(virDomainPtr domain, unsigned int flags);
int xenXMDomainPinVcpu(virDomainPtr domain, unsigned int vcpu,
unsigned char *cpumap, int maplen);
int xenXMDomainGetVcpusFlags(virConnectPtr conn,
virDomainDefPtr def,
unsigned int flags);
int xenXMDomainPinVcpu(virConnectPtr conn,
virDomainDefPtr def,
unsigned int vcpu,
unsigned char *cpumap,
int maplen);
virDomainDefPtr xenXMDomainLookupByName(virConnectPtr conn, const char *domname);
virDomainDefPtr xenXMDomainLookupByUUID(virConnectPtr conn, const unsigned char *uuid);