---
src/conf/domain_conf.c | 24 +---
src/conf/domain_conf.h |3 +--
src/lxc/lxc_controller.c | 14 ++
src/parallels/parallels_driver.c |3 +--
src/qemu/qemu_process.c | 12 +---
src/test/test_driver.c |5 -
src/vmx/vmx.c| 36 ++--
tests/cpuset |2 +-
8 files changed, 45 insertions(+), 54 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index cc54d39..6ecec54 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -8394,14 +8394,12 @@ static virDomainDefPtr virDomainDefParseXML(virCapsPtr
caps,
if (def-placement_mode != VIR_DOMAIN_CPU_PLACEMENT_MODE_AUTO) {
tmp = virXPathString(string(./vcpu[1]/@cpuset), ctxt);
if (tmp) {
-char *set = tmp;
-def-cpumasklen = VIR_DOMAIN_CPUMASK_LEN;
-if (VIR_ALLOC_N(def-cpumask, def-cpumasklen) 0) {
-goto no_memory;
-}
-if (virDomainCpuSetParse(set, 0, def-cpumask,
- def-cpumasklen) 0)
+if (virBitmapParse(tmp, 0, def-cpumask,
+ VIR_DOMAIN_CPUMASK_LEN) 0) {
+virReportError(VIR_ERR_XML_ERROR,
+ %s, _(topology cpuset syntax error));
goto error;
+}
VIR_FREE(tmp);
}
}
@@ -13011,7 +13009,7 @@ virDomainDefFormatInternal(virDomainDefPtr def,
unsigned char *uuid;
char uuidstr[VIR_UUID_STRING_BUFLEN];
const char *type = NULL;
-int n, allones = 1;
+int n;
int i;
bool blkio = false;
@@ -13140,17 +13138,13 @@ virDomainDefFormatInternal(virDomainDefPtr def,
/memoryBacking\n, NULL);
}
-for (n = 0 ; n def-cpumasklen ; n++)
-if (def-cpumask[n] != 1)
-allones = 0;
-
virBufferAddLit(buf, vcpu);
virBufferAsprintf(buf, placement='%s',
virDomainCpuPlacementModeTypeToString(def-placement_mode));
-if (!allones) {
+
+if (def-cpumask !virBitmapIsAllSet(def-cpumask)) {
char *cpumask = NULL;
-if ((cpumask =
- virDomainCpuSetFormat(def-cpumask, def-cpumasklen)) == NULL)
+if ((cpumask = virBitmapFormat(def-cpumask)) == NULL)
goto cleanup;
virBufferAsprintf(buf, cpuset='%s', cpumask);
VIR_FREE(cpumask);
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 975c565..042b518 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -1614,8 +1614,7 @@ struct _virDomainDef {
unsigned short vcpus;
unsigned short maxvcpus;
int placement_mode;
-int cpumasklen;
-char *cpumask;
+virBitmapPtr cpumask;
struct {
unsigned long shares;
diff --git a/src/lxc/lxc_controller.c b/src/lxc/lxc_controller.c
index 44ec7aa..7e98006 100644
--- a/src/lxc/lxc_controller.c
+++ b/src/lxc/lxc_controller.c
@@ -490,9 +490,9 @@ static int
virLXCControllerSetupNUMAPolicy(virLXCControllerPtr ctrl)
*/
static int virLXCControllerSetupCpuAffinity(virLXCControllerPtr ctrl)
{
-int i, hostcpus, maxcpu = CPU_SETSIZE;
+int hostcpus, maxcpu = CPU_SETSIZE;
virNodeInfo nodeinfo;
-virBitmapPtr cpumap;
+virBitmapPtr cpumap, cpumapToSet;
VIR_DEBUG(Setting CPU affinity);
@@ -509,12 +509,10 @@ static int
virLXCControllerSetupCpuAffinity(virLXCControllerPtr ctrl)
if (!cpumap)
return -1;
+cpumapToSet = cpumap;
+
if (ctrl-def-cpumask) {
-/* XXX why don't we keep 'cpumask' in the libvirt cpumap
- * format to start with ?!?! */
-for (i = 0 ; i maxcpu i ctrl-def-cpumasklen ; i++)
-if (ctrl-def-cpumask[i])
-ignore_value(virBitmapSetBit(cpumap, i));
+cpumapToSet = ctrl-def-cpumask;
} else {
/* You may think this is redundant, but we can't assume libvirtd
* itself is running on all pCPUs, so we need to explicitly set
@@ -527,7 +525,7 @@ static int
virLXCControllerSetupCpuAffinity(virLXCControllerPtr ctrl)
* so use '0' to indicate our own process ID. No threads are
* running at this point
*/
-if (virProcessInfoSetAffinity(0 /* Self */, cpumap) 0) {
+if (virProcessInfoSetAffinity(0 /* Self */, cpumapToSet) 0) {
virBitmapFree(cpumap);
return -1;
}
diff --git a/src/parallels/parallels_driver.c b/src/parallels/parallels_driver.c
index cf9f6ab..46efe14 100644
--- a/src/parallels/parallels_driver.c
+++ b/src/parallels/parallels_driver.c
@@ -1407,8 +1407,7 @@ parallelsApplyChanges(virDomainObjPtr dom,
virDomainDefPtr new)
return -1;
}
-if (old-cpumasklen != new-cpumasklen ||
-(memcmp(old-cpumask, new-cpumask, old-cpumasklen))) {
+if (!virBitmapEqual(old-cpumask,