Remove use of XEND_CONFIG_VERSION_* in the Xen unified driver.
Signed-off-by: Jim Fehlig <jfehlig(a)suse.com>
---
src/xen/xen_driver.c | 284 +++++++++++----------------------------------------
1 file changed, 61 insertions(+), 223 deletions(-)
diff --git a/src/xen/xen_driver.c b/src/xen/xen_driver.c
index 321a250..27da520 100644
--- a/src/xen/xen_driver.c
+++ b/src/xen/xen_driver.c
@@ -109,16 +109,10 @@ static virDomainDefPtr xenGetDomainDefForID(virConnectPtr conn, int
id)
static virDomainDefPtr xenGetDomainDefForName(virConnectPtr conn, const char *name)
{
- xenUnifiedPrivatePtr priv = conn->privateData;
virDomainDefPtr ret;
ret = xenDaemonLookupByName(conn, name);
- /* Try XM for inactive domains. */
- if (!ret &&
- priv->xendConfigVersion <= XEND_CONFIG_VERSION_3_0_3)
- ret = xenXMDomainLookupByName(conn, name);
-
if (!ret && virGetLastError() == NULL)
virReportError(VIR_ERR_NO_DOMAIN, __FUNCTION__);
@@ -128,18 +122,13 @@ static virDomainDefPtr xenGetDomainDefForName(virConnectPtr conn,
const char *na
static virDomainDefPtr xenGetDomainDefForUUID(virConnectPtr conn, const unsigned char
*uuid)
{
- xenUnifiedPrivatePtr priv = conn->privateData;
virDomainDefPtr ret;
ret = xenHypervisorLookupDomainByUUID(conn, uuid);
- /* Try XM for inactive domains. */
- if (!ret) {
- if (priv->xendConfigVersion <= XEND_CONFIG_VERSION_3_0_3)
- ret = xenXMDomainLookupByUUID(conn, uuid);
- else
- ret = xenDaemonLookupByUUID(conn, uuid);
- }
+ /* Try xend for inactive domains. */
+ if (!ret)
+ ret = xenDaemonLookupByUUID(conn, uuid);
if (!ret && virGetLastError() == NULL)
virReportError(VIR_ERR_NO_DOMAIN, __FUNCTION__);
@@ -516,15 +505,6 @@ xenUnifiedConnectOpen(virConnectPtr conn, virConnectAuthPtr auth,
unsigned int f
VIR_DEBUG("Activated XenD sub-driver");
priv->opened[XEN_UNIFIED_XEND_OFFSET] = 1;
- /* For old XenD, the XM driver is required to succeed */
- if (priv->xendConfigVersion <= XEND_CONFIG_VERSION_3_0_3) {
- VIR_DEBUG("Trying XM sub-driver");
- if (xenXMOpen(conn, auth, flags) < 0)
- goto error;
- VIR_DEBUG("Activated XM sub-driver");
- priv->opened[XEN_UNIFIED_XM_OFFSET] = 1;
- }
-
VIR_DEBUG("Trying XS sub-driver");
if (xenStoreOpen(conn, auth, flags) < 0)
goto error;
@@ -1055,7 +1035,6 @@ xenUnifiedDomainDestroy(virDomainPtr dom)
static char *
xenUnifiedDomainGetOSType(virDomainPtr dom)
{
- xenUnifiedPrivatePtr priv = dom->conn->privateData;
char *ret = NULL;
virDomainDefPtr def;
@@ -1065,17 +1044,10 @@ xenUnifiedDomainGetOSType(virDomainPtr dom)
if (virDomainGetOSTypeEnsureACL(dom->conn, def) < 0)
goto cleanup;
- if (def->id < 0) {
- if (priv->xendConfigVersion < XEND_CONFIG_VERSION_3_0_4) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("Unable to query OS type for inactive domain"));
- return NULL;
- } else {
- ret = xenDaemonDomainGetOSType(dom->conn, def);
- }
- } else {
+ if (def->id < 0)
+ ret = xenDaemonDomainGetOSType(dom->conn, def);
+ else
ret = xenHypervisorDomainGetOSType(dom->conn, def);
- }
cleanup:
virDomainDefFree(def);
@@ -1086,7 +1058,6 @@ xenUnifiedDomainGetOSType(virDomainPtr dom)
static unsigned long long
xenUnifiedDomainGetMaxMemory(virDomainPtr dom)
{
- xenUnifiedPrivatePtr priv = dom->conn->privateData;
unsigned long long ret = 0;
virDomainDefPtr def;
@@ -1096,14 +1067,10 @@ xenUnifiedDomainGetMaxMemory(virDomainPtr dom)
if (virDomainGetMaxMemoryEnsureACL(dom->conn, def) < 0)
goto cleanup;
- if (def->id < 0) {
- if (priv->xendConfigVersion < XEND_CONFIG_VERSION_3_0_4)
- ret = xenXMDomainGetMaxMemory(dom->conn, def);
- else
- ret = xenDaemonDomainGetMaxMemory(dom->conn, def);
- } else {
+ if (def->id < 0)
+ ret = xenDaemonDomainGetMaxMemory(dom->conn, def);
+ else
ret = xenHypervisorGetMaxMemory(dom->conn, def);
- }
cleanup:
virDomainDefFree(def);
@@ -1113,7 +1080,6 @@ xenUnifiedDomainGetMaxMemory(virDomainPtr dom)
static int
xenUnifiedDomainSetMaxMemory(virDomainPtr dom, unsigned long memory)
{
- xenUnifiedPrivatePtr priv = dom->conn->privateData;
int ret = -1;
virDomainDefPtr def;
@@ -1123,14 +1089,10 @@ xenUnifiedDomainSetMaxMemory(virDomainPtr dom, unsigned long
memory)
if (virDomainSetMaxMemoryEnsureACL(dom->conn, def) < 0)
goto cleanup;
- if (def->id < 0) {
- if (priv->xendConfigVersion < XEND_CONFIG_VERSION_3_0_4)
- ret = xenXMDomainSetMaxMemory(dom->conn, def, memory);
- else
- ret = xenDaemonDomainSetMaxMemory(dom->conn, def, memory);
- } else {
+ if (def->id < 0)
+ ret = xenDaemonDomainSetMaxMemory(dom->conn, def, memory);
+ else
ret = xenHypervisorSetMaxMemory(dom->conn, def, memory);
- }
cleanup:
virDomainDefFree(def);
@@ -1140,7 +1102,6 @@ xenUnifiedDomainSetMaxMemory(virDomainPtr dom, unsigned long
memory)
static int
xenUnifiedDomainSetMemory(virDomainPtr dom, unsigned long memory)
{
- xenUnifiedPrivatePtr priv = dom->conn->privateData;
int ret = -1;
virDomainDefPtr def;
@@ -1150,10 +1111,7 @@ xenUnifiedDomainSetMemory(virDomainPtr dom, unsigned long memory)
if (virDomainSetMemoryEnsureACL(dom->conn, def) < 0)
goto cleanup;
- if (def->id < 0 && priv->xendConfigVersion <
XEND_CONFIG_VERSION_3_0_4)
- ret = xenXMDomainSetMemory(dom->conn, def, memory);
- else
- ret = xenDaemonDomainSetMemory(dom->conn, def, memory);
+ ret = xenDaemonDomainSetMemory(dom->conn, def, memory);
cleanup:
virDomainDefFree(def);
@@ -1163,7 +1121,6 @@ xenUnifiedDomainSetMemory(virDomainPtr dom, unsigned long memory)
static int
xenUnifiedDomainGetInfo(virDomainPtr dom, virDomainInfoPtr info)
{
- xenUnifiedPrivatePtr priv = dom->conn->privateData;
int ret = -1;
virDomainDefPtr def;
@@ -1173,14 +1130,10 @@ xenUnifiedDomainGetInfo(virDomainPtr dom, virDomainInfoPtr info)
if (virDomainGetInfoEnsureACL(dom->conn, def) < 0)
goto cleanup;
- if (def->id < 0) {
- if (priv->xendConfigVersion < XEND_CONFIG_VERSION_3_0_4)
- ret = xenXMDomainGetInfo(dom->conn, def, info);
- else
- ret = xenDaemonDomainGetInfo(dom->conn, def, info);
- } else {
+ if (def->id < 0)
+ ret = xenDaemonDomainGetInfo(dom->conn, def, info);
+ else
ret = xenHypervisorGetDomainInfo(dom->conn, def, info);
- }
cleanup:
virDomainDefFree(def);
@@ -1193,7 +1146,7 @@ xenUnifiedDomainGetState(virDomainPtr dom,
int *reason,
unsigned int flags)
{
- xenUnifiedPrivatePtr priv = dom->conn->privateData;
+
int ret = -1;
virDomainDefPtr def;
@@ -1205,14 +1158,10 @@ xenUnifiedDomainGetState(virDomainPtr dom,
if (virDomainGetStateEnsureACL(dom->conn, def) < 0)
goto cleanup;
- if (def->id < 0) {
- if (priv->xendConfigVersion < XEND_CONFIG_VERSION_3_0_4)
- ret = xenXMDomainGetState(dom->conn, def, state, reason);
- else
- ret = xenDaemonDomainGetState(dom->conn, def, state, reason);
- } else {
+ if (def->id < 0)
+ ret = xenDaemonDomainGetState(dom->conn, def, state, reason);
+ else
ret = xenHypervisorGetDomainState(dom->conn, def, state, reason);
- }
cleanup:
virDomainDefFree(def);
@@ -1391,7 +1340,6 @@ static int
xenUnifiedDomainSetVcpusFlags(virDomainPtr dom, unsigned int nvcpus,
unsigned int flags)
{
- xenUnifiedPrivatePtr priv = dom->conn->privateData;
virDomainDefPtr def = NULL;
int ret = -1;
@@ -1420,13 +1368,7 @@ xenUnifiedDomainSetVcpusFlags(virDomainPtr dom, unsigned int
nvcpus,
if (virDomainSetVcpusFlagsEnsureACL(dom->conn, def, flags) < 0)
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)
- ret = xenXMDomainSetVcpusFlags(dom->conn, def, nvcpus, flags);
- else
- ret = xenDaemonDomainSetVcpusFlags(dom->conn, def, nvcpus, flags);
+ ret = xenDaemonDomainSetVcpusFlags(dom->conn, def, nvcpus, flags);
cleanup:
virDomainDefFree(def);
@@ -1436,14 +1378,12 @@ xenUnifiedDomainSetVcpusFlags(virDomainPtr dom, unsigned int
nvcpus,
static int
xenUnifiedDomainSetVcpus(virDomainPtr dom, unsigned int nvcpus)
{
- xenUnifiedPrivatePtr priv = dom->conn->privateData;
- unsigned int flags = VIR_DOMAIN_VCPU_LIVE;
+ unsigned int flags;
/* Per the documented API, it is hypervisor-dependent whether this
- * affects just _LIVE or _LIVE|_CONFIG; in xen's case, that
- * depends on xendConfigVersion. */
- if (priv->xendConfigVersion >= XEND_CONFIG_VERSION_3_0_4)
- flags |= VIR_DOMAIN_VCPU_CONFIG;
+ * affects just _LIVE or _LIVE|_CONFIG; in xen's case, both are
+ * affected. */
+ flags = VIR_DOMAIN_VCPU_LIVE | VIR_DOMAIN_VCPU_CONFIG;
return xenUnifiedDomainSetVcpusFlags(dom, nvcpus, flags);
}
@@ -1452,7 +1392,6 @@ static int
xenUnifiedDomainPinVcpu(virDomainPtr dom, unsigned int vcpu,
unsigned char *cpumap, int maplen)
{
- xenUnifiedPrivatePtr priv = dom->conn->privateData;
virDomainDefPtr def = NULL;
int ret = -1;
@@ -1462,14 +1401,10 @@ xenUnifiedDomainPinVcpu(virDomainPtr dom, unsigned int vcpu,
if (virDomainPinVcpuEnsureACL(dom->conn, def) < 0)
goto cleanup;
- if (dom->id < 0) {
- if (priv->xendConfigVersion < XEND_CONFIG_VERSION_3_0_4)
- ret = xenXMDomainPinVcpu(dom->conn, def, vcpu, cpumap, maplen);
- else
- ret = xenDaemonDomainPinVcpu(dom->conn, def, vcpu, cpumap, maplen);
- } else {
+ if (dom->id < 0)
+ ret = xenDaemonDomainPinVcpu(dom->conn, def, vcpu, cpumap, maplen);
+ else
ret = xenHypervisorPinVcpu(dom->conn, def, vcpu, cpumap, maplen);
- }
cleanup:
virDomainDefFree(def);
@@ -1484,17 +1419,11 @@ xenUnifiedDomainGetVcpusInternal(virDomainPtr dom,
unsigned char *cpumaps,
int maplen)
{
- xenUnifiedPrivatePtr priv = dom->conn->privateData;
int ret = -1;
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"));
- } else {
- ret = xenDaemonDomainGetVcpus(dom->conn, def, info, maxinfo,
- cpumaps, maplen);
- }
+ ret = xenDaemonDomainGetVcpus(dom->conn, def, info, maxinfo,
+ cpumaps, maplen);
} else {
ret = xenHypervisorGetVcpus(dom->conn, def, info, maxinfo, cpumaps,
maplen);
@@ -1530,14 +1459,10 @@ xenUnifiedDomainGetVcpusFlagsInternal(virDomainPtr dom,
virDomainDefPtr def,
unsigned int flags)
{
- xenUnifiedPrivatePtr priv = dom->conn->privateData;
int ret = -1;
if (dom->id < 0) {
- if (priv->xendConfigVersion < XEND_CONFIG_VERSION_3_0_4)
- ret = xenXMDomainGetVcpusFlags(dom->conn, def, flags);
- else
- ret = xenDaemonDomainGetVcpusFlags(dom->conn, def, flags);
+ ret = xenDaemonDomainGetVcpusFlags(dom->conn, def, flags);
} else {
if (flags == (VIR_DOMAIN_VCPU_CONFIG | VIR_DOMAIN_VCPU_MAXIMUM))
ret = xenHypervisorGetVcpuMax(dom->conn, def);
@@ -1585,6 +1510,7 @@ xenUnifiedDomainGetXMLDesc(virDomainPtr dom, unsigned int flags)
virDomainDefPtr minidef = NULL;
virDomainDefPtr def = NULL;
char *ret = NULL;
+ char *cpus = NULL;
if (!(minidef = xenGetDomainDefForDom(dom)))
goto cleanup;
@@ -1592,22 +1518,17 @@ xenUnifiedDomainGetXMLDesc(virDomainPtr dom, unsigned int flags)
if (virDomainGetXMLDescEnsureACL(dom->conn, minidef, flags) < 0)
goto cleanup;
- if (dom->id < 0 && priv->xendConfigVersion <
XEND_CONFIG_VERSION_3_0_4) {
- def = xenXMDomainGetXMLDesc(dom->conn, minidef);
- } else {
- char *cpus;
- xenUnifiedLock(priv);
- cpus = xenDomainUsedCpus(dom, minidef);
- xenUnifiedUnlock(priv);
- def = xenDaemonDomainGetXMLDesc(dom->conn, minidef, cpus);
- VIR_FREE(cpus);
- }
+ xenUnifiedLock(priv);
+ cpus = xenDomainUsedCpus(dom, minidef);
+ xenUnifiedUnlock(priv);
+ def = xenDaemonDomainGetXMLDesc(dom->conn, minidef, cpus);
if (def)
ret = virDomainDefFormat(def,
virDomainDefFormatConvertXMLFlags(flags));
cleanup:
+ VIR_FREE(cpus);
virDomainDefFree(def);
virDomainDefFree(minidef);
return ret;
@@ -1776,7 +1697,6 @@ xenUnifiedDomainMigrateFinish(virConnectPtr dconn,
const char *uri ATTRIBUTE_UNUSED,
unsigned long flags)
{
- xenUnifiedPrivatePtr priv = dconn->privateData;
virDomainPtr ret = NULL;
virDomainDefPtr minidef = NULL;
virDomainDefPtr def = NULL;
@@ -1793,13 +1713,8 @@ xenUnifiedDomainMigrateFinish(virConnectPtr dconn,
if (!(def = xenDaemonDomainGetXMLDesc(dconn, minidef, NULL)))
goto cleanup;
- if (priv->xendConfigVersion < XEND_CONFIG_VERSION_3_0_4) {
- if (xenXMDomainDefineXML(dconn, def) < 0)
- goto cleanup;
- } else {
- if (xenDaemonDomainDefineXML(dconn, def) < 0)
- goto cleanup;
- }
+ if (xenDaemonDomainDefineXML(dconn, def) < 0)
+ goto cleanup;
}
ret = virGetDomain(dconn, minidef->name, minidef->uuid);
@@ -1816,31 +1731,19 @@ static int
xenUnifiedConnectListDefinedDomains(virConnectPtr conn, char **const names,
int maxnames)
{
- xenUnifiedPrivatePtr priv = conn->privateData;
-
if (virConnectListDefinedDomainsEnsureACL(conn) < 0)
return -1;
- if (priv->xendConfigVersion < XEND_CONFIG_VERSION_3_0_4) {
- return xenXMListDefinedDomains(conn, names, maxnames);
- } else {
- return xenDaemonListDefinedDomains(conn, names, maxnames);
- }
+ return xenDaemonListDefinedDomains(conn, names, maxnames);
}
static int
xenUnifiedConnectNumOfDefinedDomains(virConnectPtr conn)
{
- xenUnifiedPrivatePtr priv = conn->privateData;
-
if (virConnectNumOfDefinedDomainsEnsureACL(conn) < 0)
return -1;
- if (priv->xendConfigVersion < XEND_CONFIG_VERSION_3_0_4) {
- return xenXMNumOfDefinedDomains(conn);
- } else {
- return xenDaemonNumOfDefinedDomains(conn);
- }
+ return xenDaemonNumOfDefinedDomains(conn);
}
static int
@@ -1869,10 +1772,7 @@ xenUnifiedDomainCreateWithFlags(virDomainPtr dom, unsigned int
flags)
goto cleanup;
}
- if (priv->xendConfigVersion < XEND_CONFIG_VERSION_3_0_4)
- ret = xenXMDomainCreate(dom->conn, def);
- else
- ret = xenDaemonDomainCreate(dom->conn, def);
+ ret = xenDaemonDomainCreate(dom->conn, def);
if (ret >= 0)
dom->id = def->id;
@@ -1909,16 +1809,9 @@ xenUnifiedDomainDefineXMLFlags(virConnectPtr conn, const char *xml,
unsigned int
if (virDomainDefineXMLFlagsEnsureACL(conn, def) < 0)
goto cleanup;
- if (priv->xendConfigVersion < XEND_CONFIG_VERSION_3_0_4) {
- if (xenXMDomainDefineXML(conn, def) < 0)
- goto cleanup;
- ret = virGetDomain(conn, def->name, def->uuid);
- def = NULL; /* XM driver owns it now */
- } else {
- if (xenDaemonDomainDefineXML(conn, def) < 0)
- goto cleanup;
- ret = virGetDomain(conn, def->name, def->uuid);
- }
+ if (xenDaemonDomainDefineXML(conn, def) < 0)
+ goto cleanup;
+ ret = virGetDomain(conn, def->name, def->uuid);
if (ret)
ret->id = -1;
@@ -1937,7 +1830,6 @@ xenUnifiedDomainDefineXML(virConnectPtr conn, const char *xml)
static int
xenUnifiedDomainUndefineFlags(virDomainPtr dom, unsigned int flags)
{
- xenUnifiedPrivatePtr priv = dom->conn->privateData;
virDomainDefPtr def = NULL;
int ret = -1;
@@ -1949,10 +1841,7 @@ xenUnifiedDomainUndefineFlags(virDomainPtr dom, unsigned int
flags)
if (virDomainUndefineFlagsEnsureACL(dom->conn, def) < 0)
goto cleanup;
- if (priv->xendConfigVersion < XEND_CONFIG_VERSION_3_0_4)
- ret = xenXMDomainUndefine(dom->conn, def);
- else
- ret = xenDaemonDomainUndefine(dom->conn, def);
+ ret = xenDaemonDomainUndefine(dom->conn, def);
cleanup:
virDomainDefFree(def);
@@ -1968,7 +1857,6 @@ xenUnifiedDomainUndefine(virDomainPtr dom)
static int
xenUnifiedDomainAttachDevice(virDomainPtr dom, const char *xml)
{
- xenUnifiedPrivatePtr priv = dom->conn->privateData;
unsigned int flags = VIR_DOMAIN_DEVICE_MODIFY_LIVE;
virDomainDefPtr def = NULL;
int ret = -1;
@@ -1978,8 +1866,7 @@ xenUnifiedDomainAttachDevice(virDomainPtr dom, const char *xml)
* config without touching persistent config, we add the extra flag here
* to make this API work
*/
- if (priv->xendConfigVersion >= XEND_CONFIG_VERSION_3_0_4)
- flags |= VIR_DOMAIN_DEVICE_MODIFY_CONFIG;
+ flags |= VIR_DOMAIN_DEVICE_MODIFY_CONFIG;
if (!(def = xenGetDomainDefForDom(dom)))
goto cleanup;
@@ -1987,10 +1874,7 @@ xenUnifiedDomainAttachDevice(virDomainPtr dom, const char *xml)
if (virDomainAttachDeviceEnsureACL(dom->conn, def) < 0)
goto cleanup;
- if (dom->id < 0 && priv->xendConfigVersion <
XEND_CONFIG_VERSION_3_0_4)
- ret = xenXMDomainAttachDeviceFlags(dom->conn, def, xml, flags);
- else
- ret = xenDaemonAttachDeviceFlags(dom->conn, def, xml, flags);
+ ret = xenDaemonAttachDeviceFlags(dom->conn, def, xml, flags);
cleanup:
virDomainDefFree(def);
@@ -2001,7 +1885,6 @@ static int
xenUnifiedDomainAttachDeviceFlags(virDomainPtr dom, const char *xml,
unsigned int flags)
{
- xenUnifiedPrivatePtr priv = dom->conn->privateData;
virDomainDefPtr def = NULL;
int ret = -1;
@@ -2011,10 +1894,7 @@ xenUnifiedDomainAttachDeviceFlags(virDomainPtr dom, const char
*xml,
if (virDomainAttachDeviceFlagsEnsureACL(dom->conn, def, flags) < 0)
goto cleanup;
- if (dom->id < 0 && priv->xendConfigVersion <
XEND_CONFIG_VERSION_3_0_4)
- ret = xenXMDomainAttachDeviceFlags(dom->conn, def, xml, flags);
- else
- ret = xenDaemonAttachDeviceFlags(dom->conn, def, xml, flags);
+ ret = xenDaemonAttachDeviceFlags(dom->conn, def, xml, flags);
cleanup:
virDomainDefFree(def);
@@ -2024,7 +1904,6 @@ xenUnifiedDomainAttachDeviceFlags(virDomainPtr dom, const char
*xml,
static int
xenUnifiedDomainDetachDevice(virDomainPtr dom, const char *xml)
{
- xenUnifiedPrivatePtr priv = dom->conn->privateData;
unsigned int flags = VIR_DOMAIN_DEVICE_MODIFY_LIVE;
virDomainDefPtr def = NULL;
int ret = -1;
@@ -2034,8 +1913,7 @@ xenUnifiedDomainDetachDevice(virDomainPtr dom, const char *xml)
* config without touching persistent config, we add the extra flag here
* to make this API work
*/
- if (priv->xendConfigVersion >= XEND_CONFIG_VERSION_3_0_4)
- flags |= VIR_DOMAIN_DEVICE_MODIFY_CONFIG;
+ flags |= VIR_DOMAIN_DEVICE_MODIFY_CONFIG;
if (!(def = xenGetDomainDefForDom(dom)))
goto cleanup;
@@ -2043,10 +1921,7 @@ xenUnifiedDomainDetachDevice(virDomainPtr dom, const char *xml)
if (virDomainDetachDeviceEnsureACL(dom->conn, def) < 0)
goto cleanup;
- if (dom->id < 0 && priv->xendConfigVersion <
XEND_CONFIG_VERSION_3_0_4)
- ret = xenXMDomainDetachDeviceFlags(dom->conn, def, xml, flags);
- else
- ret = xenDaemonDetachDeviceFlags(dom->conn, def, xml, flags);
+ ret = xenDaemonDetachDeviceFlags(dom->conn, def, xml, flags);
cleanup:
virDomainDefFree(def);
@@ -2057,7 +1932,6 @@ static int
xenUnifiedDomainDetachDeviceFlags(virDomainPtr dom, const char *xml,
unsigned int flags)
{
- xenUnifiedPrivatePtr priv = dom->conn->privateData;
virDomainDefPtr def = NULL;
int ret = -1;
@@ -2067,10 +1941,7 @@ xenUnifiedDomainDetachDeviceFlags(virDomainPtr dom, const char
*xml,
if (virDomainDetachDeviceFlagsEnsureACL(dom->conn, def, flags) < 0)
goto cleanup;
- if (dom->id < 0 && priv->xendConfigVersion <
XEND_CONFIG_VERSION_3_0_4)
- ret = xenXMDomainDetachDeviceFlags(dom->conn, def, xml, flags);
- else
- ret = xenDaemonDetachDeviceFlags(dom->conn, def, xml, flags);
+ ret = xenDaemonDetachDeviceFlags(dom->conn, def, xml, flags);
cleanup:
virDomainDefFree(def);
@@ -2100,7 +1971,6 @@ xenUnifiedDomainUpdateDeviceFlags(virDomainPtr dom, const char
*xml,
static int
xenUnifiedDomainGetAutostart(virDomainPtr dom, int *autostart)
{
- xenUnifiedPrivatePtr priv = dom->conn->privateData;
virDomainDefPtr def = NULL;
int ret = -1;
@@ -2110,10 +1980,7 @@ xenUnifiedDomainGetAutostart(virDomainPtr dom, int *autostart)
if (virDomainGetAutostartEnsureACL(dom->conn, def) < 0)
goto cleanup;
- if (priv->xendConfigVersion < XEND_CONFIG_VERSION_3_0_4)
- ret = xenXMDomainGetAutostart(def, autostart);
- else
- ret = xenDaemonDomainGetAutostart(dom->conn, def, autostart);
+ ret = xenDaemonDomainGetAutostart(dom->conn, def, autostart);
cleanup:
virDomainDefFree(def);
@@ -2123,7 +1990,6 @@ xenUnifiedDomainGetAutostart(virDomainPtr dom, int *autostart)
static int
xenUnifiedDomainSetAutostart(virDomainPtr dom, int autostart)
{
- xenUnifiedPrivatePtr priv = dom->conn->privateData;
virDomainDefPtr def = NULL;
int ret = -1;
@@ -2133,10 +1999,7 @@ xenUnifiedDomainSetAutostart(virDomainPtr dom, int autostart)
if (virDomainSetAutostartEnsureACL(dom->conn, def) < 0)
goto cleanup;
- if (priv->xendConfigVersion < XEND_CONFIG_VERSION_3_0_4)
- ret = xenXMDomainSetAutostart(def, autostart);
- else
- ret = xenDaemonDomainSetAutostart(dom->conn, def, autostart);
+ ret = xenDaemonDomainSetAutostart(dom->conn, def, autostart);
cleanup:
virDomainDefFree(def);
@@ -2146,7 +2009,6 @@ xenUnifiedDomainSetAutostart(virDomainPtr dom, int autostart)
static char *
xenUnifiedDomainGetSchedulerType(virDomainPtr dom, int *nparams)
{
- xenUnifiedPrivatePtr priv = dom->conn->privateData;
virDomainDefPtr def = NULL;
char *ret = NULL;
@@ -2156,16 +2018,10 @@ xenUnifiedDomainGetSchedulerType(virDomainPtr dom, int *nparams)
if (virDomainGetSchedulerTypeEnsureACL(dom->conn, def) < 0)
goto cleanup;
- if (dom->id < 0) {
- if (priv->xendConfigVersion < XEND_CONFIG_VERSION_3_0_4) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("Cannot change scheduler parameters"));
- goto cleanup;
- }
+ if (dom->id < 0)
ret = xenDaemonGetSchedulerType(dom->conn, nparams);
- } else {
+ else
ret = xenHypervisorGetSchedulerType(dom->conn, nparams);
- }
cleanup:
virDomainDefFree(def);
@@ -2178,7 +2034,6 @@ xenUnifiedDomainGetSchedulerParametersFlags(virDomainPtr dom,
int *nparams,
unsigned int flags)
{
- xenUnifiedPrivatePtr priv = dom->conn->privateData;
virDomainDefPtr def = NULL;
int ret = -1;
@@ -2190,16 +2045,10 @@ xenUnifiedDomainGetSchedulerParametersFlags(virDomainPtr dom,
if (virDomainGetSchedulerParametersFlagsEnsureACL(dom->conn, def) < 0)
goto cleanup;
- if (dom->id < 0) {
- if (priv->xendConfigVersion < XEND_CONFIG_VERSION_3_0_4) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("Cannot change scheduler parameters"));
- goto cleanup;
- }
+ if (dom->id < 0)
ret = xenDaemonGetSchedulerParameters(dom->conn, def, params, nparams);
- } else {
+ else
ret = xenHypervisorGetSchedulerParameters(dom->conn, def, params, nparams);
- }
cleanup:
virDomainDefFree(def);
@@ -2221,7 +2070,6 @@ xenUnifiedDomainSetSchedulerParametersFlags(virDomainPtr dom,
int nparams,
unsigned int flags)
{
- xenUnifiedPrivatePtr priv = dom->conn->privateData;
virDomainDefPtr def = NULL;
int ret = -1;
@@ -2233,16 +2081,10 @@ xenUnifiedDomainSetSchedulerParametersFlags(virDomainPtr dom,
if (virDomainSetSchedulerParametersFlagsEnsureACL(dom->conn, def, flags) < 0)
goto cleanup;
- if (dom->id < 0) {
- if (priv->xendConfigVersion < XEND_CONFIG_VERSION_3_0_4) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("Cannot change scheduler parameters"));
- goto cleanup;
- }
+ if (dom->id < 0)
ret = xenDaemonSetSchedulerParameters(dom->conn, def, params, nparams);
- } else {
+ else
ret = xenHypervisorSetSchedulerParameters(dom->conn, def, params, nparams);
- }
cleanup:
virDomainDefFree(def);
@@ -2303,7 +2145,6 @@ xenUnifiedDomainBlockPeek(virDomainPtr dom, const char *path,
unsigned long long offset, size_t size,
void *buffer, unsigned int flags)
{
- xenUnifiedPrivatePtr priv = dom->conn->privateData;
virDomainDefPtr def = NULL;
int ret = -1;
@@ -2315,10 +2156,7 @@ xenUnifiedDomainBlockPeek(virDomainPtr dom, const char *path,
if (virDomainBlockPeekEnsureACL(dom->conn, def) < 0)
goto cleanup;
- if (dom->id < 0 && priv->xendConfigVersion <
XEND_CONFIG_VERSION_3_0_4)
- ret = xenXMDomainBlockPeek(dom->conn, def, path, offset, size, buffer);
- else
- ret = xenDaemonDomainBlockPeek(dom->conn, def, path, offset, size, buffer);
+ ret = xenDaemonDomainBlockPeek(dom->conn, def, path, offset, size, buffer);
cleanup:
virDomainDefFree(def);
--
2.1.4