mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
Simplify the Xen domain VCPU driver methods
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
This commit is contained in:
parent
48610ebecc
commit
7c21e500a4
@ -1004,7 +1004,6 @@ xenUnifiedDomainSetVcpusFlags(virDomainPtr dom, unsigned int nvcpus,
|
|||||||
unsigned int flags)
|
unsigned int flags)
|
||||||
{
|
{
|
||||||
xenUnifiedPrivatePtr priv = dom->conn->privateData;
|
xenUnifiedPrivatePtr priv = dom->conn->privateData;
|
||||||
int ret;
|
|
||||||
|
|
||||||
virCheckFlags(VIR_DOMAIN_VCPU_LIVE |
|
virCheckFlags(VIR_DOMAIN_VCPU_LIVE |
|
||||||
VIR_DOMAIN_VCPU_CONFIG |
|
VIR_DOMAIN_VCPU_CONFIG |
|
||||||
@ -1028,38 +1027,25 @@ xenUnifiedDomainSetVcpusFlags(virDomainPtr dom, unsigned int nvcpus,
|
|||||||
/* Try non-hypervisor methods first, then hypervisor direct method
|
/* Try non-hypervisor methods first, then hypervisor direct method
|
||||||
* as a last resort.
|
* as a last resort.
|
||||||
*/
|
*/
|
||||||
if (priv->opened[XEN_UNIFIED_XEND_OFFSET]) {
|
if (dom->id < 0 && priv->xendConfigVersion < XEND_CONFIG_VERSION_3_0_4)
|
||||||
ret = xenDaemonDomainSetVcpusFlags(dom, nvcpus, flags);
|
return xenXMDomainSetVcpusFlags(dom, nvcpus, flags);
|
||||||
if (ret != -2)
|
else
|
||||||
return ret;
|
return xenDaemonDomainSetVcpusFlags(dom, nvcpus, flags);
|
||||||
}
|
|
||||||
if (priv->opened[XEN_UNIFIED_XM_OFFSET]) {
|
|
||||||
ret = xenXMDomainSetVcpusFlags(dom, nvcpus, flags);
|
|
||||||
if (ret != -2)
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
if (flags == VIR_DOMAIN_VCPU_LIVE)
|
|
||||||
return xenHypervisorSetVcpus(dom, nvcpus);
|
|
||||||
|
|
||||||
virReportError(VIR_ERR_NO_SUPPORT, __FUNCTION__);
|
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
xenUnifiedDomainSetVcpus(virDomainPtr dom, unsigned int nvcpus)
|
xenUnifiedDomainSetVcpus(virDomainPtr dom, unsigned int nvcpus)
|
||||||
{
|
{
|
||||||
|
xenUnifiedPrivatePtr priv = dom->conn->privateData;
|
||||||
unsigned int flags = VIR_DOMAIN_VCPU_LIVE;
|
unsigned int flags = VIR_DOMAIN_VCPU_LIVE;
|
||||||
|
|
||||||
/* Per the documented API, it is hypervisor-dependent whether this
|
/* Per the documented API, it is hypervisor-dependent whether this
|
||||||
* affects just _LIVE or _LIVE|_CONFIG; in xen's case, that
|
* affects just _LIVE or _LIVE|_CONFIG; in xen's case, that
|
||||||
* depends on xendConfigVersion. */
|
* depends on xendConfigVersion. */
|
||||||
if (dom) {
|
if (priv->xendConfigVersion >= XEND_CONFIG_VERSION_3_0_4)
|
||||||
xenUnifiedPrivatePtr priv = dom->conn->privateData;
|
flags |= VIR_DOMAIN_VCPU_CONFIG;
|
||||||
if (priv->xendConfigVersion >= XEND_CONFIG_VERSION_3_0_4)
|
|
||||||
flags |= VIR_DOMAIN_VCPU_CONFIG;
|
return xenUnifiedDomainSetVcpusFlags(dom, nvcpus, flags);
|
||||||
return xenUnifiedDomainSetVcpusFlags(dom, nvcpus, flags);
|
|
||||||
}
|
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
@ -1067,15 +1053,15 @@ xenUnifiedDomainPinVcpu(virDomainPtr dom, unsigned int vcpu,
|
|||||||
unsigned char *cpumap, int maplen)
|
unsigned char *cpumap, int maplen)
|
||||||
{
|
{
|
||||||
xenUnifiedPrivatePtr priv = dom->conn->privateData;
|
xenUnifiedPrivatePtr priv = dom->conn->privateData;
|
||||||
int i;
|
|
||||||
|
|
||||||
for (i = 0; i < XEN_UNIFIED_NR_DRIVERS; ++i)
|
if (dom->id < 0) {
|
||||||
if (priv->opened[i] &&
|
if (priv->xendConfigVersion < XEND_CONFIG_VERSION_3_0_4)
|
||||||
drivers[i]->xenDomainPinVcpu &&
|
return xenXMDomainPinVcpu(dom, vcpu, cpumap, maplen);
|
||||||
drivers[i]->xenDomainPinVcpu(dom, vcpu, cpumap, maplen) == 0)
|
else
|
||||||
return 0;
|
return xenDaemonDomainPinVcpu(dom, vcpu, cpumap, maplen);
|
||||||
|
} else {
|
||||||
return -1;
|
return xenHypervisorPinVcpu(dom, vcpu, cpumap, maplen);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
@ -1084,42 +1070,39 @@ xenUnifiedDomainGetVcpus(virDomainPtr dom,
|
|||||||
unsigned char *cpumaps, int maplen)
|
unsigned char *cpumaps, int maplen)
|
||||||
{
|
{
|
||||||
xenUnifiedPrivatePtr priv = dom->conn->privateData;
|
xenUnifiedPrivatePtr priv = dom->conn->privateData;
|
||||||
int i, ret;
|
if (dom->id < 0) {
|
||||||
|
if (priv->xendConfigVersion < XEND_CONFIG_VERSION_3_0_4) {
|
||||||
for (i = 0; i < XEN_UNIFIED_NR_DRIVERS; ++i)
|
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||||
if (priv->opened[i] && drivers[i]->xenDomainGetVcpus) {
|
_("Cannot get VCPUs of inactive domain"));
|
||||||
ret = drivers[i]->xenDomainGetVcpus(dom, info, maxinfo, cpumaps, maplen);
|
return -1;
|
||||||
if (ret > 0)
|
} else {
|
||||||
return ret;
|
return xenDaemonDomainGetVcpus(dom, info, maxinfo, cpumaps, maplen);
|
||||||
}
|
}
|
||||||
return -1;
|
} else {
|
||||||
|
return xenHypervisorGetVcpus(dom, info, maxinfo, cpumaps, maplen);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
xenUnifiedDomainGetVcpusFlags(virDomainPtr dom, unsigned int flags)
|
xenUnifiedDomainGetVcpusFlags(virDomainPtr dom, unsigned int flags)
|
||||||
{
|
{
|
||||||
xenUnifiedPrivatePtr priv = dom->conn->privateData;
|
xenUnifiedPrivatePtr priv = dom->conn->privateData;
|
||||||
int ret;
|
|
||||||
|
|
||||||
virCheckFlags(VIR_DOMAIN_VCPU_LIVE |
|
virCheckFlags(VIR_DOMAIN_VCPU_LIVE |
|
||||||
VIR_DOMAIN_VCPU_CONFIG |
|
VIR_DOMAIN_VCPU_CONFIG |
|
||||||
VIR_DOMAIN_VCPU_MAXIMUM, -1);
|
VIR_DOMAIN_VCPU_MAXIMUM, -1);
|
||||||
|
|
||||||
if (priv->opened[XEN_UNIFIED_XEND_OFFSET]) {
|
if (dom->id < 0) {
|
||||||
ret = xenDaemonDomainGetVcpusFlags(dom, flags);
|
if (priv->xendConfigVersion < XEND_CONFIG_VERSION_3_0_4)
|
||||||
if (ret != -2)
|
return xenXMDomainGetVcpusFlags(dom, flags);
|
||||||
return ret;
|
else
|
||||||
|
return xenDaemonDomainGetVcpusFlags(dom, flags);
|
||||||
|
} else {
|
||||||
|
if (flags == (VIR_DOMAIN_VCPU_CONFIG | VIR_DOMAIN_VCPU_MAXIMUM))
|
||||||
|
return xenHypervisorGetVcpuMax(dom);
|
||||||
|
else
|
||||||
|
return xenDaemonDomainGetVcpusFlags(dom, flags);
|
||||||
}
|
}
|
||||||
if (priv->opened[XEN_UNIFIED_XM_OFFSET]) {
|
|
||||||
ret = xenXMDomainGetVcpusFlags(dom, flags);
|
|
||||||
if (ret != -2)
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
if (flags == (VIR_DOMAIN_VCPU_CONFIG | VIR_DOMAIN_VCPU_MAXIMUM))
|
|
||||||
return xenHypervisorGetVcpuMax(dom);
|
|
||||||
|
|
||||||
virReportError(VIR_ERR_NO_SUPPORT, __FUNCTION__);
|
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
@ -93,8 +93,6 @@ extern int xenRegister (void);
|
|||||||
* structure with direct calls in xen_unified.c.
|
* structure with direct calls in xen_unified.c.
|
||||||
*/
|
*/
|
||||||
struct xenUnifiedDriver {
|
struct xenUnifiedDriver {
|
||||||
virDrvDomainPinVcpu xenDomainPinVcpu;
|
|
||||||
virDrvDomainGetVcpus xenDomainGetVcpus;
|
|
||||||
virDrvConnectListDefinedDomains xenListDefinedDomains;
|
virDrvConnectListDefinedDomains xenListDefinedDomains;
|
||||||
virDrvConnectNumOfDefinedDomains xenNumOfDefinedDomains;
|
virDrvConnectNumOfDefinedDomains xenNumOfDefinedDomains;
|
||||||
virDrvDomainCreate xenDomainCreate;
|
virDrvDomainCreate xenDomainCreate;
|
||||||
|
@ -646,25 +646,6 @@ struct xen_v2d5_setmaxmem {
|
|||||||
};
|
};
|
||||||
typedef struct xen_v2d5_setmaxmem xen_v2d5_setmaxmem;
|
typedef struct xen_v2d5_setmaxmem xen_v2d5_setmaxmem;
|
||||||
|
|
||||||
/*
|
|
||||||
* The information for a setmaxvcpu system hypercall
|
|
||||||
*/
|
|
||||||
#define XEN_V0_OP_SETMAXVCPU 41
|
|
||||||
#define XEN_V1_OP_SETMAXVCPU 41
|
|
||||||
#define XEN_V2_OP_SETMAXVCPU 15
|
|
||||||
|
|
||||||
struct xen_v0_setmaxvcpu {
|
|
||||||
domid_t domain;
|
|
||||||
uint32_t maxvcpu;
|
|
||||||
};
|
|
||||||
typedef struct xen_v0_setmaxvcpu xen_v0_setmaxvcpu;
|
|
||||||
typedef struct xen_v0_setmaxvcpu xen_v1_setmaxvcpu;
|
|
||||||
|
|
||||||
struct xen_v2_setmaxvcpu {
|
|
||||||
uint32_t maxvcpu;
|
|
||||||
};
|
|
||||||
typedef struct xen_v2_setmaxvcpu xen_v2_setmaxvcpu;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The information for a setvcpumap system hypercall
|
* The information for a setvcpumap system hypercall
|
||||||
* Note that between 1 and 2 the limitation to 64 physical CPU was lifted
|
* Note that between 1 and 2 the limitation to 64 physical CPU was lifted
|
||||||
@ -814,7 +795,6 @@ struct xen_op_v0 {
|
|||||||
xen_v0_getdomaininfolistop getdomaininfolist;
|
xen_v0_getdomaininfolistop getdomaininfolist;
|
||||||
xen_v0_domainop domain;
|
xen_v0_domainop domain;
|
||||||
xen_v0_setmaxmem setmaxmem;
|
xen_v0_setmaxmem setmaxmem;
|
||||||
xen_v0_setmaxvcpu setmaxvcpu;
|
|
||||||
xen_v0_setvcpumap setvcpumap;
|
xen_v0_setvcpumap setvcpumap;
|
||||||
xen_v0_vcpuinfo getvcpuinfo;
|
xen_v0_vcpuinfo getvcpuinfo;
|
||||||
uint8_t padding[128];
|
uint8_t padding[128];
|
||||||
@ -846,7 +826,6 @@ struct xen_op_v2_dom {
|
|||||||
union {
|
union {
|
||||||
xen_v2_setmaxmem setmaxmem;
|
xen_v2_setmaxmem setmaxmem;
|
||||||
xen_v2d5_setmaxmem setmaxmemd5;
|
xen_v2d5_setmaxmem setmaxmemd5;
|
||||||
xen_v2_setmaxvcpu setmaxvcpu;
|
|
||||||
xen_v2_setvcpumap setvcpumap;
|
xen_v2_setvcpumap setvcpumap;
|
||||||
xen_v2d5_setvcpumap setvcpumapd5;
|
xen_v2d5_setvcpumap setvcpumapd5;
|
||||||
xen_v2_vcpuinfo getvcpuinfo;
|
xen_v2_vcpuinfo getvcpuinfo;
|
||||||
@ -871,8 +850,6 @@ typedef struct xen_op_v2_dom xen_op_v2_dom;
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
struct xenUnifiedDriver xenHypervisorDriver = {
|
struct xenUnifiedDriver xenHypervisorDriver = {
|
||||||
.xenDomainPinVcpu = xenHypervisorPinVcpu,
|
|
||||||
.xenDomainGetVcpus = xenHypervisorGetVcpus,
|
|
||||||
.xenDomainGetSchedulerType = xenHypervisorGetSchedulerType,
|
.xenDomainGetSchedulerType = xenHypervisorGetSchedulerType,
|
||||||
.xenDomainGetSchedulerParameters = xenHypervisorGetSchedulerParameters,
|
.xenDomainGetSchedulerParameters = xenHypervisorGetSchedulerParameters,
|
||||||
.xenDomainSetSchedulerParameters = xenHypervisorSetSchedulerParameters,
|
.xenDomainSetSchedulerParameters = xenHypervisorSetSchedulerParameters,
|
||||||
@ -1517,48 +1494,6 @@ virXen_setmaxmem(int handle, int id, unsigned long memory)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* virXen_setmaxvcpus:
|
|
||||||
* @handle: the hypervisor handle
|
|
||||||
* @id: the domain id
|
|
||||||
* @vcpus: the numbers of vcpus
|
|
||||||
*
|
|
||||||
* Do a low level hypercall to change the max vcpus amount
|
|
||||||
*
|
|
||||||
* Returns 0 or -1 in case of failure
|
|
||||||
*/
|
|
||||||
static int
|
|
||||||
virXen_setmaxvcpus(int handle, int id, unsigned int vcpus)
|
|
||||||
{
|
|
||||||
int ret = -1;
|
|
||||||
|
|
||||||
if (hv_versions.hypervisor > 1) {
|
|
||||||
xen_op_v2_dom op;
|
|
||||||
|
|
||||||
memset(&op, 0, sizeof(op));
|
|
||||||
op.cmd = XEN_V2_OP_SETMAXVCPU;
|
|
||||||
op.domain = (domid_t) id;
|
|
||||||
op.u.setmaxvcpu.maxvcpu = vcpus;
|
|
||||||
ret = xenHypervisorDoV2Dom(handle, &op);
|
|
||||||
} else if (hv_versions.hypervisor == 1) {
|
|
||||||
xen_op_v1 op;
|
|
||||||
|
|
||||||
memset(&op, 0, sizeof(op));
|
|
||||||
op.cmd = XEN_V1_OP_SETMAXVCPU;
|
|
||||||
op.u.setmaxvcpu.domain = (domid_t) id;
|
|
||||||
op.u.setmaxvcpu.maxvcpu = vcpus;
|
|
||||||
ret = xenHypervisorDoV1Op(handle, &op);
|
|
||||||
} else if (hv_versions.hypervisor == 0) {
|
|
||||||
xen_op_v0 op;
|
|
||||||
|
|
||||||
memset(&op, 0, sizeof(op));
|
|
||||||
op.cmd = XEN_V0_OP_SETMAXVCPU;
|
|
||||||
op.u.setmaxvcpu.domain = (domid_t) id;
|
|
||||||
op.u.setmaxvcpu.maxvcpu = vcpus;
|
|
||||||
ret = xenHypervisorDoV0Op(handle, &op);
|
|
||||||
}
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* virXen_setvcpumap:
|
* virXen_setvcpumap:
|
||||||
@ -3003,31 +2938,6 @@ xenHypervisorSetMaxMemory(virDomainPtr domain, unsigned long memory)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* xenHypervisorSetVcpus:
|
|
||||||
* @domain: pointer to domain object
|
|
||||||
* @nvcpus: the new number of virtual CPUs for this domain
|
|
||||||
*
|
|
||||||
* Dynamically change the number of virtual CPUs used by the domain.
|
|
||||||
*
|
|
||||||
* Returns 0 in case of success, -1 in case of failure.
|
|
||||||
*/
|
|
||||||
|
|
||||||
int
|
|
||||||
xenHypervisorSetVcpus(virDomainPtr domain, unsigned int nvcpus)
|
|
||||||
{
|
|
||||||
int ret;
|
|
||||||
xenUnifiedPrivatePtr priv = domain->conn->privateData;
|
|
||||||
|
|
||||||
if (domain->id < 0 || nvcpus < 1)
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
ret = virXen_setmaxvcpus(priv->handle, domain->id, nvcpus);
|
|
||||||
if (ret < 0)
|
|
||||||
return -1;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* xenHypervisorPinVcpu:
|
* xenHypervisorPinVcpu:
|
||||||
* @domain: pointer to domain object
|
* @domain: pointer to domain object
|
||||||
|
@ -86,9 +86,6 @@ int xenHypervisorSetMaxMemory (virDomainPtr domain,
|
|||||||
ATTRIBUTE_NONNULL (1);
|
ATTRIBUTE_NONNULL (1);
|
||||||
int xenHypervisorCheckID (virConnectPtr conn,
|
int xenHypervisorCheckID (virConnectPtr conn,
|
||||||
int id);
|
int id);
|
||||||
int xenHypervisorSetVcpus (virDomainPtr domain,
|
|
||||||
unsigned int nvcpus)
|
|
||||||
ATTRIBUTE_NONNULL (1);
|
|
||||||
int xenHypervisorPinVcpu (virDomainPtr domain,
|
int xenHypervisorPinVcpu (virDomainPtr domain,
|
||||||
unsigned int vcpu,
|
unsigned int vcpu,
|
||||||
unsigned char *cpumap,
|
unsigned char *cpumap,
|
||||||
|
@ -1778,8 +1778,7 @@ xenDaemonNodeGetTopology(virConnectPtr conn, virCapsPtr caps)
|
|||||||
*
|
*
|
||||||
* Change virtual CPUs allocation of domain according to flags.
|
* Change virtual CPUs allocation of domain according to flags.
|
||||||
*
|
*
|
||||||
* Returns 0 on success, -1 if an error message was issued, and -2 if
|
* Returns 0 on success, -1 if an error message was issued
|
||||||
* the unified driver should keep trying.
|
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
xenDaemonDomainSetVcpusFlags(virDomainPtr domain,
|
xenDaemonDomainSetVcpusFlags(virDomainPtr domain,
|
||||||
@ -1787,7 +1786,6 @@ xenDaemonDomainSetVcpusFlags(virDomainPtr domain,
|
|||||||
unsigned int flags)
|
unsigned int flags)
|
||||||
{
|
{
|
||||||
char buf[VIR_UUID_BUFLEN];
|
char buf[VIR_UUID_BUFLEN];
|
||||||
xenUnifiedPrivatePtr priv = domain->conn->privateData;
|
|
||||||
int max;
|
int max;
|
||||||
|
|
||||||
virCheckFlags(VIR_DOMAIN_VCPU_LIVE |
|
virCheckFlags(VIR_DOMAIN_VCPU_LIVE |
|
||||||
@ -1799,21 +1797,7 @@ xenDaemonDomainSetVcpusFlags(virDomainPtr domain,
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((domain->id < 0 && priv->xendConfigVersion < XEND_CONFIG_VERSION_3_0_4) ||
|
if (domain->id < 0) {
|
||||||
(flags & VIR_DOMAIN_VCPU_MAXIMUM))
|
|
||||||
return -2;
|
|
||||||
|
|
||||||
/* With xendConfigVersion 2, only _LIVE is supported. With
|
|
||||||
* xendConfigVersion 3, only _LIVE|_CONFIG is supported for
|
|
||||||
* running domains, or _CONFIG for inactive domains. */
|
|
||||||
if (priv->xendConfigVersion < XEND_CONFIG_VERSION_3_0_4) {
|
|
||||||
if (flags & VIR_DOMAIN_VCPU_CONFIG) {
|
|
||||||
virReportError(VIR_ERR_OPERATION_INVALID, "%s",
|
|
||||||
_("Xend version does not support modifying "
|
|
||||||
"persistent config"));
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
} else if (domain->id < 0) {
|
|
||||||
if (flags & VIR_DOMAIN_VCPU_LIVE) {
|
if (flags & VIR_DOMAIN_VCPU_LIVE) {
|
||||||
virReportError(VIR_ERR_OPERATION_INVALID, "%s",
|
virReportError(VIR_ERR_OPERATION_INVALID, "%s",
|
||||||
_("domain not running"));
|
_("domain not running"));
|
||||||
@ -1943,7 +1927,7 @@ cleanup:
|
|||||||
* Extract information about virtual CPUs of domain according to flags.
|
* Extract information about virtual CPUs of domain according to flags.
|
||||||
*
|
*
|
||||||
* Returns the number of vcpus on success, -1 if an error message was
|
* Returns the number of vcpus on success, -1 if an error message was
|
||||||
* issued, and -2 if the unified driver should keep trying.
|
* issued
|
||||||
|
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
@ -1951,17 +1935,11 @@ xenDaemonDomainGetVcpusFlags(virDomainPtr domain, unsigned int flags)
|
|||||||
{
|
{
|
||||||
struct sexpr *root;
|
struct sexpr *root;
|
||||||
int ret;
|
int ret;
|
||||||
xenUnifiedPrivatePtr priv = domain->conn->privateData;
|
|
||||||
|
|
||||||
virCheckFlags(VIR_DOMAIN_VCPU_LIVE |
|
virCheckFlags(VIR_DOMAIN_VCPU_LIVE |
|
||||||
VIR_DOMAIN_VCPU_CONFIG |
|
VIR_DOMAIN_VCPU_CONFIG |
|
||||||
VIR_DOMAIN_VCPU_MAXIMUM, -1);
|
VIR_DOMAIN_VCPU_MAXIMUM, -1);
|
||||||
|
|
||||||
/* If xendConfigVersion is 2, then we can only report _LIVE (and
|
|
||||||
* xm_internal reports _CONFIG). If it is 3, then _LIVE and
|
|
||||||
* _CONFIG are always in sync for a running system. */
|
|
||||||
if (domain->id < 0 && priv->xendConfigVersion < XEND_CONFIG_VERSION_3_0_4)
|
|
||||||
return -2;
|
|
||||||
if (domain->id < 0 && (flags & VIR_DOMAIN_VCPU_LIVE)) {
|
if (domain->id < 0 && (flags & VIR_DOMAIN_VCPU_LIVE)) {
|
||||||
virReportError(VIR_ERR_OPERATION_INVALID, "%s",
|
virReportError(VIR_ERR_OPERATION_INVALID, "%s",
|
||||||
_("domain not active"));
|
_("domain not active"));
|
||||||
@ -1979,7 +1957,7 @@ xenDaemonDomainGetVcpusFlags(virDomainPtr domain, unsigned int flags)
|
|||||||
ret = MIN(vcpus, ret);
|
ret = MIN(vcpus, ret);
|
||||||
}
|
}
|
||||||
if (!ret)
|
if (!ret)
|
||||||
ret = -2;
|
ret = -1;
|
||||||
sexpr_free(root);
|
sexpr_free(root);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@ -3415,8 +3393,6 @@ xenDaemonDomainBlockPeek(virDomainPtr domain,
|
|||||||
}
|
}
|
||||||
|
|
||||||
struct xenUnifiedDriver xenDaemonDriver = {
|
struct xenUnifiedDriver xenDaemonDriver = {
|
||||||
.xenDomainPinVcpu = xenDaemonDomainPinVcpu,
|
|
||||||
.xenDomainGetVcpus = xenDaemonDomainGetVcpus,
|
|
||||||
.xenListDefinedDomains = xenDaemonListDefinedDomains,
|
.xenListDefinedDomains = xenDaemonListDefinedDomains,
|
||||||
.xenNumOfDefinedDomains = xenDaemonNumOfDefinedDomains,
|
.xenNumOfDefinedDomains = xenDaemonNumOfDefinedDomains,
|
||||||
.xenDomainCreate = xenDaemonDomainCreate,
|
.xenDomainCreate = xenDaemonDomainCreate,
|
||||||
|
@ -81,7 +81,6 @@ static int xenXMDomainDetachDeviceFlags(virDomainPtr domain, const char *xml,
|
|||||||
#define XM_XML_ERROR "Invalid xml"
|
#define XM_XML_ERROR "Invalid xml"
|
||||||
|
|
||||||
struct xenUnifiedDriver xenXMDriver = {
|
struct xenUnifiedDriver xenXMDriver = {
|
||||||
.xenDomainPinVcpu = xenXMDomainPinVcpu,
|
|
||||||
.xenListDefinedDomains = xenXMListDefinedDomains,
|
.xenListDefinedDomains = xenXMListDefinedDomains,
|
||||||
.xenNumOfDefinedDomains = xenXMNumOfDefinedDomains,
|
.xenNumOfDefinedDomains = xenXMNumOfDefinedDomains,
|
||||||
.xenDomainCreate = xenXMDomainCreate,
|
.xenDomainCreate = xenXMDomainCreate,
|
||||||
@ -662,8 +661,7 @@ cleanup:
|
|||||||
*
|
*
|
||||||
* Change virtual CPUs allocation of domain according to flags.
|
* Change virtual CPUs allocation of domain according to flags.
|
||||||
*
|
*
|
||||||
* Returns 0 on success, -1 if an error message was issued, and -2 if
|
* Returns 0 on success, -1 if an error message was issued
|
||||||
* the unified driver should keep trying.
|
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
xenXMDomainSetVcpusFlags(virDomainPtr domain,
|
xenXMDomainSetVcpusFlags(virDomainPtr domain,
|
||||||
@ -680,8 +678,6 @@ xenXMDomainSetVcpusFlags(virDomainPtr domain,
|
|||||||
VIR_DOMAIN_VCPU_CONFIG |
|
VIR_DOMAIN_VCPU_CONFIG |
|
||||||
VIR_DOMAIN_VCPU_MAXIMUM, -1);
|
VIR_DOMAIN_VCPU_MAXIMUM, -1);
|
||||||
|
|
||||||
if (domain->id != -1)
|
|
||||||
return -2;
|
|
||||||
if (flags & VIR_DOMAIN_VCPU_LIVE) {
|
if (flags & VIR_DOMAIN_VCPU_LIVE) {
|
||||||
virReportError(VIR_ERR_OPERATION_INVALID, "%s",
|
virReportError(VIR_ERR_OPERATION_INVALID, "%s",
|
||||||
_("domain is not running"));
|
_("domain is not running"));
|
||||||
@ -741,7 +737,7 @@ cleanup:
|
|||||||
* Extract information about virtual CPUs of domain according to flags.
|
* Extract information about virtual CPUs of domain according to flags.
|
||||||
*
|
*
|
||||||
* Returns the number of vcpus on success, -1 if an error message was
|
* Returns the number of vcpus on success, -1 if an error message was
|
||||||
* issued, and -2 if the unified driver should keep trying.
|
* issued
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
xenXMDomainGetVcpusFlags(virDomainPtr domain, unsigned int flags)
|
xenXMDomainGetVcpusFlags(virDomainPtr domain, unsigned int flags)
|
||||||
@ -755,8 +751,6 @@ xenXMDomainGetVcpusFlags(virDomainPtr domain, unsigned int flags)
|
|||||||
VIR_DOMAIN_VCPU_CONFIG |
|
VIR_DOMAIN_VCPU_CONFIG |
|
||||||
VIR_DOMAIN_VCPU_MAXIMUM, -1);
|
VIR_DOMAIN_VCPU_MAXIMUM, -1);
|
||||||
|
|
||||||
if (domain->id != -1)
|
|
||||||
return -2;
|
|
||||||
if (flags & VIR_DOMAIN_VCPU_LIVE) {
|
if (flags & VIR_DOMAIN_VCPU_LIVE) {
|
||||||
virReportError(VIR_ERR_OPERATION_FAILED, "%s", _("domain not active"));
|
virReportError(VIR_ERR_OPERATION_FAILED, "%s", _("domain not active"));
|
||||||
return -1;
|
return -1;
|
||||||
@ -804,11 +798,6 @@ xenXMDomainPinVcpu(virDomainPtr domain,
|
|||||||
virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__);
|
virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (domain->id != -1) {
|
|
||||||
virReportError(VIR_ERR_INVALID_ARG,
|
|
||||||
"%s", _("not inactive domain"));
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
xenUnifiedLock(priv);
|
xenUnifiedLock(priv);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user