Rebase libvirt to version 6.2.0

Signed-off-by: Xu Yandong <xuyandong2@huawei.com>
This commit is contained in:
Xu Yandong 2020-05-11 17:34:46 +08:00
parent 838527c759
commit 89e3c1a340
50 changed files with 214 additions and 4188 deletions

View File

@ -1,81 +0,0 @@
From c27fda8374562a9b6061e18f8c9ba78ae9df2c08 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A1n=20Tomko?= <jtomko@redhat.com>
Date: Fri, 12 Jul 2019 16:13:17 +0200
Subject: [PATCH] Revert "conf: Remove volOptions for VIR_STORAGE_POOL_RBD"
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
This reverts commit 035db37394ad11a39d47f8bd2b6a8a2734283cbf
Even though we only allow using RBD with raw volumes,
removing the options and the default format causes our
parser not to fill out the volume format and the backend code
rejects creating a non-raw volume.
Re-introduce the volume options to fix volume creation while
erroring out on requests to use non-raw formats.
https://bugzilla.redhat.com/show_bug.cgi?id=1724065
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
(cherry-picked from commit 5d74619329a2063efc8028536b3f8acc8e949f88)
Signed-off-by: Xu Yandong <xuyandong2@huawei.com>
---
src/conf/storage_conf.c | 5 +++++
tests/storagepoolcapsschemadata/poolcaps-fs.xml | 5 +++++
tests/storagepoolcapsschemadata/poolcaps-full.xml | 5 +++++
3 files changed, 15 insertions(+)
diff --git a/src/conf/storage_conf.c b/src/conf/storage_conf.c
index 397bd66..05055cd 100644
--- a/src/conf/storage_conf.c
+++ b/src/conf/storage_conf.c
@@ -241,6 +241,11 @@ static virStoragePoolTypeInfo poolTypeInfo[] = {
VIR_STORAGE_POOL_SOURCE_NETWORK |
VIR_STORAGE_POOL_SOURCE_NAME),
},
+ .volOptions = {
+ .defaultFormat = VIR_STORAGE_FILE_RAW,
+ .formatFromString = virStorageVolumeFormatFromString,
+ .formatToString = virStorageFileFormatTypeToString,
+ }
},
{.poolType = VIR_STORAGE_POOL_SHEEPDOG,
.poolOptions = {
diff --git a/tests/storagepoolcapsschemadata/poolcaps-fs.xml b/tests/storagepoolcapsschemadata/poolcaps-fs.xml
index 6513ea6..182fa39 100644
--- a/tests/storagepoolcapsschemadata/poolcaps-fs.xml
+++ b/tests/storagepoolcapsschemadata/poolcaps-fs.xml
@@ -145,6 +145,11 @@
<pool type='mpath' supported='no'>
</pool>
<pool type='rbd' supported='no'>
+ <volOptions>
+ <defaultFormat type='raw'/>
+ <enum name='targetFormatType'>
+ </enum>
+ </volOptions>
</pool>
<pool type='sheepdog' supported='no'>
</pool>
diff --git a/tests/storagepoolcapsschemadata/poolcaps-full.xml b/tests/storagepoolcapsschemadata/poolcaps-full.xml
index 32003dd..980c6d2 100644
--- a/tests/storagepoolcapsschemadata/poolcaps-full.xml
+++ b/tests/storagepoolcapsschemadata/poolcaps-full.xml
@@ -145,6 +145,11 @@
<pool type='mpath' supported='yes'>
</pool>
<pool type='rbd' supported='yes'>
+ <volOptions>
+ <defaultFormat type='raw'/>
+ <enum name='targetFormatType'>
+ </enum>
+ </volOptions>
</pool>
<pool type='sheepdog' supported='yes'>
</pool>
--
2.19.1

View File

@ -1,58 +0,0 @@
From b6c2dcd8e18e218cd352c92651e3314f13bef6c7 Mon Sep 17 00:00:00 2001
From: Laine Stump <laine@redhat.com>
Date: Thu, 15 Aug 2019 16:34:21 -0400
Subject: [PATCH] access: fix incorrect addition to virAccessPermNetwork
Commit e69444e17 (first appeared in libvirt-5.5.0) added the new value
"VIR_ACCESS_PERM_NETWORK_SEARCH_PORTS" to the virAccessPerNetwork
enum, and also the string "search_ports" to the VIR_ENUM_IMPL() macro
for that enum. Unfortunately, the enum value was added in the middle
of the list, while the string was added to the end of the
VIR_ENUM_IMPL().
This patch corrects that error by moving the new value to the end of
the enum definition, so that the order matches that of the string
list.
Resolves: https://bugzilla.redhat.com/1741428
Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
(cherry-picked from commit 8d6eaf5e099dab8400aa76bcc9a0ac74ff6f46e1)
Signed-off-by: Xu Yandong <xuyandong2@huawei.com>
---
src/access/viraccessperm.h | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/src/access/viraccessperm.h b/src/access/viraccessperm.h
index d4b9c69..52905e5 100644
--- a/src/access/viraccessperm.h
+++ b/src/access/viraccessperm.h
@@ -404,18 +404,18 @@ typedef enum {
*/
VIR_ACCESS_PERM_NETWORK_START,
- /**
- * @desc: List network ports
- * @message: Listing network ports requires authorization
- */
- VIR_ACCESS_PERM_NETWORK_SEARCH_PORTS,
-
/**
* @desc: Stop network
* @message: Stopping network requires authorization
*/
VIR_ACCESS_PERM_NETWORK_STOP,
+ /**
+ * @desc: List network ports
+ * @message: Listing network ports requires authorization
+ */
+ VIR_ACCESS_PERM_NETWORK_SEARCH_PORTS,
+
VIR_ACCESS_PERM_NETWORK_LAST
} virAccessPermNetwork;
--
2.21.0

View File

@ -1,35 +0,0 @@
From 52aa54af3b65069d9abaebf943ff19fb6c4d3037 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= <berrange@redhat.com>
Date: Mon, 30 Sep 2019 16:56:33 +0100
Subject: [PATCH] admin: fix memory leak of typed parameters getting client
info
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
In the error code path, the temporary parameters are not freed.
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
(cherry-picked from commit c76dc0ea39b4cbddaf9be22d50d13c4f529d6e2e)
Signed-off-by: Xu Yandong <xuyandong2@huawei.com>
---
src/admin/admin_server.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/admin/admin_server.c b/src/admin/admin_server.c
index f2a38f6..ebf940d 100644
--- a/src/admin/admin_server.c
+++ b/src/admin/admin_server.c
@@ -296,6 +296,8 @@ adminClientGetInfo(virNetServerClientPtr client,
ret = 0;
cleanup:
+ if (tmpparams)
+ virTypedParamsFree(tmpparams, *nparams);
virObjectUnref(identity);
VIR_FREE(sock_addr);
return ret;
--
2.21.0

View File

@ -1,35 +0,0 @@
From d5ac07dee8c9337878ed0085e940c86d3f2ade0b Mon Sep 17 00:00:00 2001
From: Xu Yandong <xuyandong2@huawei.com>
Date: Thu, 25 Jul 2019 16:47:50 +0800
Subject: [PATCH] cgroup: cleanup eventParams when virTypedParamsAddULLong
failed
Function virTypedParamsAddULLong use realloc to gain memory,
and doesn't free it when failed. so we need free eventParams to
prevent a memory leak.
Signed-off-by: Xu Yandong <xuyandong2@huawei.com>
---
src/qemu/qemu_cgroup.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/src/qemu/qemu_cgroup.c b/src/qemu/qemu_cgroup.c
index ca76c4f..8a00703 100644
--- a/src/qemu/qemu_cgroup.c
+++ b/src/qemu/qemu_cgroup.c
@@ -870,8 +870,11 @@ qemuSetupCpuCgroup(virDomainObjPtr vm)
if (virTypedParamsAddULLong(&eventParams, &eventNparams,
&eventMaxparams,
VIR_DOMAIN_TUNABLE_CPU_CPU_SHARES,
- val) < 0)
+ val) < 0) {
+ if (eventParams)
+ virTypedParamsFree(eventParams, eventNparams);
return -1;
+ }
event = virDomainEventTunableNewFromObj(vm, eventParams, eventNparams);
}
--
2.19.1

View File

@ -1,30 +0,0 @@
From 62c8b7f6afec8f8a51d5f2d6a33b9ac5cd0b2988 Mon Sep 17 00:00:00 2001
From: Xu Yandong <xuyandong2@huawei.com>
Date: Wed, 14 Aug 2019 10:03:39 +0800
Subject: [PATCH] conf: Avoid double free when prase device xml failed
This patch fixes a possible double free. In virDomainDeviceDefParse()
if parse xml failes, then call virDomainDeviceDefFree() free dev, but
does not assign dev to NULL, so will return a not NULL pointer already
freeed.
Signed-off-by: Xu Yandong <xuyandong2@huawei.com>
---
src/conf/domain_conf.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index ac9bdc0..92b7b4a 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -16424,6 +16424,7 @@ virDomainDeviceDefParse(const char *xmlStr,
error:
virDomainDeviceDefFree(dev);
+ dev = NULL;
goto cleanup;
}
--
2.19.1

View File

@ -1,32 +0,0 @@
From 662ca668ba205216fe908eb5ab1816842625b83e Mon Sep 17 00:00:00 2001
From: Feng Ni <fengni@huawei.com>
Date: Thu, 25 Jul 2019 20:19:35 +0800
Subject: [PATCH] conf: fix memory leak in virNodeDevPCICapSRIOVVirtualParseXML
In function virNodeDevPCICapSRIOVVirtualParseXML, temp variable
addr could leak if VIR_APPEND_ELEMENT fails .
Signed-off-by: Feng Ni <fengni@huawei.com>
---
src/conf/node_device_conf.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/conf/node_device_conf.c b/src/conf/node_device_conf.c
index 0c804f5..1a8351e 100644
--- a/src/conf/node_device_conf.c
+++ b/src/conf/node_device_conf.c
@@ -1519,8 +1519,10 @@ virNodeDevPCICapSRIOVVirtualParseXML(xmlXPathContextPtr ctxt,
if (VIR_APPEND_ELEMENT(pci_dev->virtual_functions,
pci_dev->num_virtual_functions,
- addr) < 0)
+ addr) < 0) {
+ VIR_FREE(addr);
goto cleanup;
+ }
}
pci_dev->flags |= VIR_NODE_DEV_CAP_FLAG_PCI_VIRTUAL_FUNCTION;
--
2.19.1

View File

@ -1,28 +0,0 @@
From bf5ba702bb7cbd362a2dc6b278e083e7e475dcff Mon Sep 17 00:00:00 2001
From: Feng Ni <fengni@huawei.com>
Date: Thu, 25 Jul 2019 20:13:09 +0800
Subject: [PATCH] conf: fix memory leak in virNodeDeviceGetPCISRIOVCaps
Use API nodeDeviceLookupByName query FPGA device info,
pointer physical_function should be released.
Signed-off-by: Feng Ni <fengni@huawei.com>
---
src/conf/node_device_conf.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/conf/node_device_conf.c b/src/conf/node_device_conf.c
index 4ef92d5..0c804f5 100644
--- a/src/conf/node_device_conf.c
+++ b/src/conf/node_device_conf.c
@@ -2509,6 +2509,7 @@ virNodeDeviceGetPCISRIOVCaps(const char *sysfsPath,
for (i = 0; i < pci_dev->num_virtual_functions; i++)
VIR_FREE(pci_dev->virtual_functions[i]);
VIR_FREE(pci_dev->virtual_functions);
+ VIR_FREE(pci_dev->physical_function);
pci_dev->num_virtual_functions = 0;
pci_dev->max_virtual_functions = 0;
pci_dev->flags &= ~VIR_NODE_DEV_CAP_FLAG_PCI_VIRTUAL_FUNCTION;
--
2.19.1

View File

@ -1,29 +0,0 @@
From c46e864f40ce35f0b67543990b46dc0731121f9d Mon Sep 17 00:00:00 2001
From: Feng Ni <fengni@huawei.com>
Date: Thu, 25 Jul 2019 20:03:22 +0800
Subject: [PATCH] conf: use virDomainDeviceDefFree free dev
In function virDomainDeviceDefParse, we shoud use virDomainDeviceDefFree
free data structure avoid potential memory leak.
Signed-off-by: Feng Ni <fengni@huawei.com>
---
src/conf/domain_conf.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 3323c9a..ac9bdc0 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -16423,7 +16423,7 @@ virDomainDeviceDefParse(const char *xmlStr,
return dev;
error:
- VIR_FREE(dev);
+ virDomainDeviceDefFree(dev);
goto cleanup;
}
--
2.19.1

View File

@ -1,41 +0,0 @@
From bed928dada1ed8fe50dd4792d7b201df29016c12 Mon Sep 17 00:00:00 2001
From: Xu Yandong <xuyandong2@huawei.com>
Date: Fri, 6 Sep 2019 12:30:15 +0800
Subject: [PATCH] cpu: Introduce mock checkFeature method for ARM CPUS
Introduce mock checkFeature method for ARM to avoid
runtime error messages.
Signed-off-by: Xu Yandong <xuyandong2@huawei.com>
---
src/cpu/cpu_arm.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/src/cpu/cpu_arm.c b/src/cpu/cpu_arm.c
index b3bc379..5733ddc 100644
--- a/src/cpu/cpu_arm.c
+++ b/src/cpu/cpu_arm.c
@@ -1009,6 +1009,14 @@ virCPUarmCompare(virCPUDefPtr host,
}
+static int
+virCPUarmCheckFeature(const virCPUDef *cpu ATTRIBUTE_UNUSED,
+ const char *name ATTRIBUTE_UNUSED)
+{
+ return -1;
+}
+
+
struct cpuArchDriver cpuDriverArm = {
.name = "arm",
.arch = archs,
@@ -1020,4 +1028,5 @@ struct cpuArchDriver cpuDriverArm = {
.getHost = virCPUarmGetHost,
.baseline = virCPUarmBaseline,
.update = virCPUarmUpdate,
+ .checkFeature = virCPUarmCheckFeature,
};
--
2.19.1

View File

@ -1,133 +0,0 @@
From 4c3a9684e7fccef83158a4a2f74680c6d8e166f7 Mon Sep 17 00:00:00 2001
From: Xu Yandong <xuyandong2@huawei.com>
Date: Fri, 6 Sep 2019 10:56:39 +0800
Subject: [PATCH] cpu: add getHostCPU for ARM CPUS
support vendor and model for virConnectGetCapabilities in ARM,
introduce getHost frame for arm
Signed-off-by: Xu Yandong <xuyandong2@huawei.com>
---
src/cpu/cpu_arm.c | 92 +++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 92 insertions(+)
diff --git a/src/cpu/cpu_arm.c b/src/cpu/cpu_arm.c
index b4c41c5..b3bc379 100644
--- a/src/cpu/cpu_arm.c
+++ b/src/cpu/cpu_arm.c
@@ -532,6 +532,74 @@ armMakeCPUData(virArch arch,
}
+
+static int
+armCpuDataFromCpuInfo(virCPUarmData *data)
+{
+ int ret = -1;
+ char *eol = NULL;
+ char *str_vendor = NULL;
+ char *str_pvr = NULL;
+ char *outbuf = NULL;
+ const char *cur;
+
+ if (!data)
+ return ret;
+
+ if (virFileReadAll(CPUINFO, CPUINFO_FILE_LEN, &outbuf) < 0) {
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Failed to open %s"), CPUINFO);
+ goto cleanup;
+ }
+
+ if ((cur = strstr(outbuf, "CPU implementer")) == NULL) {
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("there is no \"CPU implementer\" info in %s"), CPUINFO);
+ goto cleanup;
+ }
+
+ /* Account for format 'CPU implementer : XXXX'*/
+ cur = strchr(cur, ':') + 1;
+ eol = strchr(cur, '\n');
+ virSkipSpaces(&cur);
+ if (!eol || VIR_STRNDUP(str_vendor, cur, eol - cur) < 0 ||
+ virStrToLong_ul(str_vendor, NULL, 16, &data->vendor_id) < 0)
+ goto cleanup;
+
+ if ((cur = strstr(outbuf, "CPU part")) == NULL) {
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("there is no \"CPU part\" info in %s"), CPUINFO);
+ goto cleanup;
+ }
+
+ cur = strchr(cur, ':') + 1;
+ eol = strchr(cur, '\n');
+ virSkipSpaces(&cur);
+ if (!eol || VIR_STRNDUP(str_pvr, cur, eol - cur) < 0 ||
+ virStrToLong_ul(str_pvr, NULL, 16, &data->pvr) < 0)
+ goto cleanup;
+
+ if ((cur = strstr(outbuf, "Features")) == NULL) {
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("there is no \"Features\" info in %s"), CPUINFO);
+ goto cleanup;
+ }
+ cur = strchr(cur, ':') + 1;
+ eol = strchr(cur, '\n');
+ virSkipSpaces(&cur);
+ if (eol && VIR_STRNDUP(data->features, cur, eol - cur) < 0)
+ goto cleanup;
+
+ ret = 0;
+
+ cleanup:
+ VIR_FREE(outbuf);
+ VIR_FREE(str_vendor);
+ VIR_FREE(str_pvr);
+ return ret;
+}
+
+
static int
armCpuDataParseFeatures(virCPUDefPtr cpu,
const virCPUarmData *cpuData)
@@ -628,6 +696,29 @@ armDecodeCPUData(virCPUDefPtr cpu,
return armDecode(cpu, &data->data.arm, models);
}
+static int
+virCPUarmGetHost(virCPUDefPtr cpu,
+ virDomainCapsCPUModelsPtr models)
+{
+ virCPUDataPtr cpuData = NULL;
+ int ret = -1;
+
+ if (virCPUarmDriverInitialize() < 0)
+ goto cleanup;
+
+ if (!(cpuData = virCPUDataNew(archs[0])))
+ goto cleanup;
+
+ if (armCpuDataFromCpuInfo(&cpuData->data.arm) < 0)
+ goto cleanup;
+
+ ret = armDecodeCPUData(cpu, cpuData, models);
+
+ cleanup:
+ virCPUarmDataFree(cpuData);
+ return ret;
+}
+
static int
virCPUarmUpdate(virCPUDefPtr guest,
@@ -926,6 +1017,7 @@ struct cpuArchDriver cpuDriverArm = {
.decode = armDecodeCPUData,
.encode = NULL,
.dataFree = virCPUarmDataFree,
+ .getHost = virCPUarmGetHost,
.baseline = virCPUarmBaseline,
.update = virCPUarmUpdate,
};
--
2.19.1

View File

@ -1,292 +0,0 @@
From 57b8e156e898ccf878842c3cba1ed97a415cff6a Mon Sep 17 00:00:00 2001
From: Xu Yandong <xuyandong2@huawei.com>
Date: Fri, 6 Sep 2019 11:27:33 +0800
Subject: [PATCH] cpu: fix cpu-compare and cpu-baseline for ARM CPU
Signed-off-by: Xu Yandong <xuyandong2@huawei.com>
---
src/cpu/cpu_arm.c | 241 ++++++++++++++++++++++++++++++++++++++++++++--
1 file changed, 234 insertions(+), 7 deletions(-)
diff --git a/src/cpu/cpu_arm.c b/src/cpu/cpu_arm.c
index 0c8cd50..1d0d3b6 100644
--- a/src/cpu/cpu_arm.c
+++ b/src/cpu/cpu_arm.c
@@ -681,12 +681,18 @@ virCPUarmUpdate(virCPUDefPtr guest,
static virCPUDefPtr
virCPUarmBaseline(virCPUDefPtr *cpus,
- unsigned int ncpus ATTRIBUTE_UNUSED,
- virDomainCapsCPUModelsPtr models ATTRIBUTE_UNUSED,
+ unsigned int ncpus,
+ virDomainCapsCPUModelsPtr models,
const char **features ATTRIBUTE_UNUSED,
bool migratable ATTRIBUTE_UNUSED)
{
virCPUDefPtr cpu = NULL;
+ virCPUarmMapPtr map = NULL;
+ virCPUarmModelPtr model = NULL;
+ virCPUarmModelPtr baseModel = NULL;
+ virCPUarmVendorPtr vendor = NULL;
+ bool outputVendor = true;
+ size_t i;
if (VIR_ALLOC(cpu) < 0 ||
VIR_STRDUP(cpu->model, cpus[0]->model) < 0) {
@@ -694,27 +700,248 @@ virCPUarmBaseline(virCPUDefPtr *cpus,
return NULL;
}
+ cpu->arch = cpus[0]->arch;
cpu->type = VIR_CPU_TYPE_GUEST;
cpu->match = VIR_CPU_MATCH_EXACT;
+ cpu->fallback = VIR_CPU_FALLBACK_FORBID;
+
+ if (!(map = virCPUarmGetMap()))
+ goto error;
+
+ if (!(baseModel = armModelFromCPU(cpus[0], map)))
+ goto error;
+
+ if (!cpus[0]->vendor) {
+ outputVendor = false;
+ } else if (!(vendor = armVendorFindByName(map, cpus[0]->vendor))) {
+ virReportError(VIR_ERR_OPERATION_FAILED,
+ _("Unknown CPU vendor %s"), cpus[0]->vendor);
+ goto error;
+ }
+
+ for (i = 1; i < ncpus; i++) {
+ const char *vn = NULL;
+
+ if (!(model = armModelFromCPU(cpus[i], map)))
+ goto error;
+
+ if (cpus[i]->vendor) {
+ vn = cpus[i]->vendor;
+ } else {
+ outputVendor = false;
+ }
+
+ if (vn) {
+ if (!vendor) {
+ if (!(vendor = armVendorFindByName(map, vn))) {
+ virReportError(VIR_ERR_OPERATION_FAILED,
+ _("Unknown CPU vendor %s"), vn);
+ goto error;
+ }
+ } else if (STRNEQ(vendor->name, vn)) {
+ virReportError(VIR_ERR_OPERATION_FAILED,
+ "%s", _("CPU vendors do not match"));
+ goto error;
+ }
+ }
+
+ armDataIntersect(&baseModel->data, &model->data);
+ armModelFree(model);
+ model = NULL;
+ }
+
+ if (armDecode(cpu, &baseModel->data, models) < 0)
+ goto error;
+
+ if (!outputVendor)
+ VIR_FREE(cpu->vendor);
+
+ cpu->arch = VIR_ARCH_NONE;
+
+ cleanup:
+ armModelFree(baseModel);
return cpu;
+
+ error:
+ armModelFree(model);
+ virCPUDefFree(cpu);
+ cpu = NULL;
+ goto cleanup;
}
+
static virCPUCompareResult
-virCPUarmCompare(virCPUDefPtr host ATTRIBUTE_UNUSED,
- virCPUDefPtr cpu ATTRIBUTE_UNUSED,
- bool failMessages ATTRIBUTE_UNUSED)
+armCompute(virCPUDefPtr host,
+ virCPUDefPtr cpu,
+ virCPUDataPtr *guestData,
+ char **message)
{
- return VIR_CPU_COMPARE_IDENTICAL;
+ virCPUarmMapPtr map = NULL;
+ virCPUarmModelPtr hostModel = NULL;
+ virCPUarmModelPtr guestModel = NULL;
+ virCPUCompareResult ret = VIR_CPU_COMPARE_ERROR;
+ virArch arch;
+ size_t i;
+
+ if (cpu->arch != VIR_ARCH_NONE) {
+ bool found = false;
+
+ for (i = 0; i < ARRAY_CARDINALITY(archs); i++) {
+ if (archs[i] == cpu->arch) {
+ found = true;
+ break;
+ }
+ }
+
+ if (!found) {
+ VIR_DEBUG("CPU arch %s does not match host arch",
+ virArchToString(cpu->arch));
+ if (message &&
+ virAsprintf(message,
+ _("CPU arch %s does not match host arch"),
+ virArchToString(cpu->arch)) < 0)
+ goto cleanup;
+
+ ret = VIR_CPU_COMPARE_INCOMPATIBLE;
+ goto cleanup;
+ }
+ arch = cpu->arch;
+ } else {
+ arch = host->arch;
+ }
+
+ if (cpu->vendor &&
+ (!host->vendor || STRNEQ(cpu->vendor, host->vendor))) {
+ VIR_DEBUG("host CPU vendor does not match required CPU vendor %s",
+ cpu->vendor);
+ if (message &&
+ virAsprintf(message,
+ _("host CPU vendor does not match required "
+ "CPU vendor %s"),
+ cpu->vendor) < 0)
+ goto cleanup;
+
+ ret = VIR_CPU_COMPARE_INCOMPATIBLE;
+ goto cleanup;
+ }
+
+ if (!(map = virCPUarmGetMap()))
+ goto cleanup;
+
+ /* Host CPU information */
+ if (!(hostModel = armModelFromCPU(host, map)))
+ goto cleanup;
+
+ if (cpu->type == VIR_CPU_TYPE_GUEST) {
+ /* Guest CPU information */
+ switch (cpu->mode) {
+ case VIR_CPU_MODE_HOST_MODEL:
+ case VIR_CPU_MODE_HOST_PASSTHROUGH:
+ /* host-model and host-passthrough:
+ * the guest CPU is the same as the host */
+ guestModel = armModelCopy(hostModel);
+ break;
+
+ case VIR_CPU_MODE_CUSTOM:
+ /* custom:
+ * look up guest CPU information */
+ guestModel = armModelFromCPU(cpu, map);
+ break;
+ }
+ } else {
+ /* Other host CPU information */
+ guestModel = armModelFromCPU(cpu, map);
+ }
+
+ if (!guestModel)
+ goto cleanup;
+
+ if (STRNEQ(guestModel->name, hostModel->name)) {
+ VIR_DEBUG("host CPU model %s does not match required CPU model %s",
+ hostModel->name, guestModel->name);
+ if (message &&
+ virAsprintf(message,
+ _("host CPU model %s does not match required "
+ "CPU model %s"),
+ hostModel->name, guestModel->name) < 0)
+ goto cleanup;
+
+ ret = VIR_CPU_COMPARE_INCOMPATIBLE;
+ goto cleanup;
+ }
+
+ if (!armFeaturesIsSub(guestModel->data.features, hostModel->data.features)) {
+ VIR_DEBUG("guest CPU features '%s' is not subset of "
+ "host CPU features '%s'",
+ guestModel->data.features, hostModel->data.features);
+ if (message &&
+ virAsprintf(message,
+ _("guest CPU features '%s' is not subset of "
+ "host CPU features '%s'"),
+ guestModel->data.features,
+ hostModel->data.features) < 0)
+ goto cleanup;
+
+ ret = VIR_CPU_COMPARE_INCOMPATIBLE;
+ goto cleanup;
+ }
+
+ if (guestData &&
+ !(*guestData = armMakeCPUData(arch, &guestModel->data)))
+ goto cleanup;
+
+ ret = VIR_CPU_COMPARE_IDENTICAL;
+
+ cleanup:
+ armModelFree(hostModel);
+ armModelFree(guestModel);
+ return ret;
}
+static virCPUCompareResult
+virCPUarmCompare(virCPUDefPtr host,
+ virCPUDefPtr cpu,
+ bool failIncompatible)
+{
+ virCPUCompareResult ret = VIR_CPU_COMPARE_ERROR;
+ char *message = NULL;
+
+ if (!host || !host->model) {
+ if (failIncompatible) {
+ virReportError(VIR_ERR_CPU_INCOMPATIBLE, "%s",
+ _("unknown host CPU"));
+ } else {
+ VIR_WARN("unknown host CPU");
+ ret = VIR_CPU_COMPARE_INCOMPATIBLE;
+ }
+ return ret;
+ }
+
+ ret = armCompute(host, cpu, NULL, &message);
+
+ if (failIncompatible && ret == VIR_CPU_COMPARE_INCOMPATIBLE) {
+ ret = VIR_CPU_COMPARE_ERROR;
+ if (message) {
+ virReportError(VIR_ERR_CPU_INCOMPATIBLE, "%s", message);
+ } else {
+ virReportError(VIR_ERR_CPU_INCOMPATIBLE, NULL);
+ }
+ }
+ VIR_FREE(message);
+
+ return ret;
+}
+
+
struct cpuArchDriver cpuDriverArm = {
.name = "arm",
.arch = archs,
.narch = ARRAY_CARDINALITY(archs),
.compare = virCPUarmCompare,
- .decode = NULL,
+ .decode = armDecodeCPUData,
.encode = NULL,
+ .dataFree = virCPUarmDataFree,
.baseline = virCPUarmBaseline,
.update = virCPUarmUpdate,
};
--
2.19.1

View File

@ -1,649 +0,0 @@
From 2dc7c9bc3dc24d991834f7657cd65cf4b5774ff8 Mon Sep 17 00:00:00 2001
From: Xu Yandong <xuyandong2@huawei.com>
Date: Wed, 14 Aug 2019 21:33:37 +0800
Subject: [PATCH] cpu: introduce cpu baseline for ARM CPU
support vendor and model for ARM CPU
Signed-off-by: Xu Yandong <xuyandong2.huawei.com>
---
src/cpu/cpu_arm.c | 610 ++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 610 insertions(+)
diff --git a/src/cpu/cpu_arm.c b/src/cpu/cpu_arm.c
index 65d69c0..0c8cd50 100644
--- a/src/cpu/cpu_arm.c
+++ b/src/cpu/cpu_arm.c
@@ -21,12 +21,23 @@
#include <config.h>
+#include "virlog.h"
#include "viralloc.h"
#include "cpu.h"
#include "virstring.h"
+#include "cpu_map.h"
+#include "cpu_arm.h"
+#include "virfile.h"
#define VIR_FROM_THIS VIR_FROM_CPU
+VIR_LOG_INIT("cpu.cpu_arm");
+
+static const char *sysinfoCpuinfo = "/proc/cpuinfo";
+
+#define CPUINFO sysinfoCpuinfo
+#define CPUINFO_FILE_LEN (1024*1024) /* 1MB limit for /proc/cpuinfo file */
+
static const virArch archs[] = {
VIR_ARCH_ARMV6L,
VIR_ARCH_ARMV7B,
@@ -34,6 +45,605 @@ static const virArch archs[] = {
VIR_ARCH_AARCH64,
};
+typedef struct _virCPUarmVendor virCPUarmVendor;
+typedef virCPUarmVendor *virCPUarmVendorPtr;
+struct _virCPUarmVendor {
+ char *name;
+ unsigned long value;
+};
+
+typedef struct _virCPUarmModel virCPUarmModel;
+typedef virCPUarmModel *virCPUarmModelPtr;
+struct _virCPUarmModel {
+ char *name;
+ virCPUarmVendorPtr vendor;
+ virCPUarmData data;
+};
+
+typedef struct _virCPUarmMap virCPUarmMap;
+typedef virCPUarmMap *virCPUarmMapPtr;
+struct _virCPUarmMap {
+ size_t nvendors;
+ virCPUarmVendorPtr *vendors;
+ size_t nmodels;
+ virCPUarmModelPtr *models;
+};
+
+static virCPUarmMapPtr cpuMap;
+
+int virCPUarmDriverOnceInit(void);
+VIR_ONCE_GLOBAL_INIT(virCPUarmDriver);
+
+
+static void
+virCPUarmDataClear(virCPUarmData *data)
+{
+ if (!data)
+ return;
+
+ VIR_FREE(data->features);
+}
+
+
+static int
+armDataCopy(virCPUarmData *dst, const virCPUarmData *src)
+{
+ if (VIR_STRDUP(dst->features, src->features) < 0)
+ return -1;
+
+ dst->vendor_id = src->vendor_id;
+ dst->pvr = src->pvr;
+
+ return 0;
+}
+
+
+static void
+armDataIntersect(virCPUarmData *data1,
+ const virCPUarmData *data2)
+{
+ char **features = NULL;
+ char **features1 = NULL;
+ char **features2 = NULL;
+ size_t count = 0;
+ size_t i;
+
+ if (!data1 || !data2)
+ return;
+
+ data1->pvr = MIN(data1->pvr, data2->pvr);
+
+ if (virStringIsEmpty(data1->features) ||
+ virStringIsEmpty(data2->features)) {
+ VIR_FREE(data1->features);
+ return;
+ }
+
+ if (STREQ_NULLABLE(data1->features, data2->features))
+ return;
+
+ if (!(features = virStringSplitCount(data1->features, " ", 0, &count)) ||
+ !(features1 = virStringSplitCount(data1->features, " ", 0, &count)) ||
+ !(features2 = virStringSplit(data2->features, " ", 0)))
+ goto cleanup;
+
+ for (i = 0; i < count; i++) {
+ if (!virStringListHasString((const char**)features2, features1[i]))
+ virStringListRemove(&features, features1[i]);
+ }
+
+ VIR_FREE(data1->features);
+ if (features)
+ data1->features = virStringListJoin((const char**)features, " ");
+
+ cleanup:
+ virStringListFree(features);
+ virStringListFree(features1);
+ virStringListFree(features2);
+ return;
+}
+
+
+static void
+virCPUarmDataFree(virCPUDataPtr cpuData)
+{
+ if (!cpuData)
+ return;
+
+ virCPUarmDataClear(&cpuData->data.arm);
+ VIR_FREE(cpuData);
+}
+
+
+static bool
+armFeaturesIsSub(char *subFeatures,
+ char *fullFeatures)
+{
+ bool ret = false;
+ char **sub = NULL;
+ char **full = NULL;
+ size_t subCount = 0;
+ size_t fullCount = 0;
+ size_t i;
+
+ if (virStringIsEmpty(subFeatures))
+ return true;
+
+ if (virStringIsEmpty(fullFeatures))
+ return ret;
+
+ if (STREQ(subFeatures, fullFeatures))
+ return true;
+
+ if (!(sub = virStringSplitCount(subFeatures, " ", 0, &subCount)) ||
+ !(full = virStringSplitCount(fullFeatures, " ", 0, &fullCount)) ||
+ subCount > fullCount)
+ goto cleanup;
+
+ for (i = 0; i < subCount; i++) {
+ if (!virStringListHasString((const char**)full, sub[i]))
+ goto cleanup;
+ }
+
+ ret = true;
+
+ cleanup:
+ virStringListFree(sub);
+ virStringListFree(full);
+ return ret;
+}
+
+
+static void
+armVendorFree(virCPUarmVendorPtr vendor)
+{
+ if (!vendor)
+ return;
+
+ VIR_FREE(vendor->name);
+ VIR_FREE(vendor);
+}
+
+
+static virCPUarmVendorPtr
+armVendorFindByID(virCPUarmMapPtr map,
+ unsigned long vendor_id)
+{
+ size_t i;
+
+ for (i = 0; i < map->nvendors; i++) {
+ if (map->vendors[i]->value == vendor_id)
+ return map->vendors[i];
+ }
+
+ return NULL;
+}
+
+
+static virCPUarmVendorPtr
+armVendorFindByName(virCPUarmMapPtr map,
+ const char *name)
+{
+ size_t i;
+
+ for (i = 0; i < map->nvendors; i++) {
+ if (STREQ(map->vendors[i]->name, name))
+ return map->vendors[i];
+ }
+
+ return NULL;
+}
+
+
+static int
+armVendorParse(xmlXPathContextPtr ctxt,
+ const char *name,
+ void *data)
+{
+ virCPUarmMapPtr map = (virCPUarmMapPtr)data;
+ virCPUarmVendorPtr vendor = NULL;
+ int ret = -1;
+
+ if (VIR_ALLOC(vendor) < 0)
+ return ret;
+
+ if (VIR_STRDUP(vendor->name, name) < 0)
+ goto cleanup;
+
+ if (armVendorFindByName(map, vendor->name)) {
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("CPU vendor %s already defined"), vendor->name);
+ goto cleanup;
+ }
+
+ if (virXPathULongHex("string(@value)", ctxt, &vendor->value) < 0) {
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ "%s", _("Missing CPU vendor value"));
+ goto cleanup;
+ }
+
+ if (armVendorFindByID(map, vendor->value)) {
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("CPU vendor value 0x%2lx already defined"), vendor->value);
+ goto cleanup;
+ }
+
+ if (VIR_APPEND_ELEMENT(map->vendors, map->nvendors, vendor) < 0)
+ goto cleanup;
+
+ ret = 0;
+
+ cleanup:
+ armVendorFree(vendor);
+ return ret;
+
+}
+
+
+static void
+armModelFree(virCPUarmModelPtr model)
+{
+ if (!model)
+ return;
+
+ virCPUarmDataClear(&model->data);
+ VIR_FREE(model->name);
+ VIR_FREE(model);
+}
+
+
+static virCPUarmModelPtr
+armModelCopy(virCPUarmModelPtr model)
+{
+ virCPUarmModelPtr copy;
+
+ if (VIR_ALLOC(copy) < 0)
+ goto cleanup;
+
+ if (VIR_STRDUP(copy->name, model->name) < 0)
+ goto cleanup;
+
+ if (armDataCopy(&copy->data, &model->data) < 0)
+ goto cleanup;
+
+ copy->vendor = model->vendor;
+
+ return copy;
+
+ cleanup:
+ armModelFree(copy);
+ return NULL;
+}
+
+
+static virCPUarmModelPtr
+armModelFind(virCPUarmMapPtr map,
+ const char *name)
+{
+ size_t i;
+
+ for (i = 0; i < map->nmodels; i++) {
+ if (STREQ(map->models[i]->name, name))
+ return map->models[i];
+ }
+
+ return NULL;
+}
+
+
+static virCPUarmModelPtr
+armModelFindByPVR(virCPUarmMapPtr map,
+ unsigned long pvr)
+{
+ size_t i;
+
+ for (i = 0; i < map->nmodels; i++) {
+ if (map->models[i]->data.pvr == pvr)
+ return map->models[i];
+ }
+
+ return NULL;
+}
+
+
+static virCPUarmModelPtr
+armModelFromCPU(const virCPUDef *cpu,
+ virCPUarmMapPtr map)
+{
+ virCPUarmModelPtr model = NULL;
+ virCPUarmVendorPtr vendor = NULL;
+ char **features = NULL;
+ size_t i;
+
+ if (!cpu->model) {
+ virReportError(VIR_ERR_INVALID_ARG, "%s",
+ _("no CPU model specified"));
+ return NULL;
+ }
+
+ if (!(model = armModelFind(map, cpu->model))) {
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Unknown CPU model %s"), cpu->model);
+ return NULL;
+ }
+
+ if (!(model = armModelCopy(model)))
+ goto cleanup;
+
+ if (cpu->vendor) {
+ if (!(vendor = armVendorFindByName(map, cpu->vendor))) {
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Unknown CPU vendor %s"), cpu->vendor);
+ goto error;
+ }
+ model->data.vendor_id = vendor->value;
+ }
+
+ if (cpu->nfeatures) {
+ if (VIR_REALLOC_N(features, cpu->nfeatures + 1) < 0)
+ goto cleanup;
+
+ features[cpu->nfeatures] = NULL;
+ for (i = 0; i < cpu->nfeatures; i++) {
+ if (VIR_STRDUP(features[i], cpu->features[i].name) < 0)
+ goto error;
+ }
+
+ VIR_FREE(model->data.features);
+ model->data.features = virStringListJoin((const char **)features, " ");
+ }
+
+ cleanup:
+ virStringListFree(features);
+ return model;
+
+ error:
+ armModelFree(model);
+ model = NULL;
+ goto cleanup;
+}
+
+static int
+armModelParse(xmlXPathContextPtr ctxt,
+ const char *name,
+ void *data)
+{
+ virCPUarmMapPtr map = (virCPUarmMapPtr)data;
+ virCPUarmModel *model;
+ xmlNodePtr *nodes = NULL;
+ char *vendor = NULL;
+ int ret = -1;
+
+ if (VIR_ALLOC(model) < 0)
+ goto error;
+
+ if (VIR_STRDUP(model->name, name) < 0)
+ goto error;
+
+ if (armModelFind(map, model->name)) {
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("CPU model %s already defined"), model->name);
+ goto error;
+ }
+
+ if (virXPathBoolean("boolean(./vendor)", ctxt)) {
+ vendor = virXPathString("string(./vendor/@name)", ctxt);
+ if (!vendor) {
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Invalid vendor element in CPU model %s"),
+ model->name);
+ goto error;
+ }
+
+ if (!(model->vendor = armVendorFindByName(map, vendor))) {
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Unknown vendor %s referenced by CPU model %s"),
+ vendor, model->name);
+ goto error;
+ }
+ }
+
+ if (!virXPathBoolean("boolean(./pvr)", ctxt)) {
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Missing PVR information for CPU model %s"),
+ model->name);
+ goto error;
+ }
+
+ if (virXPathULongHex("string(./pvr/@value)", ctxt, &model->data.pvr) < 0) {
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Missing or invalid PVR value in CPU model %s"),
+ model->name);
+ goto error;
+ }
+
+ if (VIR_APPEND_ELEMENT(map->models, map->nmodels, model) < 0)
+ goto error;
+
+ ret = 0;
+
+ cleanup:
+ VIR_FREE(vendor);
+ VIR_FREE(nodes);
+ return ret;
+
+ error:
+ armModelFree(model);
+ goto cleanup;
+}
+
+
+static void
+armMapFree(virCPUarmMapPtr map)
+{
+ size_t i;
+
+ if (!map)
+ return;
+
+ for (i = 0; i < map->nmodels; i++)
+ armModelFree(map->models[i]);
+ VIR_FREE(map->models);
+
+ for (i = 0; i < map->nvendors; i++)
+ armVendorFree(map->vendors[i]);
+ VIR_FREE(map->vendors);
+
+ VIR_FREE(map);
+}
+
+
+static virCPUarmMapPtr
+virCPUarmLoadMap(void)
+{
+ virCPUarmMapPtr map;
+
+ if (VIR_ALLOC(map) < 0)
+ goto error;
+
+ if (cpuMapLoad("arm", armVendorParse, NULL, armModelParse, map) < 0)
+ goto error;
+
+ return map;
+
+ error:
+ armMapFree(map);
+ return NULL;
+}
+
+int
+virCPUarmDriverOnceInit(void)
+{
+ if (!(cpuMap = virCPUarmLoadMap()))
+ return -1;
+
+ return 0;
+}
+
+
+static virCPUarmMapPtr
+virCPUarmGetMap(void)
+{
+ if (virCPUarmDriverInitialize() < 0)
+ return NULL;
+
+ return cpuMap;
+}
+
+static virCPUDataPtr
+armMakeCPUData(virArch arch,
+ virCPUarmData *data)
+{
+ virCPUDataPtr cpuData;
+
+ if (VIR_ALLOC(cpuData) < 0)
+ return NULL;
+
+ cpuData->arch = arch;
+
+ if (armDataCopy(&cpuData->data.arm, data) < 0)
+ VIR_FREE(cpuData);
+
+ return cpuData;
+}
+
+
+static int
+armCpuDataParseFeatures(virCPUDefPtr cpu,
+ const virCPUarmData *cpuData)
+{
+ int ret = -1;
+ size_t i;
+ char **features;
+
+ if (!cpu || !cpuData)
+ return ret;
+
+ if (!(features = virStringSplitCount(cpuData->features, " ",
+ 0, &cpu->nfeatures)))
+ return ret;
+ if (cpu->nfeatures) {
+ if (VIR_ALLOC_N(cpu->features, cpu->nfeatures) < 0)
+ goto error;
+
+ for (i = 0; i < cpu->nfeatures; i++) {
+ cpu->features[i].policy = VIR_CPU_FEATURE_REQUIRE;
+ if (VIR_STRDUP(cpu->features[i].name, features[i]) < 0)
+ goto error;
+ }
+ }
+
+ ret = 0;
+
+ cleanup:
+ virStringListFree(features);
+ return ret;
+
+ error:
+ for (i = 0; i < cpu->nfeatures; i++)
+ VIR_FREE(cpu->features[i].name);
+ VIR_FREE(cpu->features);
+ cpu->nfeatures = 0;
+ goto cleanup;
+}
+
+
+static int
+armDecode(virCPUDefPtr cpu,
+ const virCPUarmData *cpuData,
+ virDomainCapsCPUModelsPtr models)
+{
+ virCPUarmMapPtr map;
+ virCPUarmModelPtr model;
+ virCPUarmVendorPtr vendor = NULL;
+
+ if (!cpuData || !(map = virCPUarmGetMap()))
+ return -1;
+
+ if (!(model = armModelFindByPVR(map, cpuData->pvr))) {
+ virReportError(VIR_ERR_OPERATION_FAILED,
+ _("Cannot find CPU model with PVR 0x%03lx"),
+ cpuData->pvr);
+ return -1;
+ }
+
+ if (!virCPUModelIsAllowed(model->name, models)) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("CPU model %s is not supported by hypervisor"),
+ model->name);
+ return -1;
+ }
+
+ if (VIR_STRDUP(cpu->model, model->name) < 0)
+ return -1;
+
+ if (cpuData->vendor_id &&
+ !(vendor = armVendorFindByID(map, cpuData->vendor_id))) {
+ virReportError(VIR_ERR_OPERATION_FAILED,
+ _("Cannot find CPU vendor with vendor id 0x%02lx"),
+ cpuData->vendor_id);
+ return -1;
+ }
+
+ if (vendor && VIR_STRDUP(cpu->vendor, vendor->name) < 0)
+ return -1;
+
+ if (cpuData->features &&
+ armCpuDataParseFeatures(cpu, cpuData) < 0)
+ return -1;
+
+ return 0;
+}
+
+
+static int
+armDecodeCPUData(virCPUDefPtr cpu,
+ const virCPUData *data,
+ virDomainCapsCPUModelsPtr models)
+{
+ return armDecode(cpu, &data->data.arm, models);
+}
+
static int
virCPUarmUpdate(virCPUDefPtr guest,
--
2.19.1

View File

@ -1,76 +0,0 @@
From e814e4a7e227cd681b9dd95aedc93f3a087c42a1 Mon Sep 17 00:00:00 2001
From: Xu Yandong <xuyandong2@huawei.com>
Date: Wed, 14 Aug 2019 17:06:12 +0800
Subject: [PATCH] cpu: introduce virCPUarmData to virCPUData
support vendor and model for virConnectGetCapabilities in ARM,
introduce virCPUarmData to virCPUData.
Signed-off-by: Xu Yandong <xuyandong2.huawei.com>
---
src/cpu/cpu.h | 2 ++
src/cpu/cpu_arm_data.h | 32 ++++++++++++++++++++++++++++++++
2 files changed, 34 insertions(+)
create mode 100644 src/cpu/cpu_arm_data.h
diff --git a/src/cpu/cpu.h b/src/cpu/cpu.h
index 13909bb..f91b247 100644
--- a/src/cpu/cpu.h
+++ b/src/cpu/cpu.h
@@ -27,6 +27,7 @@
#include "cpu_conf.h"
#include "cpu_x86_data.h"
#include "cpu_ppc64_data.h"
+#include "cpu_arm_data.h"
typedef struct _virCPUData virCPUData;
@@ -36,6 +37,7 @@ struct _virCPUData {
union {
virCPUx86Data x86;
virCPUppc64Data ppc64;
+ virCPUarmData arm;
/* generic driver needs no data */
} data;
};
diff --git a/src/cpu/cpu_arm_data.h b/src/cpu/cpu_arm_data.h
new file mode 100644
index 0000000..72b3a29
--- /dev/null
+++ b/src/cpu/cpu_arm_data.h
@@ -0,0 +1,32 @@
+/*
+ * cpu_arm_data.h: 64-bit arm CPU specific data
+ *
+ * Copyright (C) 2019. Huawei Technologies Co., Ltd. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#pragma once
+
+
+#define VIR_CPU_ARM_DATA_INIT { 0 }
+
+typedef struct _virCPUarmData virCPUarmData;
+struct _virCPUarmData {
+ unsigned long vendor_id;
+ unsigned long pvr;
+ char *features;
+};
--
2.19.1

View File

@ -1,37 +0,0 @@
From 3b401713bcd5acfd1030425832becad34a7eaac8 Mon Sep 17 00:00:00 2001
From: Jiri Denemark <jdenemar@redhat.com>
Date: Thu, 12 Dec 2019 15:12:05 +0100
Subject: [PATCH 1/2] cpu_map: Add TAA_NO bit for IA32_ARCH_CAPABILITIES MSR
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
CVE-2019-11135
CPUs with TAA_NO bit of IA32_ARCH_CAPABILITIES MSR set to 1 are not
vulnerable to TSX Asynchronous Abort and passing this bit to a guest
may avoid unnecessary mitigations.
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
(cherry-picked from commit 07aaced4e6ea6db8b27f44636f51cafa6f1847a8)
Signed-off-by: Xu Yandong <xuyandong2@huawei.com>
---
src/cpu_map/x86_features.xml | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/cpu_map/x86_features.xml b/src/cpu_map/x86_features.xml
index 2bed1e0..d1180ed 100644
--- a/src/cpu_map/x86_features.xml
+++ b/src/cpu_map/x86_features.xml
@@ -502,4 +502,7 @@
<feature name='mds-no'>
<msr index='0x10a' edx='0x00000000' eax='0x00000020'/>
</feature>
+ <feature name='taa-no'>
+ <msr index='0x10a' edx='0x00000000' eax='0x00000100'/>
+ </feature>
</cpus>
--
2.21.0

View File

@ -1,38 +0,0 @@
From 7ab3dc8c831d5777bce7ced1a07158199049566c Mon Sep 17 00:00:00 2001
From: Jiri Denemark <jdenemar@redhat.com>
Date: Thu, 12 Dec 2019 15:12:05 +0100
Subject: [PATCH] cpu_map: Add TSX_CTRL bit for IA32_ARCH_CAPABILITIES MSR
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
CVE-2019-11135
When TSX_CTRL bit of IA32_ARCH_CAPABILITIES MSR is set to 1, the CPU
supports IA32_TSX_CTRL MSR which can be used to disable and/or mask TSX.
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
(cherry-picked from commit f411b7ef68221e82dec0129aaf2f2a26a8987504)
Signed-off-by: Xu Yandong <xuyandong2@huawei.com>
---
src/cpu_map/x86_features.xml | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/cpu_map/x86_features.xml b/src/cpu_map/x86_features.xml
index d1180ed..b42b490 100644
--- a/src/cpu_map/x86_features.xml
+++ b/src/cpu_map/x86_features.xml
@@ -502,6 +502,9 @@
<feature name='mds-no'>
<msr index='0x10a' edx='0x00000000' eax='0x00000020'/>
</feature>
+ <feature name='tsx-ctrl'>
+ <msr index='0x10a' edx='0x00000000' eax='0x00000080'/>
+ </feature>
<feature name='taa-no'>
<msr index='0x10a' edx='0x00000000' eax='0x00000100'/>
</feature>
--
2.21.0

View File

@ -1,150 +0,0 @@
From 4274e2d7d00058b5a6aca7c4b256c0c6fb01d69d Mon Sep 17 00:00:00 2001
From: Xu Yandong <xuyandong2@huawei.com>
Date: Wed, 14 Aug 2019 16:51:23 +0800
Subject: [PATCH] cpu_map: Introduce arm CPU models
support vendor and model for virConnectGetCapabilities in ARM,
add arm cpu info to cpu map
Signed-off-by: Xu Yandong <xuyandong2@huawei.com>
---
src/cpu_map/Makefile.inc.am | 5 +++++
src/cpu_map/arm_Kunpeng-920.xml | 24 ++++++++++++++++++++++++
src/cpu_map/arm_cortex-a53.xml | 6 ++++++
src/cpu_map/arm_cortex-a57.xml | 6 ++++++
src/cpu_map/arm_cortex-a72.xml | 6 ++++++
src/cpu_map/arm_vendors.xml | 14 ++++++++++++++
src/cpu_map/index.xml | 12 ++++++++++++
7 files changed, 73 insertions(+)
create mode 100644 src/cpu_map/arm_Kunpeng-920.xml
create mode 100644 src/cpu_map/arm_cortex-a53.xml
create mode 100644 src/cpu_map/arm_cortex-a57.xml
create mode 100644 src/cpu_map/arm_cortex-a72.xml
create mode 100644 src/cpu_map/arm_vendors.xml
diff --git a/src/cpu_map/Makefile.inc.am b/src/cpu_map/Makefile.inc.am
index ce8a311..3b63203 100644
--- a/src/cpu_map/Makefile.inc.am
+++ b/src/cpu_map/Makefile.inc.am
@@ -60,6 +60,11 @@ cpumap_DATA = \
cpu_map/x86_Skylake-Server-IBRS.xml \
cpu_map/x86_Westmere.xml \
cpu_map/x86_Westmere-IBRS.xml \
+ cpu_map/arm_vendors.xml \
+ cpu_map/arm_cortex-a53.xml \
+ cpu_map/arm_cortex-a57.xml \
+ cpu_map/arm_cortex-a72.xml \
+ cpu_map/arm_Kunpeng-920.xml \
$(NULL)
EXTRA_DIST += $(cpumap_DATA)
diff --git a/src/cpu_map/arm_Kunpeng-920.xml b/src/cpu_map/arm_Kunpeng-920.xml
new file mode 100644
index 0000000..619a2ef
--- /dev/null
+++ b/src/cpu_map/arm_Kunpeng-920.xml
@@ -0,0 +1,24 @@
+<cpus>
+ <model name='Kunpeng-920'>
+ <vendor name='Hisilicon'/>
+ <pvr value='0xd01'/>
+ <feature name="fp"/>
+ <feature name="asimd"/>
+ <feature name="evtstrm"/>
+ <feature name="aes"/>
+ <feature name="pmull"/>
+ <feature name="sha1"/>
+ <feature name="sha2"/>
+ <feature name="crc32"/>
+ <feature name="atomics"/>
+ <feature name="fphp"/>
+ <feature name="asimdhp"/>
+ <feature name="cpuid"/>
+ <feature name="asimdrdm"/>
+ <feature name="jscvt"/>
+ <feature name="fcma"/>
+ <feature name="dcpop"/>
+ <feature name="asimddp"/>
+ <feature name="asimdfhm"/>
+ </model>
+</cpus>
diff --git a/src/cpu_map/arm_cortex-a53.xml b/src/cpu_map/arm_cortex-a53.xml
new file mode 100644
index 0000000..3580236
--- /dev/null
+++ b/src/cpu_map/arm_cortex-a53.xml
@@ -0,0 +1,6 @@
+<cpus>
+ <model name='cortex-a53'>
+ <vendor name='ARM'/>
+ <pvr value='0xd03'/>
+ </model>
+</cpus>
diff --git a/src/cpu_map/arm_cortex-a57.xml b/src/cpu_map/arm_cortex-a57.xml
new file mode 100644
index 0000000..3bc4324
--- /dev/null
+++ b/src/cpu_map/arm_cortex-a57.xml
@@ -0,0 +1,6 @@
+<cpus>
+ <model name='cortex-a57'>
+ <vendor name='ARM'/>
+ <pvr value='0xd07'/>
+ </model>
+</cpus>
diff --git a/src/cpu_map/arm_cortex-a72.xml b/src/cpu_map/arm_cortex-a72.xml
new file mode 100644
index 0000000..c509a40
--- /dev/null
+++ b/src/cpu_map/arm_cortex-a72.xml
@@ -0,0 +1,6 @@
+<cpus>
+ <model name='cortex-a72'>
+ <vendor name='ARM'/>
+ <pvr value='0xd08'/>
+ </model>
+</cpus>
diff --git a/src/cpu_map/arm_vendors.xml b/src/cpu_map/arm_vendors.xml
new file mode 100644
index 0000000..840bf9a
--- /dev/null
+++ b/src/cpu_map/arm_vendors.xml
@@ -0,0 +1,14 @@
+<cpus>
+ <vendor name="ARM" value="0x41"/>
+ <vendor name="Broadcom" value="0x42"/>
+ <vendor name="Cavium" value="0x43"/>
+ <vendor name="DigitalEquipment" value="0x44"/>
+ <vendor name="Hisilicon" value="0x48"/>
+ <vendor name="Infineon" value="0x49"/>
+ <vendor name="Freescale" value="0x4D"/>
+ <vendor name="NVIDIA" value="0x4E"/>
+ <vendor name="APM" value="0x50"/>
+ <vendor name="Qualcomm" value="0x51"/>
+ <vendor name="Marvell" value="0x56"/>
+ <vendor name="Intel" value="0x69"/>
+</cpus>
diff --git a/src/cpu_map/index.xml b/src/cpu_map/index.xml
index 3c6885f..d222fd3 100644
--- a/src/cpu_map/index.xml
+++ b/src/cpu_map/index.xml
@@ -75,4 +75,16 @@
<include filename="ppc64_POWERPC_e5500.xml"/>
<include filename="ppc64_POWERPC_e6500.xml"/>
</arch>
+
+ <arch name='arm'>
+ <include filename="arm_vendors.xml"/>
+
+ <!-- ARM-based CPU models -->
+ <include filename="arm_cortex-a53.xml"/>
+ <include filename="arm_cortex-a57.xml"/>
+ <include filename="arm_cortex-a72.xml"/>
+
+ <!-- Hisilicon-based CPU models -->
+ <include filename="arm_Kunpeng-920.xml"/>
+ </arch>
</cpus>
--
2.19.1

View File

@ -1,55 +0,0 @@
From 554597f2fc6fec3191426a88fd2e5a19246a989a Mon Sep 17 00:00:00 2001
From: Xu Yandong <xuyandong2@huawei.com>
Date: Thu, 25 Jul 2019 16:08:41 +0800
Subject: [PATCH] event: reference state only when virEventAddTimeout success
Reference state is not necessary when virEventAddTimeout failed,
this may cause a memory leak, so reference state only when
virEventAddTimeout success.
Signed-off-by: Xu Yandong <xuyandong2@huawei.com>
---
src/conf/object_event.c | 25 +++++++++++++------------
1 file changed, 13 insertions(+), 12 deletions(-)
diff --git a/src/conf/object_event.c b/src/conf/object_event.c
index 5d84598..ee5def5 100644
--- a/src/conf/object_event.c
+++ b/src/conf/object_event.c
@@ -891,20 +891,21 @@ virObjectEventStateRegisterID(virConnectPtr conn,
virObjectLock(state);
if ((state->callbacks->count == 0) &&
- (state->timer == -1) &&
- (state->timer = virEventAddTimeout(-1,
- virObjectEventTimer,
- state,
- virObjectFreeCallback)) < 0) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("could not initialize domain event timer"));
- goto cleanup;
+ (state->timer == -1)) {
+ if ((state->timer = virEventAddTimeout(-1,
+ virObjectEventTimer,
+ state,
+ virObjectFreeCallback)) < 0) {
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("could not initialize domain event timer"));
+ goto cleanup;
+ } else {
+ /* event loop has one reference, but we need one more for the
+ * timer's opaque argument */
+ virObjectRef(state);
+ }
}
- /* event loop has one reference, but we need one more for the
- * timer's opaque argument */
- virObjectRef(state);
-
ret = virObjectEventCallbackListAddID(conn, state->callbacks,
key, filter, filter_opaque,
klass, eventID,
--
2.19.1

View File

@ -1,29 +0,0 @@
From b32fefd72878ca398f9a83c9eea3533f74dfcd5a Mon Sep 17 00:00:00 2001
From: Xu Yandong <xuyandong2@huawei.com>
Date: Wed, 28 Aug 2019 10:45:02 +0800
Subject: [PATCH] hostdev: remove unnessary virObjectUnref after use
VIR_AUTOUNREF
After introduce the VIR_AUTOUNREF macro, virObjectUnref is no
longer needed.
Signed-off-by: Xu Yandong <xuyandong2@huawei.com>
---
src/util/virhostdev.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/src/util/virhostdev.c b/src/util/virhostdev.c
index a3647a6..271a654 100644
--- a/src/util/virhostdev.c
+++ b/src/util/virhostdev.c
@@ -1081,7 +1081,6 @@ virHostdevReAttachPCIDevices(virHostdevManagerPtr mgr,
virObjectUnlock(mgr->activePCIHostdevs);
virObjectUnlock(mgr->inactivePCIHostdevs);
- virObjectUnref(pcidevs);
}
int
--
2.19.1

View File

@ -1,47 +0,0 @@
From d2be5a59d36a743505185c0f5bb636088a6e37da Mon Sep 17 00:00:00 2001
From: Wu Jing <wujing42@huawei.com>
Date: Thu, 15 Aug 2019 19:33:16 +0800
Subject: [PATCH] libvirtd: fix driver cleanup order to avoid coredump
In cleanup process, there may be some threads still working and accessing objs
of drivers. We should put virStateCleanup at the end.
Signed-off-by: Wu Jing <wujing42@huawei.com>
---
src/remote/remote_daemon.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/src/remote/remote_daemon.c b/src/remote/remote_daemon.c
index fdc9e43..ece4baa 100644
--- a/src/remote/remote_daemon.c
+++ b/src/remote/remote_daemon.c
@@ -1379,13 +1379,6 @@ int main(int argc, char **argv) {
virNetlinkEventServiceStopAll();
- if (driversInitialized) {
- /* NB: Possible issue with timing window between driversInitialized
- * setting if virNetlinkEventServerStart fails */
- driversInitialized = false;
- virStateCleanup();
- }
-
virObjectUnref(adminProgram);
virObjectUnref(srvAdm);
virObjectUnref(qemuProgram);
@@ -1419,5 +1412,12 @@ int main(int argc, char **argv) {
VIR_FREE(remote_config_file);
daemonConfigFree(config);
+ if (driversInitialized) {
+ /* NB: Possible issue with timing window between driversInitialized
+ * setting if virNetlinkEventServerStart fails */
+ driversInitialized = false;
+ virStateCleanup();
+ }
+
return ret;
}
--
2.19.1

View File

@ -1,64 +0,0 @@
From 9b51935a361e04633cbdecd19a65e99205415b81 Mon Sep 17 00:00:00 2001
From: Laine Stump <laine@redhat.com>
Date: Thu, 15 Aug 2019 21:52:28 -0400
Subject: [PATCH] network: fix crash during cleanup from failure to allocate
port
During networkPortCreateXML, if networkAllocatePort() failed,
networkReleasePort() would be called, which would (in the case of
network pools of macvtap passthrough devices) attempt to find the
allocated device by comparing port->plug.direct.linkdev to each device
in the pool. Since port->plug.direct.linkdev was still NULL, the
attempted strcmp would result in a SEGV.
Calling networkReleasePort() during error cleanup is something that
should only be done if networkAllocatePort() has already succeeded. It
turns out there is one other possible error exit from
networkPortCreateXML() that happens after networkAllocatePort() has
succeeded, so the code to call networkReleasePort() was just moved
down to there.
Resolves: https://bugzilla.redhat.com/1741390
Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
(cherry-picked from commit dac697e8d7d6d9a607e61caeeec06b259edf513f)
Signed-off-by: Xu Yandong <xuyandong2@huawei.com>
---
src/network/bridge_driver.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c
index 19faf7d..8005883 100644
--- a/src/network/bridge_driver.c
+++ b/src/network/bridge_driver.c
@@ -5434,20 +5434,20 @@ networkPortCreateXML(virNetworkPtr net,
rc = networkNotifyPort(obj, portdef);
else
rc = networkAllocatePort(obj, portdef);
- if (rc < 0) {
+ if (rc < 0)
+ goto cleanup;
+
+ if (virNetworkObjAddPort(obj, portdef, driver->stateDir) < 0) {
virErrorPtr saved;
+
saved = virSaveLastError();
ignore_value(networkReleasePort(obj, portdef));
+ virNetworkPortDefFree(portdef);
virSetError(saved);
virFreeError(saved);
goto cleanup;
}
- if (virNetworkObjAddPort(obj, portdef, driver->stateDir) < 0) {
- virNetworkPortDefFree(portdef);
- goto cleanup;
- }
-
ret = virGetNetworkPort(net, portdef->uuid);
cleanup:
virNetworkObjEndAPI(&obj);
--
2.21.0

View File

@ -1,60 +0,0 @@
From c53f20683ef66939d94e690e875500628a5b4f3f Mon Sep 17 00:00:00 2001
From: Xu Yandong <xuyandong2@huawei.com>
Date: Thu, 29 Aug 2019 16:31:30 +0800
Subject: [PATCH] nodedev: fix potential heap use after free
After move device enumumeration into a thread(commit 9f0ae0b18e3),
flag driversInitialized no longer represent stateInitialized finished
complete, so reference driver->devs before use it to prevent devs freed
by virStateCleanup.
Signed-off-by: Xu Yandong <xuyandong2@huawei.com>
---
src/node_device/node_device_udev.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/src/node_device/node_device_udev.c b/src/node_device/node_device_udev.c
index 276bf3d..cac9447 100644
--- a/src/node_device/node_device_udev.c
+++ b/src/node_device/node_device_udev.c
@@ -1321,9 +1321,12 @@ udevAddOneDevice(struct udev_device *device)
virNodeDeviceObjPtr obj = NULL;
virNodeDeviceDefPtr objdef;
virObjectEventPtr event = NULL;
+ virNodeDeviceObjListPtr devs = driver->devs;
bool new_device = true;
int ret = -1;
+ virObjectRef(devs);
+
if (VIR_ALLOC(def) != 0)
goto cleanup;
@@ -1348,14 +1351,14 @@ udevAddOneDevice(struct udev_device *device)
if (udevSetParent(device, def) != 0)
goto cleanup;
- if ((obj = virNodeDeviceObjListFindByName(driver->devs, def->name))) {
+ if ((obj = virNodeDeviceObjListFindByName(devs, def->name))) {
virNodeDeviceObjEndAPI(&obj);
new_device = false;
}
/* If this is a device change, the old definition will be freed
* and the current definition will take its place. */
- if (!(obj = virNodeDeviceObjListAssignDef(driver->devs, def)))
+ if (!(obj = virNodeDeviceObjListAssignDef(devs, def)))
goto cleanup;
objdef = virNodeDeviceObjGetDef(obj);
@@ -1371,6 +1374,7 @@ udevAddOneDevice(struct udev_device *device)
ret = 0;
cleanup:
+ virObjectUnref(devs);
virObjectEventStateQueue(driver->nodeDeviceEventState, event);
if (ret != 0) {
--
2.19.1

View File

@ -1,26 +0,0 @@
From 1ee32e1abe3a9ed5213ba8854b406a335ee78333 Mon Sep 17 00:00:00 2001
From: rpm-build <rpm-build>
Date: Mon, 6 Jan 2020 06:58:14 +0200
Subject: [PATCH] po: Refresh translation for running state
Signed-off-by: Xu Yandong <xuyandong2@huawei.com>
---
po/zh_CN.mini.po | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/po/zh_CN.mini.po b/po/zh_CN.mini.po
index 2917446..a5b3814 100644
--- a/po/zh_CN.mini.po
+++ b/po/zh_CN.mini.po
@@ -19558,7 +19558,7 @@ msgid "rule node requires direction attribute"
msgstr "rule 节点需要 direction 属性"
msgid "running"
-msgstr "running"
+msgstr "运行中"
msgid "sanlock is too old to support lock failure action"
msgstr "sanlock 太旧不支持锁失败动作"
--
2.23.0

View File

@ -1,81 +0,0 @@
From 1cbe145af6e59574945cf43ad9bed7d4d6961fbf Mon Sep 17 00:00:00 2001
From: Xu Yandong <xuyandong2@huawei.com>
Date: Wed, 25 Dec 2019 10:37:54 +0800
Subject: [PATCH] qemu: Don't leak domain def when RevertToSnapshot fails
Once we copy the domain definition from virDomainSnapshotDef, we either
need to assign it to the domain object or free it to avoid memory leaks.
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
(cherry-picked from commit 33c05f8b446f859d7b72780e584b941705470fea)
Signed-off-by: Xu Yandong <xuyandong2@huawei.com>
---
src/qemu/qemu_driver.c | 16 +++++++++++++---
1 file changed, 13 insertions(+), 3 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 296f27e..7ff7d92 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -16204,6 +16204,7 @@ qemuDomainRevertToSnapshot(virDomainSnapshotPtr snapshot,
virCPUDefPtr origCPU = NULL;
unsigned int start_flags = VIR_QEMU_PROCESS_START_GEN_VMID;
qemuDomainAsyncJob jobType = QEMU_ASYNC_JOB_START;
+ bool defined = false;
virCheckFlags(VIR_DOMAIN_SNAPSHOT_REVERT_RUNNING |
VIR_DOMAIN_SNAPSHOT_REVERT_PAUSED |
@@ -16414,13 +16415,18 @@ qemuDomainRevertToSnapshot(virDomainSnapshotPtr snapshot,
virDomainObjAssignDef(vm, config, false, NULL);
virCPUDefFree(priv->origCPU);
VIR_STEAL_PTR(priv->origCPU, origCPU);
+ config = NULL;
+ defined = true;
}
} else {
/* Transitions 2, 3 */
load:
was_stopped = true;
- if (config)
+ if (config) {
virDomainObjAssignDef(vm, config, false, NULL);
+ config = NULL;
+ defined = true;
+ }
/* No cookie means libvirt which saved the domain was too old to
* mess up the CPU definitions.
@@ -16506,8 +16512,11 @@ qemuDomainRevertToSnapshot(virDomainSnapshotPtr snapshot,
qemuProcessEndJob(driver, vm);
goto cleanup;
}
- if (config)
+ if (config) {
virDomainObjAssignDef(vm, config, false, NULL);
+ config = NULL;
+ defined = true;
+ }
if (flags & (VIR_DOMAIN_SNAPSHOT_REVERT_RUNNING |
VIR_DOMAIN_SNAPSHOT_REVERT_PAUSED)) {
@@ -16575,7 +16584,7 @@ qemuDomainRevertToSnapshot(virDomainSnapshotPtr snapshot,
} else if (snap) {
virDomainSnapshotSetCurrent(vm->snapshots, NULL);
}
- if (ret == 0 && config && vm->persistent &&
+ if (ret == 0 && defined && vm->persistent &&
!(ret = virDomainSaveConfig(cfg->configDir, driver->caps,
vm->newDef ? vm->newDef : vm->def))) {
detail = VIR_DOMAIN_EVENT_DEFINED_FROM_SNAPSHOT;
@@ -16591,6 +16600,7 @@ qemuDomainRevertToSnapshot(virDomainSnapshotPtr snapshot,
virObjectUnref(cfg);
virNWFilterUnlockFilterUpdates();
virCPUDefFree(origCPU);
+ virDomainDefFree(config);
return ret;
}
--
2.21.0

View File

@ -1,92 +0,0 @@
From f7d778d4d6cbbc7422b9beae4b1f4a2e0f040464 Mon Sep 17 00:00:00 2001
From: Michal Privoznik <mprivozn@redhat.com>
Date: Fri, 8 Nov 2019 09:41:35 +0100
Subject: [PATCH] qemu: Forcibly mknod() even if it exists
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Another weird bug appeared concerning qemu namespaces. Basically
the problem is as follows:
1) Issue an API that causes libvirt to create a node in domain's
namespace, say /dev/nvme0n1 with 8:0 as major:minor (the API can
be attach-disk for instance). Or simply create the node from a
console by hand.
2) Detach the disk from qemu.
3) Do something that makes /dev/nvme0n1 change it's minor number.
4) Try to attach the disk again.
The problem is, in a few cases - like disk-detach - we don't
remove the corresponding /dev node from the mount namespace
(because it may be used by some other disk's backing chain). But
this creates a problem, because if the node changes its MAJ:MIN
numbers we don't propagate the change into the domain's
namespace. We do plain mknod() and ignore EEXIST which obviously
is not enough because it doesn't guarantee that the node has
updated MAJ:MIN pair.
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1752978
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
(cherry-picked from commit cdd8a6690ee3fa4b4b8ca1d4531924bd33be136a)
Signed-off-by: Xu Yandong <xuyandong2@huawei.com>
---
src/qemu/qemu_domain.c | 25 +++++++++----------------
1 file changed, 9 insertions(+), 16 deletions(-)
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 56fadd5..cfc2b0e 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -12194,16 +12194,14 @@ qemuDomainCreateDeviceRecursive(const char *device,
allow_noent, ttl - 1) < 0)
goto cleanup;
} else if (isDev) {
- if (create &&
- mknod(devicePath, sb.st_mode, sb.st_rdev) < 0) {
- if (errno == EEXIST) {
- ret = 0;
- } else {
+ if (create) {
+ unlink(devicePath);
+ if (mknod(devicePath, sb.st_mode, sb.st_rdev) < 0) {
virReportSystemError(errno,
_("Failed to make device %s"),
devicePath);
+ goto cleanup;
}
- goto cleanup;
}
} else if (isReg) {
if (create &&
@@ -12996,17 +12994,12 @@ qemuDomainAttachDeviceMknodHelper(pid_t pid ATTRIBUTE_UNUSED,
} else if (isDev) {
VIR_DEBUG("Creating dev %s (%d,%d)",
data->file, major(data->sb.st_rdev), minor(data->sb.st_rdev));
+ unlink(data->file);
if (mknod(data->file, data->sb.st_mode, data->sb.st_rdev) < 0) {
- /* Because we are not removing devices on hotunplug, or
- * we might be creating part of backing chain that
- * already exist due to a different disk plugged to
- * domain, accept EEXIST. */
- if (errno != EEXIST) {
- virReportSystemError(errno,
- _("Unable to create device %s"),
- data->file);
- goto cleanup;
- }
+ virReportSystemError(errno,
+ _("Unable to create device %s"),
+ data->file);
+ goto cleanup;
} else {
delDevice = true;
}
--
2.21.0

View File

@ -1,98 +0,0 @@
From f8c3c7f120aafa218615b7f6e4b380538efeb674 Mon Sep 17 00:00:00 2001
From: Michal Privoznik <mprivozn@redhat.com>
Date: Sat, 13 Jul 2019 09:17:06 +0200
Subject: [PATCH] qemu: Relax os.loader->type check when validating domain
When validating a domain among all the checks there are two that
concern VIR_DOMAIN_LOADER_TYPE_PFLASH specifically. The first
check ensures that on x86 ACPI is enabled when UEFI is requested,
the second ensures that UEFI is used when ACPI is requested on
aarch64. However, check for UEFI is done by plain comparison of
def->os.loader->type which is insufficient because we have
def->os.firmware too.
NB, this wouldn't be a problem for active domain, because on
startup process def->os.loader->type gets filled by
qemuFirmwareEnableFeatures(), but that's not the case for
inactive domains.
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1729604
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
(cherry-picked from commit 7711a7346a990810603c0715d3c6ba922eb88c51)
Signed-off-by: Xu Yandong <xuyandong2@huawei.com>
---
src/qemu/qemu_domain.c | 10 ++++++----
.../aarch64-os-firmware-efi.aarch64-latest.args | 1 -
tests/qemuxml2argvdata/aarch64-os-firmware-efi.xml | 1 +
.../aarch64-os-firmware-efi.aarch64-latest.xml | 1 +
4 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index d71d9b3..56fadd5 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -4230,8 +4230,9 @@ qemuDomainDefValidate(const virDomainDef *def,
}
/* On x86, UEFI requires ACPI */
- if (def->os.loader &&
- def->os.loader->type == VIR_DOMAIN_LOADER_TYPE_PFLASH &&
+ if ((def->os.firmware == VIR_DOMAIN_OS_DEF_FIRMWARE_EFI ||
+ (def->os.loader &&
+ def->os.loader->type == VIR_DOMAIN_LOADER_TYPE_PFLASH)) &&
ARCH_IS_X86(def->os.arch) &&
def->features[VIR_DOMAIN_FEATURE_ACPI] != VIR_TRISTATE_SWITCH_ON) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
@@ -4242,8 +4243,9 @@ qemuDomainDefValidate(const virDomainDef *def,
/* On aarch64, ACPI requires UEFI */
if (def->features[VIR_DOMAIN_FEATURE_ACPI] == VIR_TRISTATE_SWITCH_ON &&
def->os.arch == VIR_ARCH_AARCH64 &&
- (!def->os.loader ||
- def->os.loader->type != VIR_DOMAIN_LOADER_TYPE_PFLASH)) {
+ (def->os.firmware != VIR_DOMAIN_OS_DEF_FIRMWARE_EFI &&
+ (!def->os.loader ||
+ def->os.loader->type != VIR_DOMAIN_LOADER_TYPE_PFLASH))) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("ACPI requires UEFI on this architecture"));
goto cleanup;
diff --git a/tests/qemuxml2argvdata/aarch64-os-firmware-efi.aarch64-latest.args b/tests/qemuxml2argvdata/aarch64-os-firmware-efi.aarch64-latest.args
index 9821e28..3914b6b 100644
--- a/tests/qemuxml2argvdata/aarch64-os-firmware-efi.aarch64-latest.args
+++ b/tests/qemuxml2argvdata/aarch64-os-firmware-efi.aarch64-latest.args
@@ -29,7 +29,6 @@ format=raw,unit=1 \
-mon chardev=charmonitor,id=monitor,mode=control \
-rtc base=utc \
-no-shutdown \
--no-acpi \
-boot strict=on \
-kernel /aarch64.kernel \
-initrd /aarch64.initrd \
diff --git a/tests/qemuxml2argvdata/aarch64-os-firmware-efi.xml b/tests/qemuxml2argvdata/aarch64-os-firmware-efi.xml
index c3e25f3..48605f7 100644
--- a/tests/qemuxml2argvdata/aarch64-os-firmware-efi.xml
+++ b/tests/qemuxml2argvdata/aarch64-os-firmware-efi.xml
@@ -13,6 +13,7 @@
<boot dev='hd'/>
</os>
<features>
+ <acpi/>
<apic/>
<pae/>
<gic version='2'/>
diff --git a/tests/qemuxml2xmloutdata/aarch64-os-firmware-efi.aarch64-latest.xml b/tests/qemuxml2xmloutdata/aarch64-os-firmware-efi.aarch64-latest.xml
index 529ce6f..1e51d55 100644
--- a/tests/qemuxml2xmloutdata/aarch64-os-firmware-efi.aarch64-latest.xml
+++ b/tests/qemuxml2xmloutdata/aarch64-os-firmware-efi.aarch64-latest.xml
@@ -13,6 +13,7 @@
<boot dev='hd'/>
</os>
<features>
+ <acpi/>
<apic/>
<pae/>
<gic version='2'/>
--
2.19.1

View File

@ -1,56 +0,0 @@
From c829c453baad259c1161dcd4bfed4b9a9372e6b2 Mon Sep 17 00:00:00 2001
From: Michal Privoznik <mprivozn@redhat.com>
Date: Wed, 26 Jun 2019 15:35:11 +0200
Subject: [PATCH] qemu: Validate disk against domain def on coldplug
https://bugzilla.redhat.com/show_bug.cgi?id=1692296#c7
This is a counterpart for ddc72f99027 and implements the same
check for coldplug.
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
(cherry-picked from commit 881686d4b15306fd5a5f0592d502ddb33ee6437e)
Signed-off-by: Xu Yandong <xuyandong2@huawei.com>
---
src/qemu/qemu_driver.c | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 5791c42..f80bdeb 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -8078,6 +8078,21 @@ qemuDomainUpdateDeviceLive(virDomainObjPtr vm,
return ret;
}
+
+static int
+qemuCheckDiskConfigAgainstDomain(const virDomainDef *def,
+ const virDomainDiskDef *disk)
+{
+ if (virDomainSCSIDriveAddressIsUsed(def, &disk->info.addr.drive)) {
+ virReportError(VIR_ERR_OPERATION_INVALID, "%s",
+ _("Domain already contains a disk with that address"));
+ return -1;
+ }
+
+ return 0;
+}
+
+
static int
qemuDomainAttachDeviceConfig(virDomainDefPtr vmdef,
virDomainDeviceDefPtr dev,
@@ -8106,6 +8121,8 @@ qemuDomainAttachDeviceConfig(virDomainDefPtr vmdef,
return -1;
if (qemuCheckDiskConfig(disk, NULL) < 0)
return -1;
+ if (qemuCheckDiskConfigAgainstDomain(vmdef, disk) < 0)
+ return -1;
if (virDomainDiskInsert(vmdef, disk) < 0)
return -1;
/* vmdef has the pointer. Generic codes for vmdef will do all jobs */
--
2.19.1

View File

@ -1,31 +0,0 @@
From 7487eaefca026da3b0ccc8e8872a8e7ba0101640 Mon Sep 17 00:00:00 2001
From: Feng Ni <fengni@huawei.com>
Date: Thu, 25 Jul 2019 15:37:14 +0800
Subject: [PATCH] qemu: add pointer check in qemuMonitorLastError
We found a exception when libvirt occurrs segmentation fault.
thread 1 is waiting object lock in qemuConnectMonitor,
qemu process exits and sends EOF event as well, so thread 2 invokes
qemuMonitorLastError but pointer mon is NULL.
Signed-off-by: Feng Ni <fengni@huawei.com>
---
src/qemu/qemu_monitor.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c
index 731be2e..a5eeec6 100644
--- a/src/qemu/qemu_monitor.c
+++ b/src/qemu/qemu_monitor.c
@@ -1103,7 +1103,7 @@ qemuMonitorSend(qemuMonitorPtr mon,
virErrorPtr
qemuMonitorLastError(qemuMonitorPtr mon)
{
- if (mon->lastError.code == VIR_ERR_OK)
+ if (!mon || mon->lastError.code == VIR_ERR_OK)
return NULL;
return virErrorCopyNew(&mon->lastError);
--
2.19.1

View File

@ -1,55 +0,0 @@
From 505d6028f8d9351165e1cf42701ba83c68be4bbe Mon Sep 17 00:00:00 2001
From: Peter Krempa <pkrempa@redhat.com>
Date: Fri, 16 Aug 2019 17:01:10 +0200
Subject: [PATCH] qemu: alias: Generate 'qomName' of disk with useraliases
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Commit fb64e176f4f forgot to delete the check that short-circuits the
disk alias creation if the alias is already present. The side effect
of this is that the creation qomName which is necessary to be able to
refer to disk frontends when -blockdev is used was skipped when user
aliases are used.
Fix it by deleting the check. Also prevent any potential memory leaks
from calling this function repeatedly by creating the qomName only when
it's not present.
https://bugzilla.redhat.com/show_bug.cgi?id=1741838
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
(cherry-picked from commit b8222be5831261578e60ce2e867a968a6f80f67d)
Signed-off-by: Xu Yandong <xuyandong2@huawei.com>
---
src/qemu/qemu_alias.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/src/qemu/qemu_alias.c b/src/qemu/qemu_alias.c
index 585cc97..216a18d 100644
--- a/src/qemu/qemu_alias.c
+++ b/src/qemu/qemu_alias.c
@@ -182,9 +182,6 @@ qemuAssignDeviceDiskAlias(virDomainDefPtr def,
const char *prefix = virDomainDiskBusTypeToString(disk->bus);
int controllerModel = -1;
- if (disk->info.alias)
- return 0;
-
if (!disk->info.alias) {
if (disk->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_DRIVE) {
if (disk->bus == VIR_DOMAIN_DISK_BUS_SCSI) {
@@ -220,7 +217,8 @@ qemuAssignDeviceDiskAlias(virDomainDefPtr def,
* on the alias in qemu. While certain disk types use just the alias, some
* need the full path into /machine/peripheral as a historical artifact.
*/
- if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_BLOCKDEV)) {
+ if (!diskPriv->qomName &&
+ virQEMUCapsGet(qemuCaps, QEMU_CAPS_BLOCKDEV)) {
switch ((virDomainDiskBus) disk->bus) {
case VIR_DOMAIN_DISK_BUS_FDC:
case VIR_DOMAIN_DISK_BUS_IDE:
--
2.21.0

View File

@ -1,89 +0,0 @@
From 23a7b3445fb342b02326e9cb6ea5ee5f80e680c1 Mon Sep 17 00:00:00 2001
From: Xu Yandong <xuyandong2@huawei.com>
Date: Wed, 25 Dec 2019 11:04:59 +0800
Subject: [PATCH] qemu: avoid double reservation of PCI address for interface
type='hostdev'
Commit 01ca4010d86 (libvirt v5.1.0) moved address reservation for
hotplugged interface devices up to an earlier point in
qemuDomainAttachNetDevice(), because that function calls
qemuDomainSupportsNicdev() (in the case of
VIR_DOMAIN_NET_TYPE_VHOSTUSER), and qemuDomainSupportsNicdev() needs
to know the address type (for ARM machinetypes) and returns incorrect
results when the address type is "none".
This bugfix unfortunately caused a regression, because it also made PCI
address reservation happen before we noticed that the device was a
*hostdev* interface. Those interfaces are hotplugged by just calling
out to qemuDomainAttachHostdevDevice() - that function would then also
attempt to reserve the *same PCI address* that had just been reserved
in qemuDomainAttachNetDevice().
The solution is to move the bit of code that short-circuits out to
virDomainHostdevAttach() up *even earlier* so that no PCI address has
been allocated by the time it's called.
https://bugzilla.redhat.com/show_bug.cgi?id=1744523
Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
(cherry-picked from commit 47a7b8a96b6343d4af18ef80330f805ef031fe9b)
Signed-off-by: Xu Yandong <xuyandong2@huawei.com>
---
src/qemu/qemu_hotplug.c | 27 ++++++++++++++++-----------
1 file changed, 16 insertions(+), 11 deletions(-)
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index 08b6e8b..a26a3c2 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -1129,6 +1129,18 @@ qemuDomainAttachNetDevice(virQEMUDriverPtr driver,
if (qemuAssignDeviceNetAlias(vm->def, net, -1) < 0)
goto cleanup;
+ if (actualType == VIR_DOMAIN_NET_TYPE_HOSTDEV) {
+ /* This is really a "smart hostdev", so it should be attached
+ * as a hostdev (the hostdev code will reach over into the
+ * netdev-specific code as appropriate), then also added to
+ * the nets list (see cleanup:) if successful.
+ */
+ ret = qemuDomainAttachHostDevice(driver, vm,
+ virDomainNetGetActualHostdev(net));
+ goto cleanup;
+ }
+
+
if (qemuDomainIsS390CCW(vm->def) &&
net->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI &&
virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_CCW)) {
@@ -1208,17 +1220,6 @@ qemuDomainAttachNetDevice(virQEMUDriverPtr driver,
goto cleanup;
break;
- case VIR_DOMAIN_NET_TYPE_HOSTDEV:
- /* This is really a "smart hostdev", so it should be attached
- * as a hostdev (the hostdev code will reach over into the
- * netdev-specific code as appropriate), then also added to
- * the nets list (see cleanup:) if successful.
- */
- ret = qemuDomainAttachHostDevice(driver, vm,
- virDomainNetGetActualHostdev(net));
- goto cleanup;
- break;
-
case VIR_DOMAIN_NET_TYPE_VHOSTUSER:
queueSize = net->driver.virtio.queues;
if (!queueSize)
@@ -1242,6 +1243,10 @@ qemuDomainAttachNetDevice(virQEMUDriverPtr driver,
/* No preparation needed. */
break;
+ case VIR_DOMAIN_NET_TYPE_HOSTDEV:
+ /* hostdev interfaces were handled earlier in this function */
+ break;
+
case VIR_DOMAIN_NET_TYPE_SERVER:
case VIR_DOMAIN_NET_TYPE_CLIENT:
case VIR_DOMAIN_NET_TYPE_MCAST:
--
2.21.0

View File

@ -1,42 +0,0 @@
From d65307ab8bfeb67075bef1fb643aaaf3fa86a790 Mon Sep 17 00:00:00 2001
From: Feng Ni <fengni@huawei.com>
Date: Thu, 25 Jul 2019 20:29:11 +0800
Subject: [PATCH] qemu: clear vcpupin when unhotplug vcpu
step1: hotplug vcpus
step2: pin vcpus
step3: unhotplug vcpus
As a result, vcpu pin info still show up in xml.
So we need clear it.
Signed-off-by: Feng Ni <fengni@huawei.com>
---
src/qemu/qemu_hotplug.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index 7e9c1a1..08b6e8b 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -6008,6 +6008,9 @@ qemuDomainHotplugDelVcpu(virQEMUDriverPtr driver,
qemuDomainVcpuPersistOrder(vm->def);
+ virBitmapFree(vcpuinfo->cpumask);
+ vcpuinfo->cpumask = NULL;
+
if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm, driver->caps) < 0)
goto cleanup;
@@ -6293,6 +6296,8 @@ qemuDomainSetVcpusConfig(virDomainDefPtr def,
vcpu->online = false;
vcpu->hotpluggable = VIR_TRISTATE_BOOL_YES;
+ virBitmapFree(vcpu->cpumask);
+ vcpu->cpumask = NULL;
if (--curvcpus == nvcpus)
break;
--
2.19.1

View File

@ -1,173 +0,0 @@
From f2110c4d26ec4cef5384edbdd23a31d5691cb924 Mon Sep 17 00:00:00 2001
From: Xu Yandong <xuyandong2@huawei.com>
Date: Sat, 9 May 2020 14:54:30 +0800
Subject: [PATCH] qemu: don't hold both jobs for suspend
We have to assume that the guest agent may be malicious so we don't want
to allow any agent queries to block any other libvirt API. By holding a
monitor job while we're querying the agent, we open ourselves up to a
DoS.
So split the function up a bit to only hold the monitor job while
querying qemu for whether the domain supports suspend. Then acquire only
an agent job while issuing the agent suspend command.
Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
(cherry-picked from commit 7317a83f6024dd6b4e1fa19436e24db0132b6cb9)
Signed-off-by: Xu Yandong <xuyandong2@huawei.com>
---
src/qemu/qemu_driver.c | 94 ++++++++++++++++++++++++++----------------
1 file changed, 59 insertions(+), 35 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 8749c53..dad0710 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -19088,6 +19088,59 @@ qemuDomainProbeQMPCurrentMachine(virQEMUDriverPtr driver,
}
+/* returns -1 on error, or if query is not supported, 0 if query was successful */
+static int
+qemuDomainQueryWakeupSuspendSupport(virQEMUDriverPtr driver,
+ virDomainObjPtr vm,
+ bool *wakeupSupported)
+{
+ qemuDomainObjPrivatePtr priv = vm->privateData;
+ int ret = -1;
+
+ if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_QUERY_CURRENT_MACHINE))
+ return -1;
+
+ if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_MODIFY) < 0)
+ return -1;
+
+ if ((ret = virDomainObjCheckActive(vm)) < 0)
+ goto endjob;
+
+ ret = qemuDomainProbeQMPCurrentMachine(driver, vm, wakeupSupported);
+
+ endjob:
+ qemuDomainObjEndJob(driver, vm);
+ return ret;
+}
+
+
+static int
+qemuDomainPMSuspendAgent(virQEMUDriverPtr driver,
+ virDomainObjPtr vm,
+ unsigned int target)
+{
+ qemuAgentPtr agent;
+ int ret = -1;
+
+ if (qemuDomainObjBeginAgentJob(driver, vm, QEMU_AGENT_JOB_MODIFY) < 0)
+ return -1;
+
+ if ((ret = virDomainObjCheckActive(vm)) < 0)
+ goto endjob;
+
+ if (!qemuDomainAgentAvailable(vm, true))
+ goto endjob;
+
+ agent = qemuDomainObjEnterAgent(vm);
+ ret = qemuAgentSuspend(agent, target);
+ qemuDomainObjExitAgent(vm, agent);
+
+ endjob:
+ qemuDomainObjEndAgentJob(vm);
+ return ret;
+}
+
+
static int
qemuDomainPMSuspendForDuration(virDomainPtr dom,
unsigned int target,
@@ -19095,11 +19148,9 @@ qemuDomainPMSuspendForDuration(virDomainPtr dom,
unsigned int flags)
{
virQEMUDriverPtr driver = dom->conn->privateData;
- qemuDomainObjPrivatePtr priv;
virDomainObjPtr vm;
- qemuAgentPtr agent;
- qemuDomainJob job = QEMU_JOB_NONE;
int ret = -1;
+ bool wakeupSupported;
virCheckFlags(0, -1);
@@ -19124,17 +19175,6 @@ qemuDomainPMSuspendForDuration(virDomainPtr dom,
if (virDomainPMSuspendForDurationEnsureACL(dom->conn, vm->def) < 0)
goto cleanup;
- priv = vm->privateData;
-
- if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_QUERY_CURRENT_MACHINE))
- job = QEMU_JOB_MODIFY;
-
- if (qemuDomainObjBeginJobWithAgent(driver, vm, job, QEMU_AGENT_JOB_MODIFY) < 0)
- goto cleanup;
-
- if (virDomainObjCheckActive(vm) < 0)
- goto endjob;
-
/*
* The case we want to handle here is when QEMU has the API (i.e.
* QEMU_CAPS_QUERY_CURRENT_MACHINE is set). Otherwise, do not interfere
@@ -19142,16 +19182,11 @@ qemuDomainPMSuspendForDuration(virDomainPtr dom,
* that don't know about this cap, will keep their old behavior of
* suspending 'in the dark'.
*/
- if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_QUERY_CURRENT_MACHINE)) {
- bool wakeupSupported;
-
- if (qemuDomainProbeQMPCurrentMachine(driver, vm, &wakeupSupported) < 0)
- goto endjob;
-
+ if (qemuDomainQueryWakeupSuspendSupport(driver, vm, &wakeupSupported) == 0) {
if (!wakeupSupported) {
virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
_("Domain does not have suspend support"));
- goto endjob;
+ goto cleanup;
}
}
@@ -19161,29 +19196,18 @@ qemuDomainPMSuspendForDuration(virDomainPtr dom,
target == VIR_NODE_SUSPEND_TARGET_HYBRID)) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("S3 state is disabled for this domain"));
- goto endjob;
+ goto cleanup;
}
if (vm->def->pm.s4 == VIR_TRISTATE_BOOL_NO &&
target == VIR_NODE_SUSPEND_TARGET_DISK) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("S4 state is disabled for this domain"));
- goto endjob;
+ goto cleanup;
}
}
- if (!qemuDomainAgentAvailable(vm, true))
- goto endjob;
-
- agent = qemuDomainObjEnterAgent(vm);
- ret = qemuAgentSuspend(agent, target);
- qemuDomainObjExitAgent(vm, agent);
-
- endjob:
- if (job)
- qemuDomainObjEndJobWithAgent(driver, vm);
- else
- qemuDomainObjEndAgentJob(vm);
+ ret = qemuDomainPMSuspendAgent(driver, vm, target);
cleanup:
virDomainObjEndAPI(&vm);
--
2.21.0

View File

@ -1,29 +0,0 @@
From 04c959123d238c5922389381b02155bc8b66dc6c Mon Sep 17 00:00:00 2001
From: Xu Yandong <xuyandong2@huawei.com>
Date: Fri, 16 Aug 2019 21:00:10 +0800
Subject: [PATCH] qemu: fix Validate scsi disk against domain def on coldplug
Check the disk scsi address only when the disk is scsi type.
Signed-off-by: Xu Yandong <xuyandong2@huawei.com>
---
src/qemu/qemu_driver.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index f80bdeb..617d7d5 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -8083,7 +8083,8 @@ static int
qemuCheckDiskConfigAgainstDomain(const virDomainDef *def,
const virDomainDiskDef *disk)
{
- if (virDomainSCSIDriveAddressIsUsed(def, &disk->info.addr.drive)) {
+ if (disk->bus == VIR_DOMAIN_DISK_BUS_SCSI &&
+ virDomainSCSIDriveAddressIsUsed(def, &disk->info.addr.drive)) {
virReportError(VIR_ERR_OPERATION_INVALID, "%s",
_("Domain already contains a disk with that address"));
return -1;
--
2.19.1

View File

@ -1,33 +0,0 @@
From 19078ccc1e2160dcb4b223097c6bbc032567514b Mon Sep 17 00:00:00 2001
From: Feng Ni <fengni@huawei.com>
Date: Thu, 25 Jul 2019 20:43:07 +0800
Subject: [PATCH] qemu: fix a concurrent operation situation
Migrate vm and shutdown in guestos, interface do not return occasionally.
In function qemuMigrationSrcNBDStorageCopy, it may be alays in while loop
if qemu exits.
Signed-off-by: Feng Ni <fengni@huawei.com>
---
src/qemu/qemu_migration.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index 2436f50..c6f2436 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -1032,6 +1032,11 @@ qemuMigrationSrcNBDStorageCopy(virQEMUDriverPtr driver,
if (rv < 0)
goto cleanup;
+ if (!virDomainObjIsActive(vm)) {
+ VIR_ERROR(_("domain is no longer running, migrate will end"));
+ goto cleanup;
+ }
+
if (priv->job.abortJob) {
priv->job.current->status = QEMU_DOMAIN_JOB_STATUS_CANCELED;
virReportError(VIR_ERR_OPERATION_ABORTED, _("%s: %s"),
--
2.19.1

View File

@ -1,74 +0,0 @@
From 34b8be0d7bd7980ee8be6ca70685788ed81b087b Mon Sep 17 00:00:00 2001
From: Feng Ni <fengni@huawei.com>
Date: Thu, 25 Jul 2019 15:20:52 +0800
Subject: [PATCH] qemu: fix potential memory leak
function virTypedParamsAddString may return -1 but alloc params,
so invoker should free it.
Signed-off-by: Feng Ni <fengni@huawei.com>
---
src/qemu/qemu_driver.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index ef2e980..5791c42 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -5093,6 +5093,8 @@ qemuDomainPinVcpuLive(virDomainObjPtr vm,
goto cleanup;
event = virDomainEventTunableNewFromObj(vm, eventParams, eventNparams);
+ eventParams = NULL;
+ eventNparams = 0;
ret = 0;
@@ -5101,6 +5103,8 @@ qemuDomainPinVcpuLive(virDomainObjPtr vm,
virCgroupFree(&cgroup_vcpu);
VIR_FREE(str);
virObjectEventStateQueue(driver->domainEventState, event);
+ if (eventParams)
+ virTypedParamsFree(eventParams, eventNparams);
return ret;
}
@@ -5308,6 +5312,8 @@ qemuDomainPinEmulator(virDomainPtr dom,
goto endjob;
event = virDomainEventTunableNewFromDom(dom, eventParams, eventNparams);
+ eventParams = NULL;
+ eventNparams = 0;
}
if (persistentDef) {
@@ -5329,6 +5335,8 @@ qemuDomainPinEmulator(virDomainPtr dom,
cleanup:
if (cgroup_emulator)
virCgroupFree(&cgroup_emulator);
+ if (eventParams)
+ virTypedParamsFree(eventParams, eventNparams);
virObjectEventStateQueue(driver->domainEventState, event);
VIR_FREE(str);
virBitmapFree(pcpumap);
@@ -5793,6 +5801,8 @@ qemuDomainPinIOThread(virDomainPtr dom,
goto endjob;
event = virDomainEventTunableNewFromDom(dom, eventParams, eventNparams);
+ eventParams = NULL;
+ eventNparams = 0;
}
if (persistentDef) {
@@ -5824,6 +5834,8 @@ qemuDomainPinIOThread(virDomainPtr dom,
cleanup:
if (cgroup_iothread)
virCgroupFree(&cgroup_iothread);
+ if (eventParams)
+ virTypedParamsFree(eventParams, eventNparams);
virObjectEventStateQueue(driver->domainEventState, event);
VIR_FREE(str);
virBitmapFree(pcpumap);
--
2.19.1

View File

@ -1,128 +0,0 @@
From 448fde35ded33356308f630959a1f96c89739b97 Mon Sep 17 00:00:00 2001
From: Xu Yandong <xuyandong2@huawei.com>
Date: Wed, 25 Dec 2019 11:14:53 +0800
Subject: [PATCH] qemu: homogenize MAC address in live & config when
hotplugging a netdev
Prior to commit 55ce6564634 (first in libvirt 4.6.0), the XML sent to
virDomainAttachDeviceFlags() was parsed only once, and the results of
that parse were inserted into both the live object of the running
domain and into the persistent config. Thus, if MAC address was
omitted from in XML for a network device (<interface>), both the live
and config object would have the same MAC address.
Commit 55ce6564634 changed the code to parse the incoming XML twice -
once for live and once for config. This does eliminate the problem of
PCI (/scsi/sata) address conflicts caused by allocating an address
based on existing devices in live object, but then inserting the
result into the config (which may already have a device using that
address), BUT it also means that when the MAC address of a network
device hasn't been specified in the XML, each copy will get a
different auto-generated MAC address.
This results in the MAC address of the device changing the next time
the domain is shutdown and restarted, which creates havoc with the
guest OS's network config.
There have been several discussions about this in the last > 1 year,
attempting to find the ideal solution to this problem that makes MAC
addresses consistent and accounts for all sorts of corner cases with
PCI/scsi/sata addresses. All of these discussions fizzled out because
every proposal was either too difficult to implement or failed to fix
some esoteric case someone thought up.
So, in the interest of solving the MAC address problem while not
making the "other address" situation any worse than before, this patch
simply adds a qemuDomainAttachDeviceLiveAndConfigHomogenize() function
that (for now) copies the MAC address from the config object to the
live object (if the original xml had <mac address='blah'/> then this
will be an effective NOP (as the macs already match)).
Any downstream libvirt containing upstream commit
55ce6564634 should have this patch as well.
https://bugzilla.redhat.com/1783411
Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
(cherry-picked from commit 6c17606b7cce7bf77baef956bde8a0b056666011)
Signed-off-by: Xu Yandong <xuyandong2@huawei.com>
---
src/qemu/qemu_driver.c | 40 ++++++++++++++++++++++++++++++++++++++++
1 file changed, 40 insertions(+)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 7ff7d92..8749c53 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -8592,6 +8592,35 @@ qemuDomainUpdateDeviceConfig(virDomainDefPtr vmdef,
return 0;
}
+
+static void
+qemuDomainAttachDeviceLiveAndConfigHomogenize(const virDomainDeviceDef *devConf,
+ virDomainDeviceDefPtr devLive)
+{
+ /*
+ * Fixup anything that needs to be identical in the live and
+ * config versions of DeviceDef, but might not be. Do this by
+ * changing the contents of devLive. This is done after all
+ * post-parse tweaks and validation, so be very careful about what
+ * changes are made. (For example, it would be a very bad idea to
+ * change assigned PCI, scsi, or sata addresses, as it could lead
+ * to a conflict and there would be nothing to catch it except
+ * qemu itself!)
+ */
+
+ /* MAC address should be identical in both DeviceDefs, but if it
+ * wasn't specified in the XML, and was instead autogenerated, it
+ * will be different for the two since they are each the result of
+ * a separate parser call. If it *was* specified, it will already
+ * be the same, so copying does no harm.
+ */
+
+ if (devConf->type == VIR_DOMAIN_DEVICE_NET)
+ virMacAddrSet(&devLive->data.net->mac, &devConf->data.net->mac);
+
+}
+
+
static int
qemuDomainAttachDeviceLiveAndConfig(virDomainObjPtr vm,
virQEMUDriverPtr driver,
@@ -8601,6 +8630,7 @@ qemuDomainAttachDeviceLiveAndConfig(virDomainObjPtr vm,
virDomainDefPtr vmdef = NULL;
virQEMUDriverConfigPtr cfg = NULL;
virDomainDeviceDefPtr devConf = NULL;
+ virDomainDeviceDef devConfSave = { 0 };
virDomainDeviceDefPtr devLive = NULL;
int ret = -1;
virCapsPtr caps = NULL;
@@ -8627,6 +8657,13 @@ qemuDomainAttachDeviceLiveAndConfig(virDomainObjPtr vm,
driver->xmlopt, parse_flags)))
goto cleanup;
+ /*
+ * devConf will be NULLed out by
+ * qemuDomainAttachDeviceConfig(), so save it for later use by
+ * qemuDomainAttachDeviceLiveAndConfigHomogenize()
+ */
+ devConfSave = *devConf;
+
if (virDomainDeviceValidateAliasForHotplug(vm, devConf,
VIR_DOMAIN_AFFECT_CONFIG) < 0)
goto cleanup;
@@ -8647,6 +8684,9 @@ qemuDomainAttachDeviceLiveAndConfig(virDomainObjPtr vm,
driver->xmlopt, parse_flags)))
goto cleanup;
+ if (flags & VIR_DOMAIN_AFFECT_CONFIG)
+ qemuDomainAttachDeviceLiveAndConfigHomogenize(&devConfSave, devLive);
+
if (virDomainDeviceValidateAliasForHotplug(vm, devLive,
VIR_DOMAIN_AFFECT_LIVE) < 0)
goto cleanup;
--
2.21.0

View File

@ -1,36 +0,0 @@
From ba3884fbb6321923d6b3f88dce82ba01974f8a4d Mon Sep 17 00:00:00 2001
From: Xu Yandong <xuyandong2@huawei.com>
Date: Thu, 25 Jul 2019 12:18:23 +0800
Subject: [PATCH] qemu_conf: clear domain before VIR_DELETE_ELEMENT
The macro VIR_DELETE_ELEMENT assume that the items being deleted have
already been cleared, so we must explicitly delete domain memory to
prevent a memory leak.
Signed-off-by: Xu Yandong <xuyandong2@huawei.com>
---
src/qemu/qemu_conf.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c
index 8312f99..29bd07e 100644
--- a/src/qemu/qemu_conf.c
+++ b/src/qemu/qemu_conf.c
@@ -1672,10 +1672,12 @@ qemuSharedDeviceEntryRemove(virQEMUDriverPtr driver,
if (!qemuSharedDeviceEntryDomainExists(entry, name, &idx))
return 0;
- if (entry->ref != 1)
+ if (entry->ref != 1) {
+ VIR_FREE(entry->domains[idx]);
VIR_DELETE_ELEMENT(entry->domains, idx, entry->ref);
- else
+ } else {
ignore_value(virHashRemoveEntry(driver->sharedDevices, key));
+ }
return 0;
}
--
2.19.1

View File

@ -1,28 +0,0 @@
From 2a4b0d76a0701f8895d612918ad77a30a2062263 Mon Sep 17 00:00:00 2001
From: Feng Ni <fengni@huawei.com>
Date: Thu, 25 Jul 2019 15:26:25 +0800
Subject: [PATCH] remote: fix a memory free error
In function remoteDeserializeDomainDiskErrors, there is a typo.
Signed-off-by: Feng Ni <fengni@huawei.com>
---
src/remote/remote_driver.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c
index df58b23..ba98212 100644
--- a/src/remote/remote_driver.c
+++ b/src/remote/remote_driver.c
@@ -1813,7 +1813,7 @@ remoteDeserializeDomainDiskErrors(remote_domain_disk_error *ret_errors_val,
error:
for (j = 0; j < i; j++)
- VIR_FREE(errors[i].disk);
+ VIR_FREE(errors[j].disk);
return -1;
}
--
2.19.1

View File

@ -1,37 +0,0 @@
From 13722d386dc65077976d4c557ddcc3458493e9dc Mon Sep 17 00:00:00 2001
From: Pino Toscano <ptoscano@redhat.com>
Date: Thu, 4 Jul 2019 12:38:26 +0200
Subject: [PATCH] remote: mention libssh in error message
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Mention libssh as possible transport in the error message of an
unrecognized transport.
https://bugzilla.redhat.com/show_bug.cgi?id=1727013
Signed-off-by: Pino Toscano <ptoscano@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
(cherry-picked from commit cfec206e84d6151007a38a9228e10a23b8df57a8)
Signed-off-by: Xu Yandong <xuyandong2@huawei.com>
---
src/remote/remote_driver.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c
index ba98212..c5fcbdb 100644
--- a/src/remote/remote_driver.c
+++ b/src/remote/remote_driver.c
@@ -825,7 +825,7 @@ doRemoteOpen(virConnectPtr conn,
} else {
virReportError(VIR_ERR_INVALID_ARG, "%s",
_("remote_open: transport in URL not recognised "
- "(should be tls|unix|ssh|ext|tcp|libssh2)"));
+ "(should be tls|unix|ssh|ext|tcp|libssh2|libssh)"));
return VIR_DRV_OPEN_ERROR;
}
}
--
2.19.1

View File

@ -1,35 +0,0 @@
From a86a87fc28aee52af46f75ad13e4638e00e06b34 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A1n=20Tomko?= <jtomko@redhat.com>
Date: Fri, 12 Jul 2019 16:11:16 +0200
Subject: [PATCH] storage: rbd: actually index the array when iterating over it
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
https://bugzilla.redhat.com/show_bug.cgi?id=1729292
Fixes: 3aa190f2a43a632b542a6ba751a6c3ab4d51f1dd
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
(cherry-picked from commit 9b7c4048fa0559fd81d57b7f7d13b1dccd6a99b2)
Signed-off-by: Xu Yandong <xuyandong2@huawei.com>
---
src/storage/storage_backend_rbd.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/storage/storage_backend_rbd.c b/src/storage/storage_backend_rbd.c
index d305628..1cb447c 100644
--- a/src/storage/storage_backend_rbd.c
+++ b/src/storage/storage_backend_rbd.c
@@ -637,7 +637,7 @@ virStorageBackendRBDGetVolNames(virStorageBackendRBDStatePtr ptr)
nnames = nimages;
for (i = 0; i < nimages; i++)
- VIR_STEAL_PTR(names[i], images->name);
+ VIR_STEAL_PTR(names[i], images[i]->name);
return names;
--
2.19.1

View File

@ -1,35 +0,0 @@
From 51cf4c75664fd6653a3bf9cb8b83a5a1a0496e5f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A1n=20Tomko?= <jtomko@redhat.com>
Date: Fri, 12 Jul 2019 16:09:32 +0200
Subject: [PATCH] storage: rbd: use VIR_REALLOC in the loop
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
If there are more than 16 images, the memory allocated in images
might be leaked on subsequent execution(s).
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
(cherry-picked from commit d43bc53eddd49c8c22cb52f8b6554e1f7d4216f8)
Signed-off-by: Xu Yandong <xuyandong2@huawei.com>
---
src/storage/storage_backend_rbd.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/storage/storage_backend_rbd.c b/src/storage/storage_backend_rbd.c
index 315bef2..d305628 100644
--- a/src/storage/storage_backend_rbd.c
+++ b/src/storage/storage_backend_rbd.c
@@ -620,7 +620,7 @@ virStorageBackendRBDGetVolNames(virStorageBackendRBDStatePtr ptr)
size_t i;
while (true) {
- if (VIR_ALLOC_N(images, nimages) < 0)
+ if (VIR_REALLOC_N(images, nimages) < 0)
goto error;
rc = rbd_list2(ptr->ioctx, images, &nimages);
--
2.19.1

View File

@ -1,263 +0,0 @@
From 940df0f99ab0fcc350fca0df29c74b2f6674cb8a Mon Sep 17 00:00:00 2001
From: Xu Yandong <xuyandong2@huawei.com>
Date: Mon, 16 Oct 2017 17:45:48 +0800
Subject: [PATCH] tests: add baseline test cases for arm CPU
add baseline test cases for aarch64
Signed-off-by: Xu Yandong <xuyandong2@huawei.com>
---
tests/cputest.c | 7 +++++
.../aarch64-baseline-incompatible-vendors.xml | 26 +++++++++++++++++++
...-baseline-no-compatible-feature-result.xml | 4 +++
...aarch64-baseline-no-compatible-feature.xml | 19 ++++++++++++++
.../aarch64-baseline-no-feature-result.xml | 4 +++
.../aarch64-baseline-no-feature.xml | 7 +++++
.../cputestdata/aarch64-baseline-no-model.xml | 13 ++++++++++
.../aarch64-baseline-no-vendor-result.xml | 10 +++++++
.../aarch64-baseline-no-vendor.xml | 13 ++++++++++
...baseline-one-compatible-feature-result.xml | 5 ++++
...arch64-baseline-one-compatible-feature.xml | 20 ++++++++++++++
.../aarch64-baseline-one-feature-result.xml | 5 ++++
.../aarch64-baseline-one-feature.xml | 8 ++++++
13 files changed, 141 insertions(+)
create mode 100644 tests/cputestdata/aarch64-baseline-incompatible-vendors.xml
create mode 100644 tests/cputestdata/aarch64-baseline-no-compatible-feature-result.xml
create mode 100644 tests/cputestdata/aarch64-baseline-no-compatible-feature.xml
create mode 100644 tests/cputestdata/aarch64-baseline-no-feature-result.xml
create mode 100644 tests/cputestdata/aarch64-baseline-no-feature.xml
create mode 100644 tests/cputestdata/aarch64-baseline-no-model.xml
create mode 100644 tests/cputestdata/aarch64-baseline-no-vendor-result.xml
create mode 100644 tests/cputestdata/aarch64-baseline-no-vendor.xml
create mode 100644 tests/cputestdata/aarch64-baseline-one-compatible-feature-result.xml
create mode 100644 tests/cputestdata/aarch64-baseline-one-compatible-feature.xml
create mode 100644 tests/cputestdata/aarch64-baseline-one-feature-result.xml
create mode 100644 tests/cputestdata/aarch64-baseline-one-feature.xml
diff --git a/tests/cputest.c b/tests/cputest.c
index 6e28e05..ee754bb 100644
--- a/tests/cputest.c
+++ b/tests/cputest.c
@@ -1207,6 +1207,13 @@ mymain(void)
DO_TEST_BASELINE(VIR_ARCH_PPC64, "same-model", 0, 0);
DO_TEST_BASELINE(VIR_ARCH_PPC64, "legacy", 0, -1);
+ DO_TEST_BASELINE(VIR_ARCH_AARCH64, "incompatible-vendors", 0, -1);
+ DO_TEST_BASELINE(VIR_ARCH_AARCH64, "no-vendor", 0, 0);
+ DO_TEST_BASELINE(VIR_ARCH_AARCH64, "no-feature", 0, 0);
+ DO_TEST_BASELINE(VIR_ARCH_AARCH64, "one-feature", 0, 0);
+ DO_TEST_BASELINE(VIR_ARCH_AARCH64, "no-compatible-feature", 0, 0);
+ DO_TEST_BASELINE(VIR_ARCH_AARCH64, "one-compatible-feature", 0, 0);
+
/* CPU features */
DO_TEST_HASFEATURE(VIR_ARCH_X86_64, "host", "vmx", YES);
DO_TEST_HASFEATURE(VIR_ARCH_X86_64, "host", "lm", YES);
diff --git a/tests/cputestdata/aarch64-baseline-incompatible-vendors.xml b/tests/cputestdata/aarch64-baseline-incompatible-vendors.xml
new file mode 100644
index 0000000..f2c71a1
--- /dev/null
+++ b/tests/cputestdata/aarch64-baseline-incompatible-vendors.xml
@@ -0,0 +1,26 @@
+<cpuTest>
+<cpu>
+ <arch>aarch64</arch>
+ <model>cortex-a57</model>
+ <vendor>ARM</vendor>
+ <feature name='fp'/>
+ <feature name='asimd'/>
+ <feature name='aes'/>
+ <feature name='pmull'/>
+ <feature name='sha1'/>
+ <feature name='sha2'/>
+ <feature name='crc32'/>
+</cpu>
+<cpu>
+ <arch>aarch64</arch>
+ <model>cortex-a72</model>
+ <vendor>Hisilicon</vendor>
+ <feature name='fp'/>
+ <feature name='asimd'/>
+ <feature name='aes'/>
+ <feature name='pmull'/>
+ <feature name='sha1'/>
+ <feature name='sha2'/>
+ <feature name='crc32'/>
+</cpu>
+</cpuTest>
diff --git a/tests/cputestdata/aarch64-baseline-no-compatible-feature-result.xml b/tests/cputestdata/aarch64-baseline-no-compatible-feature-result.xml
new file mode 100644
index 0000000..6db66aa
--- /dev/null
+++ b/tests/cputestdata/aarch64-baseline-no-compatible-feature-result.xml
@@ -0,0 +1,4 @@
+<cpu mode='custom' match='exact'>
+ <model fallback='forbid'>cortex-a57</model>
+ <vendor>ARM</vendor>
+</cpu>
diff --git a/tests/cputestdata/aarch64-baseline-no-compatible-feature.xml b/tests/cputestdata/aarch64-baseline-no-compatible-feature.xml
new file mode 100644
index 0000000..5fd3228
--- /dev/null
+++ b/tests/cputestdata/aarch64-baseline-no-compatible-feature.xml
@@ -0,0 +1,19 @@
+<cpuTest>
+<cpu>
+ <arch>aarch64</arch>
+ <model>cortex-a57</model>
+ <vendor>ARM</vendor>
+ <feature name='fp'/>
+ <feature name='asimd'/>
+ <feature name='pmull'/>
+ <feature name='sha2'/>
+ <feature name='crc32'/>
+</cpu>
+<cpu>
+ <arch>aarch64</arch>
+ <model>cortex-a57</model>
+ <vendor>ARM</vendor>
+ <feature name='aes'/>
+ <feature name='sha1'/>
+</cpu>
+</cpuTest>
diff --git a/tests/cputestdata/aarch64-baseline-no-feature-result.xml b/tests/cputestdata/aarch64-baseline-no-feature-result.xml
new file mode 100644
index 0000000..6db66aa
--- /dev/null
+++ b/tests/cputestdata/aarch64-baseline-no-feature-result.xml
@@ -0,0 +1,4 @@
+<cpu mode='custom' match='exact'>
+ <model fallback='forbid'>cortex-a57</model>
+ <vendor>ARM</vendor>
+</cpu>
diff --git a/tests/cputestdata/aarch64-baseline-no-feature.xml b/tests/cputestdata/aarch64-baseline-no-feature.xml
new file mode 100644
index 0000000..0d6af96
--- /dev/null
+++ b/tests/cputestdata/aarch64-baseline-no-feature.xml
@@ -0,0 +1,7 @@
+<cpuTest>
+<cpu>
+ <arch>aarch64</arch>
+ <model>cortex-a57</model>
+ <vendor>ARM</vendor>
+</cpu>
+</cpuTest>
diff --git a/tests/cputestdata/aarch64-baseline-no-model.xml b/tests/cputestdata/aarch64-baseline-no-model.xml
new file mode 100644
index 0000000..6033e4c
--- /dev/null
+++ b/tests/cputestdata/aarch64-baseline-no-model.xml
@@ -0,0 +1,13 @@
+<cpuTest>
+<cpu>
+ <arch>aarch64</arch>
+ <vendor>ARM</vendor>
+ <feature name='fp'/>
+ <feature name='asimd'/>
+ <feature name='aes'/>
+ <feature name='pmull'/>
+ <feature name='sha1'/>
+ <feature name='sha2'/>
+ <feature name='crc32'/>
+</cpu>
+</cpuTest>
diff --git a/tests/cputestdata/aarch64-baseline-no-vendor-result.xml b/tests/cputestdata/aarch64-baseline-no-vendor-result.xml
new file mode 100644
index 0000000..c1d74c2
--- /dev/null
+++ b/tests/cputestdata/aarch64-baseline-no-vendor-result.xml
@@ -0,0 +1,10 @@
+<cpu mode='custom' match='exact'>
+ <model fallback='forbid'>cortex-a57</model>
+ <feature policy='require' name='fp'/>
+ <feature policy='require' name='asimd'/>
+ <feature policy='require' name='aes'/>
+ <feature policy='require' name='pmull'/>
+ <feature policy='require' name='sha1'/>
+ <feature policy='require' name='sha2'/>
+ <feature policy='require' name='crc32'/>
+</cpu>
diff --git a/tests/cputestdata/aarch64-baseline-no-vendor.xml b/tests/cputestdata/aarch64-baseline-no-vendor.xml
new file mode 100644
index 0000000..8aacb3e
--- /dev/null
+++ b/tests/cputestdata/aarch64-baseline-no-vendor.xml
@@ -0,0 +1,13 @@
+<cpuTest>
+<cpu>
+ <arch>aarch64</arch>
+ <model>cortex-a57</model>
+ <feature name='fp'/>
+ <feature name='asimd'/>
+ <feature name='aes'/>
+ <feature name='pmull'/>
+ <feature name='sha1'/>
+ <feature name='sha2'/>
+ <feature name='crc32'/>
+</cpu>
+</cpuTest>
diff --git a/tests/cputestdata/aarch64-baseline-one-compatible-feature-result.xml b/tests/cputestdata/aarch64-baseline-one-compatible-feature-result.xml
new file mode 100644
index 0000000..84c559d
--- /dev/null
+++ b/tests/cputestdata/aarch64-baseline-one-compatible-feature-result.xml
@@ -0,0 +1,5 @@
+<cpu mode='custom' match='exact'>
+ <model fallback='forbid'>cortex-a57</model>
+ <vendor>ARM</vendor>
+ <feature policy='require' name='sha1'/>
+</cpu>
diff --git a/tests/cputestdata/aarch64-baseline-one-compatible-feature.xml b/tests/cputestdata/aarch64-baseline-one-compatible-feature.xml
new file mode 100644
index 0000000..c85059b
--- /dev/null
+++ b/tests/cputestdata/aarch64-baseline-one-compatible-feature.xml
@@ -0,0 +1,20 @@
+<cpuTest>
+<cpu>
+ <arch>aarch64</arch>
+ <model>cortex-a57</model>
+ <vendor>ARM</vendor>
+ <feature name='fp'/>
+ <feature name='asimd'/>
+ <feature name='aes'/>
+ <feature name='pmull'/>
+ <feature name='sha1'/>
+ <feature name='sha2'/>
+ <feature name='crc32'/>
+</cpu>
+<cpu>
+ <arch>aarch64</arch>
+ <model>cortex-a57</model>
+ <vendor>ARM</vendor>
+ <feature name='sha1'/>
+</cpu>
+</cpuTest>
diff --git a/tests/cputestdata/aarch64-baseline-one-feature-result.xml b/tests/cputestdata/aarch64-baseline-one-feature-result.xml
new file mode 100644
index 0000000..0fcea51
--- /dev/null
+++ b/tests/cputestdata/aarch64-baseline-one-feature-result.xml
@@ -0,0 +1,5 @@
+<cpu mode='custom' match='exact'>
+ <model fallback='forbid'>cortex-a57</model>
+ <vendor>ARM</vendor>
+ <feature policy='require' name='fp'/>
+</cpu>
diff --git a/tests/cputestdata/aarch64-baseline-one-feature.xml b/tests/cputestdata/aarch64-baseline-one-feature.xml
new file mode 100644
index 0000000..e0ae15f
--- /dev/null
+++ b/tests/cputestdata/aarch64-baseline-one-feature.xml
@@ -0,0 +1,8 @@
+<cpuTest>
+<cpu>
+ <arch>aarch64</arch>
+ <model>cortex-a57</model>
+ <vendor>ARM</vendor>
+ <feature name='fp'/>
+</cpu>
+</cpuTest>
--
2.19.1

View File

@ -1,171 +0,0 @@
From 0535b2880dd5804170490f8156a95964bd2f1ad3 Mon Sep 17 00:00:00 2001
From: Xu Yandong <xuyandong2@huawei.com>
Date: Mon, 16 Oct 2017 17:55:48 +0800
Subject: [PATCH] tests: add cpu compare test cases for arm CPU
add cpu compare test cases for arm CPU
Signed-off-by: Xu Yandong <xuyandong2@huawei.com>
---
tests/cputest.c | 10 ++++++++++
.../aarch64-guest-compat-incompatible.xml | 4 ++++
tests/cputestdata/aarch64-guest-compat-none.xml | 1 +
tests/cputestdata/aarch64-guest-compat-valid.xml | 3 +++
tests/cputestdata/aarch64-guest-exact.xml | 4 ++++
tests/cputestdata/aarch64-guest-features-invalid.xml | 12 ++++++++++++
tests/cputestdata/aarch64-guest-features-valid.xml | 7 +++++++
.../aarch64-guest-legacy-incompatible.xml | 4 ++++
tests/cputestdata/aarch64-guest-legacy.xml | 4 ++++
tests/cputestdata/aarch64-guest-strict.xml | 4 ++++
tests/cputestdata/aarch64-host.xml | 12 ++++++++++++
11 files changed, 65 insertions(+)
create mode 100644 tests/cputestdata/aarch64-guest-compat-incompatible.xml
create mode 100644 tests/cputestdata/aarch64-guest-compat-none.xml
create mode 100644 tests/cputestdata/aarch64-guest-compat-valid.xml
create mode 100644 tests/cputestdata/aarch64-guest-exact.xml
create mode 100644 tests/cputestdata/aarch64-guest-features-invalid.xml
create mode 100644 tests/cputestdata/aarch64-guest-features-valid.xml
create mode 100644 tests/cputestdata/aarch64-guest-legacy-incompatible.xml
create mode 100644 tests/cputestdata/aarch64-guest-legacy.xml
create mode 100644 tests/cputestdata/aarch64-guest-strict.xml
create mode 100644 tests/cputestdata/aarch64-host.xml
diff --git a/tests/cputest.c b/tests/cputest.c
index ee754bb..c0903bf 100644
--- a/tests/cputest.c
+++ b/tests/cputest.c
@@ -1163,6 +1163,16 @@ mymain(void)
DO_TEST_COMPARE(VIR_ARCH_PPC64, "host", "guest-compat-invalid", VIR_CPU_COMPARE_ERROR);
DO_TEST_COMPARE(VIR_ARCH_PPC64, "host", "guest-compat-incompatible", VIR_CPU_COMPARE_INCOMPATIBLE);
+ DO_TEST_COMPARE(VIR_ARCH_AARCH64, "host", "guest-strict", VIR_CPU_COMPARE_IDENTICAL);
+ DO_TEST_COMPARE(VIR_ARCH_AARCH64, "host", "guest-exact", VIR_CPU_COMPARE_INCOMPATIBLE);
+ DO_TEST_COMPARE(VIR_ARCH_AARCH64, "host", "guest-legacy", VIR_CPU_COMPARE_IDENTICAL);
+ DO_TEST_COMPARE(VIR_ARCH_AARCH64, "host", "guest-legacy-incompatible", VIR_CPU_COMPARE_INCOMPATIBLE);
+ DO_TEST_COMPARE(VIR_ARCH_AARCH64, "host", "guest-compat-none", VIR_CPU_COMPARE_IDENTICAL);
+ DO_TEST_COMPARE(VIR_ARCH_AARCH64, "host", "guest-compat-valid", VIR_CPU_COMPARE_IDENTICAL);
+ DO_TEST_COMPARE(VIR_ARCH_AARCH64, "host", "guest-compat-incompatible", VIR_CPU_COMPARE_INCOMPATIBLE);
+ DO_TEST_COMPARE(VIR_ARCH_AARCH64, "host", "guest-features-valid", VIR_CPU_COMPARE_IDENTICAL);
+ DO_TEST_COMPARE(VIR_ARCH_AARCH64, "host", "guest-features-invalid", VIR_CPU_COMPARE_INCOMPATIBLE);
+
/* guest updates for migration
* automatically compares host CPU with the result */
DO_TEST_UPDATE(VIR_ARCH_X86_64, "host", "min", VIR_CPU_COMPARE_IDENTICAL);
diff --git a/tests/cputestdata/aarch64-guest-compat-incompatible.xml b/tests/cputestdata/aarch64-guest-compat-incompatible.xml
new file mode 100644
index 0000000..f68ead5
--- /dev/null
+++ b/tests/cputestdata/aarch64-guest-compat-incompatible.xml
@@ -0,0 +1,4 @@
+<cpu mode='custom'>
+ <model>cortex-a72</model>
+ <vendor>ARM</vendor>
+</cpu>
diff --git a/tests/cputestdata/aarch64-guest-compat-none.xml b/tests/cputestdata/aarch64-guest-compat-none.xml
new file mode 100644
index 0000000..fd50c03
--- /dev/null
+++ b/tests/cputestdata/aarch64-guest-compat-none.xml
@@ -0,0 +1 @@
+<cpu mode='host-model'/>
diff --git a/tests/cputestdata/aarch64-guest-compat-valid.xml b/tests/cputestdata/aarch64-guest-compat-valid.xml
new file mode 100644
index 0000000..0206d6e
--- /dev/null
+++ b/tests/cputestdata/aarch64-guest-compat-valid.xml
@@ -0,0 +1,3 @@
+<cpu mode='host-model'>
+ <model>cortex-a57</model>
+</cpu>
diff --git a/tests/cputestdata/aarch64-guest-exact.xml b/tests/cputestdata/aarch64-guest-exact.xml
new file mode 100644
index 0000000..bbbe65f
--- /dev/null
+++ b/tests/cputestdata/aarch64-guest-exact.xml
@@ -0,0 +1,4 @@
+<cpu match='exact'>
+ <model>cortex-a72</model>
+ <vendor>ARM</vendor>
+</cpu>
diff --git a/tests/cputestdata/aarch64-guest-features-invalid.xml b/tests/cputestdata/aarch64-guest-features-invalid.xml
new file mode 100644
index 0000000..afbb402
--- /dev/null
+++ b/tests/cputestdata/aarch64-guest-features-invalid.xml
@@ -0,0 +1,12 @@
+<cpu>
+ <model>cortex-a57</model>
+ <vendor>ARM</vendor>
+ <feature name='fp'/>
+ <feature name='asimd'/>
+ <feature name='aes'/>
+ <feature name='pmull'/>
+ <feature name='sha1'/>
+ <feature name='sha2'/>
+ <feature name='crc32'/>
+ <feature name='sha3'/>
+</cpu>
diff --git a/tests/cputestdata/aarch64-guest-features-valid.xml b/tests/cputestdata/aarch64-guest-features-valid.xml
new file mode 100644
index 0000000..0858f76
--- /dev/null
+++ b/tests/cputestdata/aarch64-guest-features-valid.xml
@@ -0,0 +1,7 @@
+<cpu>
+ <model>cortex-a57</model>
+ <vendor>ARM</vendor>
+ <feature name='asimd'/>
+ <feature name='aes'/>
+ <feature name='crc32'/>
+</cpu>
diff --git a/tests/cputestdata/aarch64-guest-legacy-incompatible.xml b/tests/cputestdata/aarch64-guest-legacy-incompatible.xml
new file mode 100644
index 0000000..2f1941d
--- /dev/null
+++ b/tests/cputestdata/aarch64-guest-legacy-incompatible.xml
@@ -0,0 +1,4 @@
+<cpu mode='custom' match='exact'>
+ <model fallback='allow'>cortex-a72</model>
+ <vendor>ARM</vendor>
+</cpu>
diff --git a/tests/cputestdata/aarch64-guest-legacy.xml b/tests/cputestdata/aarch64-guest-legacy.xml
new file mode 100644
index 0000000..64a05e4
--- /dev/null
+++ b/tests/cputestdata/aarch64-guest-legacy.xml
@@ -0,0 +1,4 @@
+<cpu mode='custom' match='exact'>
+ <model fallback='allow'>cortex-a57</model>
+ <vendor>ARM</vendor>
+</cpu>
diff --git a/tests/cputestdata/aarch64-guest-strict.xml b/tests/cputestdata/aarch64-guest-strict.xml
new file mode 100644
index 0000000..a057ebd
--- /dev/null
+++ b/tests/cputestdata/aarch64-guest-strict.xml
@@ -0,0 +1,4 @@
+<cpu match='strict'>
+ <model>cortex-a57</model>
+ <vendor>ARM</vendor>
+</cpu>
diff --git a/tests/cputestdata/aarch64-host.xml b/tests/cputestdata/aarch64-host.xml
new file mode 100644
index 0000000..60c20f2
--- /dev/null
+++ b/tests/cputestdata/aarch64-host.xml
@@ -0,0 +1,12 @@
+<cpu>
+ <arch>aarch64</arch>
+ <model>cortex-a57</model>
+ <vendor>ARM</vendor>
+ <feature name='fp'/>
+ <feature name='asimd'/>
+ <feature name='aes'/>
+ <feature name='pmull'/>
+ <feature name='sha1'/>
+ <feature name='sha2'/>
+ <feature name='crc32'/>
+</cpu>
--
2.19.1

View File

@ -1,118 +0,0 @@
From b47d53edc1a00d845d2200f67f20edfc60dedc29 Mon Sep 17 00:00:00 2001
From: Peter Krempa <pkrempa@redhat.com>
Date: Thu, 18 Jul 2019 16:30:18 +0200
Subject: [PATCH] util: storage: Clean up label use in
virStorageFileGetMetadataInternal
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
The function does not do any cleanup, so replace the 'cleanup' label
with return of -1 and the 'done' label with return of 0.
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
(cherry-picked from commit 5b8e64f0bcbbab826cff5be1b0adb000923abfb4)
Signed-off-by: Xu Yandong <xuyandong2@huawei.com>
---
src/util/virstoragefile.c | 27 +++++++++++----------------
1 file changed, 11 insertions(+), 16 deletions(-)
diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c
index 269d005..4e2e754 100644
--- a/src/util/virstoragefile.c
+++ b/src/util/virstoragefile.c
@@ -973,7 +973,6 @@ virStorageFileGetMetadataInternal(virStorageSourcePtr meta,
int *backingFormat)
{
int dummy;
- int ret = -1;
size_t i;
if (!backingFormat)
@@ -989,7 +988,7 @@ virStorageFileGetMetadataInternal(virStorageSourcePtr meta,
meta->format >= VIR_STORAGE_FILE_LAST) {
virReportSystemError(EINVAL, _("unknown storage file meta->format %d"),
meta->format);
- goto cleanup;
+ return -1;
}
if (fileTypeInfo[meta->format].cryptInfo != NULL) {
@@ -999,7 +998,7 @@ virStorageFileGetMetadataInternal(virStorageSourcePtr meta,
int expt_fmt = fileTypeInfo[meta->format].cryptInfo[i].format;
if (!meta->encryption) {
if (VIR_ALLOC(meta->encryption) < 0)
- goto cleanup;
+ return -1;
meta->encryption->format = expt_fmt;
} else {
@@ -1008,7 +1007,7 @@ virStorageFileGetMetadataInternal(virStorageSourcePtr meta,
_("encryption format %d doesn't match "
"expected format %d"),
meta->encryption->format, expt_fmt);
- goto cleanup;
+ return -1;
}
}
meta->encryption->payload_offset =
@@ -1021,12 +1020,12 @@ virStorageFileGetMetadataInternal(virStorageSourcePtr meta,
* code into this method, for non-magic files
*/
if (!fileTypeInfo[meta->format].magic)
- goto done;
+ return 0;
/* Optionally extract capacity from file */
if (fileTypeInfo[meta->format].sizeOffset != -1) {
if ((fileTypeInfo[meta->format].sizeOffset + 8) > len)
- goto done;
+ return 0;
if (fileTypeInfo[meta->format].endian == LV_LITTLE_ENDIAN)
meta->capacity = virReadBufInt64LE(buf +
@@ -1037,7 +1036,7 @@ virStorageFileGetMetadataInternal(virStorageSourcePtr meta,
/* Avoid unlikely, but theoretically possible overflow */
if (meta->capacity > (ULLONG_MAX /
fileTypeInfo[meta->format].sizeMultiplier))
- goto done;
+ return 0;
meta->capacity *= fileTypeInfo[meta->format].sizeMultiplier;
}
@@ -1047,25 +1046,21 @@ virStorageFileGetMetadataInternal(virStorageSourcePtr meta,
backingFormat,
buf, len);
if (store == BACKING_STORE_INVALID)
- goto done;
+ return 0;
if (store == BACKING_STORE_ERROR)
- goto cleanup;
+ return -1;
}
if (fileTypeInfo[meta->format].getFeatures != NULL &&
fileTypeInfo[meta->format].getFeatures(&meta->features, meta->format, buf, len) < 0)
- goto cleanup;
+ return -1;
if (meta->format == VIR_STORAGE_FILE_QCOW2 && meta->features &&
VIR_STRDUP(meta->compat, "1.1") < 0)
- goto cleanup;
-
- done:
- ret = 0;
+ return -1;
- cleanup:
- return ret;
+ return 0;
}
--
2.19.1

View File

@ -1,60 +0,0 @@
From 68947484f8411b50fd0a17548a4e92ec07628782 Mon Sep 17 00:00:00 2001
From: Peter Krempa <pkrempa@redhat.com>
Date: Thu, 18 Jul 2019 16:32:44 +0200
Subject: [PATCH] util: storage: Don't leak metadata on repeated calls of
virStorageFileGetMetadata
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
When querying storage metadata after a block job we re-run
virStorageFileGetMetadata on the top level storage file. This means that
the workers (virStorageFileGetMetadataInternal) must not overwrite any
pointers without freeing them.
This was not considered for src->compat and src->features. Fix it and
add a comment mentioning that.
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
(cherry-picked from commit f0430d069af991475de6fa83ed62a45f8669c645)
Signed-off-by: Xu Yandong <xuyandong2@huawei.com>
---
src/util/virstoragefile.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c
index 4e2e754..a6de6a1 100644
--- a/src/util/virstoragefile.c
+++ b/src/util/virstoragefile.c
@@ -965,7 +965,11 @@ virStorageFileGetEncryptionPayloadOffset(const struct FileEncryptionInfo *info,
* assuming it has the given FORMAT, populate information into META
* with information about the file and its backing store. Return format
* of the backing store as BACKING_FORMAT. PATH and FORMAT have to be
- * pre-populated in META */
+ * pre-populated in META.
+ *
+ * Note that this function may be called repeatedly on @meta, so it must
+ * clean up any existing allocated memory which would be overwritten.
+ */
int
virStorageFileGetMetadataInternal(virStorageSourcePtr meta,
char *buf,
@@ -1052,10 +1056,13 @@ virStorageFileGetMetadataInternal(virStorageSourcePtr meta,
return -1;
}
+ virBitmapFree(meta->features);
+ meta->features = NULL;
if (fileTypeInfo[meta->format].getFeatures != NULL &&
fileTypeInfo[meta->format].getFeatures(&meta->features, meta->format, buf, len) < 0)
return -1;
+ VIR_FREE(meta->compat);
if (meta->format == VIR_STORAGE_FILE_QCOW2 && meta->features &&
VIR_STRDUP(meta->compat, "1.1") < 0)
return -1;
--
2.19.1

View File

@ -1,39 +0,0 @@
From eb22236a7bbb8f4e694b4a5a107e852c3f2be591 Mon Sep 17 00:00:00 2001
From: Pavel Hrdina <phrdina@redhat.com>
Date: Thu, 5 Sep 2019 11:22:11 +0200
Subject: [PATCH] vircgroupv2: fix setting cpu.max period
When we set cpu.max period we need to parse the cpu.max file first as
it contains both quota and period values separated by space. When only
a single number is written to that file it will set quota. However,
in order to change period we need to write both values.
The code was prepared for that but mistakenly used new line to end the
string with the first value.
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1749227
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
(cherry-picked from commit 0bd4ad193d8ba7f0104f4739f19f2731e7cf9f56)
Signed-off-by: Xu Yandong <xuyandong2@huawei.com>
---
src/util/vircgroupv2.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/util/vircgroupv2.c b/src/util/vircgroupv2.c
index 9d8a389..6cbb2a5 100644
--- a/src/util/vircgroupv2.c
+++ b/src/util/vircgroupv2.c
@@ -1495,7 +1495,7 @@ virCgroupV2SetCpuCfsPeriod(virCgroupPtr group,
_("Invalid 'cpu.max' data."));
return -1;
}
- *tmp = '\n';
+ *tmp = '\0';
if (virAsprintf(&value, "%s %llu", str, cfs_period) < 0)
return -1;
--
2.21.0

View File

@ -1,51 +0,0 @@
From 27616d1c02b697df151ed8c9116e46e440549036 Mon Sep 17 00:00:00 2001
From: Michal Privoznik <mprivozn@redhat.com>
Date: Tue, 9 Jul 2019 16:46:31 +0200
Subject: [PATCH] virnetworkobj: Free retval of virNetworkObjGetPortStatusDir()
The virNetworkObjGetPortStatusDir() function allocates a memory
to construct a path. None of the callers free it leading to a
memleak.
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
(cherry-picked from commit 37d8d6b98d2046c023935a6c9723defcdbf6c069)
Signed-off-by: Xu Yandong <xuyandong2@huawei.com>
---
src/conf/virnetworkobj.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/conf/virnetworkobj.c b/src/conf/virnetworkobj.c
index 12cefeb..45726e4 100644
--- a/src/conf/virnetworkobj.c
+++ b/src/conf/virnetworkobj.c
@@ -1627,7 +1627,7 @@ virNetworkObjAddPort(virNetworkObjPtr net,
{
int ret = -1;
char uuidstr[VIR_UUID_STRING_BUFLEN];
- char *dir = NULL;
+ VIR_AUTOFREE(char *) dir = NULL;
virUUIDFormat(portdef->uuid, uuidstr);
@@ -1717,7 +1717,7 @@ int
virNetworkObjDeleteAllPorts(virNetworkObjPtr net,
const char *stateDir)
{
- char *dir;
+ VIR_AUTOFREE(char *) dir = NULL;
DIR *dh = NULL;
struct dirent *de;
int rc;
@@ -1843,7 +1843,7 @@ static int
virNetworkObjLoadAllPorts(virNetworkObjPtr net,
const char *stateDir)
{
- char *dir;
+ VIR_AUTOFREE(char *) dir = NULL;
DIR *dh = NULL;
struct dirent *de;
int ret = -1;
--
2.19.1

View File

@ -1,37 +0,0 @@
From 501ce10b135c1edcf5e05996ff85f7a35bdc2ecc Mon Sep 17 00:00:00 2001
From: Jonathon Jongsma <jjongsma@redhat.com>
Date: Tue, 3 Sep 2019 11:47:29 -0500
Subject: [PATCH] virsh: Fix help for net-port-delete
Apparently a copy/paste error. The net-port-delete help string was in
fact from net-port-dumpxml.
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1747826
Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
(cherry-picked from commit 7d5f0fda306f02021dc26e67c2778f44d22465b9)
Signed-off-by: Xu Yandong <xuyandong2@huawei.com>
---
tools/virsh-network.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tools/virsh-network.c b/tools/virsh-network.c
index af08441..be16f79 100644
--- a/tools/virsh-network.c
+++ b/tools/virsh-network.c
@@ -1593,10 +1593,10 @@ cmdNetworkPortDumpXML(vshControl *ctl, const vshCmd *cmd)
*/
static const vshCmdInfo info_network_port_delete[] = {
{.name = "help",
- .data = N_("network port information in XML")
+ .data = N_("delete the specified network port")
},
{.name = "desc",
- .data = N_("Output the network port information as an XML dump to stdout.")
+ .data = N_("Delete the specified network port.")
},
{.name = NULL}
};
--
2.21.0

View File

@ -1,60 +0,0 @@
From 07df0ab940bb3688a3208b80d733db3cbfbde687 Mon Sep 17 00:00:00 2001
From: Jiri Denemark <jdenemar@redhat.com>
Date: Fri, 19 Jul 2019 15:46:33 +0200
Subject: [PATCH] virsh migrate: Properly check for --parallel-connections
Ever since --parallel-connections option for virsh migrate was
introduced we did not properly check the return value of
vshCommandOptInt. We would set VIR_MIGRATE_PARAM_PARALLEL_CONNECTIONS
parameter even if vshCommandOptInt returned 0 (which means
--parallel-connections was not specified) when another int option which
was checked earlier was specified with a nonzero value.
Specifically, running virsh migrate with either
--auto-converge-increment, --auto-converge-initial, --comp-mt-dthreads,
--comp-mt-threads, or --comp-mt-level would set
VIR_MIGRATE_PARAM_PARALLEL_CONNECTIONS parameter and if --parallel
option was not used, libvirt would complain
error: invalid argument: Turn parallel migration on to tune it
even though --parallel-connections option was not used at all.
https://bugzilla.redhat.com/show_bug.cgi?id=1726643
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
(cherry-picked from commit 88ce7bac413a7a5722b2ffe53dd844c0d677168a)
Signed-off-by: Xu Yandong <xuyandong2@huawei.com>
---
tools/virsh-domain.c | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index 828ae30..2ad7395 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -10785,13 +10785,14 @@ doMigrate(void *opaque)
goto save_error;
}
- if (vshCommandOptInt(ctl, cmd, "parallel-connections", &intOpt) < 0)
+ if ((rv = vshCommandOptInt(ctl, cmd, "parallel-connections", &intOpt)) < 0) {
goto out;
- if (intOpt &&
- virTypedParamsAddInt(&params, &nparams, &maxparams,
- VIR_MIGRATE_PARAM_PARALLEL_CONNECTIONS,
- intOpt) < 0)
- goto save_error;
+ } else if (rv > 0) {
+ if (virTypedParamsAddInt(&params, &nparams, &maxparams,
+ VIR_MIGRATE_PARAM_PARALLEL_CONNECTIONS,
+ intOpt) < 0)
+ goto save_error;
+ }
if (vshCommandOptBool(cmd, "live"))
flags |= VIR_MIGRATE_LIVE;
--
2.19.1

View File

@ -1,8 +1,5 @@
# -*- rpm-spec -*-
# This spec file assumes you are building on openEuler version.
%define supported_platform 1
# Default to skipping autoreconf. Distros can change just this one line
# (or provide a command-line override) if they backport any patches that
# touch configure.ac or Makefile.am.
@ -31,7 +28,6 @@
# Then the hypervisor drivers that run outside libvirtd, in libvirt.so
%define with_openvz 0%{!?_without_openvz:0}
%define with_vmware 0%{!?_without_vmware:0}
%define with_phyp 0%{!?_without_phyp:0}
%define with_esx 0%{!?_without_esx:0}
%define with_hyperv 0%{!?_without_hyperv:0}
@ -56,16 +52,11 @@
%define with_storage_iscsi_direct 0%{!?_without_storage_iscsi_direct:1}
# A few optional bits off by default, we enable later
# fuse is used to provide virtualized /proc for LXC
%if %{with_lxc}
%define with_fuse 0%{!?_without_fuse:1}
%else
%define with_fuse 0%{!?_without_fuse:0}
%endif
%define with_sanlock 0%{!?_without_sanlock:1}
%define with_numad 0%{!?_without_numad:0}
%define with_firewalld 0%{!?_without_firewalld:1}
%define with_firewalld_zone 0%{!?_without_firewalld_zone:1}
%define with_libssh2 0%{!?_without_libssh2:1}
%define with_wireshark 0%{!?_without_wireshark:1}
%define with_libssh 0%{!?_without_libssh:1}
@ -83,12 +74,11 @@
%define with_vbox 0
%endif
%define with_bash_completion 0%{!?_without_bash_completion:1}
# Enable wireshark plugins for all distros shipping libvirt 1.2.2 or newer
%define wireshark_plugindir %(pkg-config --variable plugindir wireshark)/epan
# Default Use Python 3
%define python python3
%if %{with_qemu} || %{with_lxc}
# numad is used to manage the CPU and memory placement dynamically,
# it's not available on many non-x86 architectures.
@ -105,16 +95,11 @@
%define tls_priority "@LIBVIRT,SYSTEM"
%define with_systemd 1
%define with_pm_utils 0
%define with_firewalld_zone 0%{!?_without_firewalld_zone:0}
%define with_systemd_macros 1
Summary: Library providing a simple virtualization API
Name: libvirt
Version: 5.5.0
Release: 7
Version: 6.2.0
Release: 1
License: LGPLv2+
URL: https://libvirt.org/
@ -122,56 +107,6 @@ URL: https://libvirt.org/
%define mainturl stable_updates/
%endif
Source: https://libvirt.org/sources/%{?mainturl}libvirt-%{version}.tar.xz
Patch0: libvirt-qemu-fix-potential-memory-leak.patch
Patch1: libvirt-remote-fix-a-memory-free-error.patch
Patch2: libvirt-qemu-add-pointer-check-in-qemuMonitorLastError.patch
Patch3: libvirt-conf-use-virDomainDeviceDefFree-free-dev.patch
Patch4: libvirt-conf-fix-memory-leak-in-virNodeDeviceGetPCISRIOVCaps.patch
Patch5: libvirt-conf-fix-memory-leak-in-virNodeDevPCICapSRIOVVirtual.patch
Patch6: libvirt-qemu-clear-vcpupin-when-unhotplug-vcpu.patch
Patch7: libvirt-qemu-fix-a-concurrent-operation-situation.patch
Patch8: libvirt-qemu_conf-clear-domain-before-VIR_DELETE_ELEMENT.patch
Patch9: libvirt-event-reference-state-only-when-virEventAddTimeout-s.patch
Patch10: libvirt-cgroup-cleanup-eventParams-when-virTypedParamsAddULL.patch
Patch11: libvirt-remote-mention-libssh-in-error-message.patch
Patch12: libvirt-qemu-Validate-disk-against-domain-def-on-coldplug.patch
Patch13: libvirt-virnetworkobj-Free-retval-of-virNetworkObjGetPortSta.patch
Patch14: libvirt-storage-rbd-use-VIR_REALLOC-in-the-loop.patch
Patch15: libvirt-storage-rbd-actually-index-the-array-when-iterating-.patch
Patch16: libvirt-Revert-conf-Remove-volOptions-for-VIR_STORAGE_POOL_R.patch
Patch17: libvirt-qemu-Relax-os.loader-type-check-when-validating-doma.patch
Patch18: libvirt-util-storage-Clean-up-label-use-in-virStorageFileGet.patch
Patch19: libvirt-util-storage-Don-t-leak-metadata-on-repeated-calls-o.patch
Patch20: libvirt-virsh-migrate-Properly-check-for-parallel-connection.patch
Patch21: libvirt-conf-Avoid-double-free-when-prase-device-xml-failed.patch
Patch22: libvirt-qemu-fix-Validate-scsi-disk-against-domain-def-on-co.patch
Patch23: libvirt-libvirtd-fix-driver-cleanup-order-to-avoid-coredump.patch
Patch24: libvirt-hostdev-remove-unnessary-virObjectUnref-after-use-VI.patch
Patch25: libvirt-nodedev-fix-potential-heap-use-after-free.patch
Patch26: libvirt-cpu_map-Introduce-arm-CPU-models.patch
Patch27: libvirt-cpu-introduce-virCPUarmData-to-virCPUData.patch
Patch28: libvirt-cpu-introduce-cpu-baseline-for-ARM-CPU.patch
Patch29: libvirt-cpu-fix-cpu-compare-and-cpu-baseline-for-ARM-CPU.patch
Patch30: libvirt-cpu-add-getHostCPU-for-ARM-CPUS.patch
Patch31: libvirt-cpu-Introduce-mock-checkFeature-method-for-ARM-CPUS.patch
Patch32: libvirt-tests-add-baseline-test-cases-for-arm-CPU.patch
Patch33: libvirt-tests-add-cpu-compare-test-cases-for-arm-CPU.patch
Patch34: libvirt-cpu_map-Add-TAA_NO-bit-for-IA32_ARCH_CAPABILITIES-MS.patch
Patch35: libvirt-cpu_map-Add-TSX_CTRL-bit-for-IA32_ARCH_CAPABILITIES-.patch
Patch36: libvirt-qemu-Don-t-leak-domain-def-when-RevertToSnapshot-fai.patch
Patch37: libvirt-admin-fix-memory-leak-of-typed-parameters-getting-cl.patch
Patch38: libvirt-access-fix-incorrect-addition-to-virAccessPermNetwor.patch
Patch39: libvirt-network-fix-crash-during-cleanup-from-failure-to-all.patch
Patch40: libvirt-qemu-alias-Generate-qomName-of-disk-with-useraliases.patch
Patch41: libvirt-vircgroupv2-fix-setting-cpu.max-period.patch
Patch42: libvirt-virsh-Fix-help-for-net-port-delete.patch
Patch43: libvirt-qemu-avoid-double-reservation-of-PCI-address-for-int.patch
Patch44: libvirt-qemu-Forcibly-mknod-even-if-it-exists.patch
Patch45: libvirt-qemu-homogenize-MAC-address-in-live-config-when.patch
Patch46: libvirt-po-Refresh-translation-for-running-state.patch
Patch47: libvirt-qemu-don-t-hold-both-jobs-for-suspend.patch
Requires: libvirt-daemon = %{version}-%{release}
Requires: libvirt-daemon-config-network = %{version}-%{release}
@ -208,18 +143,17 @@ BuildRequires: autoconf
BuildRequires: automake
BuildRequires: gettext-devel
BuildRequires: libtool
BuildRequires: /usr/bin/pod2man
%endif
BuildRequires: python3-docutils
BuildRequires: gcc
BuildRequires: git
BuildRequires: hostname
BuildRequires: perl-interpreter
BuildRequires: %{python}
BuildRequires: python3
BuildRequires: systemd-units
%if %{with_libxl}
BuildRequires: xen-devel
%endif
BuildRequires: glib2-devel >= 2.48
BuildRequires: libxml2-devel
BuildRequires: libxslt
BuildRequires: readline-devel
@ -241,9 +175,8 @@ BuildRequires: yajl-devel
%if %{with_sanlock}
BuildRequires: sanlock-devel >= 2.4
%endif
BuildRequires: libpcap-devel
BuildRequires: libpcap-devel >= 1.5.0
BuildRequires: libnl3-devel
BuildRequires: avahi-devel
BuildRequires: libselinux-devel
BuildRequires: dnsmasq >= 2.41
BuildRequires: iptables
@ -272,9 +205,11 @@ BuildRequires: libiscsi-devel
BuildRequires: parted-devel
# For Multipath support
BuildRequires: device-mapper-devel
# For XFS reflink clone support
BuildRequires: xfsprogs-devel
%if %{with_storage_rbd}
BuildRequires: librados2-devel
BuildRequires: librbd1-devel
BuildRequires: librados-devel
BuildRequires: librbd-devel
%endif
%if %{with_storage_gluster}
BuildRequires: glusterfs-api-devel >= 3.4.1
@ -297,7 +232,7 @@ BuildRequires: libcap-ng-devel >= 0.5.0
%if %{with_fuse}
BuildRequires: fuse-devel >= 2.8.6
%endif
%if %{with_phyp} || %{with_libssh2}
%if %{with_libssh2}
BuildRequires: libssh2-devel >= 1.3.0
%endif
@ -331,7 +266,7 @@ BuildRequires: numad
%endif
%if %{with_wireshark}
BuildRequires: wireshark-devel >= 2.1.0
BuildRequires: wireshark-devel >= 2.4.0
%endif
%if %{with_libssh}
@ -341,7 +276,9 @@ BuildRequires: libssh-devel >= 0.7.0
BuildRequires: rpcgen
BuildRequires: libtirpc-devel
Provides: bundled(gnulib)
%if %{with_firewalld_zone}
BuildRequires: firewalld-filesystem
%endif
%description
Libvirt is a C toolkit to interact with the virtualization capabilities
@ -364,6 +301,9 @@ Summary: Server side daemon and supporting files for libvirt library
# The client side, i.e. shared libs are in a subpackage
Requires: %{name}-libs = %{version}-%{release}
# (client invokes 'nc' against the UNIX socket on the server)
Requires: /usr/bin/nc
# for modprobe of pci devices
Requires: module-init-tools
@ -372,20 +312,16 @@ Requires: iproute
# tc is provided by iproute-tc since at least Fedora 26
Requires: iproute-tc
Requires: avahi-libs
Requires: polkit >= 0.112
%ifarch %{ix86} x86_64 ia64
# For virConnectGetSysinfo
Requires: dmidecode
%endif
# For service management
%if %{with_systemd}
Requires(post): systemd-units
Requires(post): systemd-sysv
Requires(preun): systemd-units
Requires(postun): systemd-units
%endif
%if %{with_numad}
Requires: numad
%endif
@ -489,6 +425,9 @@ Requires: util-linux
# From QEMU RPMs
Requires: /usr/bin/qemu-img
%endif
%if !%{with_storage_rbd}
Obsoletes: libvirt-daemon-driver-storage-rbd < %{version}-%{release}
%endif
%description daemon-driver-storage-core
The storage driver plugin for the libvirtd daemon, providing
@ -568,7 +507,8 @@ multipath storage using device mapper.
Summary: Storage driver plugin for gluster
Requires: libvirt-daemon-driver-storage-core = %{version}-%{release}
Requires: libvirt-libs = %{version}-%{release}
Requires: glusterfs-cli
Requires: glusterfs-client >= 2.0.1
Requires: /usr/sbin/gluster
%description daemon-driver-storage-gluster
The storage driver backend adding implementation of the storage APIs for gluster
@ -651,9 +591,6 @@ parted and more.
Summary: QEMU driver plugin for the libvirtd daemon
Requires: libvirt-daemon = %{version}-%{release}
Requires: libvirt-libs = %{version}-%{release}
# There really is a hard cross-driver dependency here
Requires: libvirt-daemon-driver-network = %{version}-%{release}
Requires: libvirt-daemon-driver-storage-core = %{version}-%{release}
Requires: /usr/bin/qemu-img
# For image compression
Requires: gzip
@ -830,8 +767,6 @@ capabilities of recent versions of Linux (and other OSes).
%package libs
Summary: Client side libraries
# So remote clients can access libvirt over SSH tunnel
# (client invokes 'nc' against the UNIX socket on the server)
Requires: nc
Requires: cyrus-sasl
# Needed by default sasl.conf - no onerous extra deps, since
# 100's of other things on a system already pull in krb5-libs
@ -862,7 +797,7 @@ Bash completion script stub.
%if %{with_wireshark}
%package wireshark
Summary: Wireshark dissector plugin for libvirt RPC transactions
Requires: wireshark >= 1.12.6-4
Requires: wireshark >= 2.4.0
Requires: %{name}-libs = %{version}-%{release}
%description wireshark
@ -948,12 +883,6 @@ Libvirt plugin for NSS for translating domain names into IP addresses.
%define arg_libxl --without-libxl
%endif
%if %{with_phyp}
%define arg_phyp --with-phyp
%else
%define arg_phyp --without-phyp
%endif
%if %{with_esx}
%define arg_esx --with-esx
%else
@ -1044,12 +973,6 @@ Libvirt plugin for NSS for translating domain names into IP addresses.
%define arg_storage_iscsi_direct --without-storage-iscsi-direct
%endif
%if %{with_pm_utils}
%define arg_pm_utils --with-pm-utils
%else
%define arg_pm_utils --without-pm-utils
%endif
%define when %(date +"%%F-%%T")
%define where %(hostname)
%define who %{?packager}%{!?packager:Unknown}
@ -1085,22 +1008,27 @@ export SOURCE_DATE_EPOCH=$(stat --printf='%Y' %{_specdir}/%{name}.spec)
%endif
rm -f po/stamp-po
%configure %{?arg_qemu} \
%define _configure ../configure
mkdir %{_vpath_builddir}
cd %{_vpath_builddir}
%configure --enable-dependency-tracking \
--with-runstatedir=%{_rundir} \
%{?arg_qemu} \
%{?arg_openvz} \
%{?arg_lxc} \
%{?arg_vbox} \
%{?arg_libxl} \
--with-sasl \
--with-avahi \
--with-polkit \
--with-libvirtd \
%{?arg_phyp} \
%{?arg_esx} \
%{?arg_hyperv} \
%{?arg_vmware} \
--without-xenapi \
--without-vz \
--without-bhyve \
--with-remote-default-mode=legacy \
--with-interface \
--with-network \
--with-storage-fs \
@ -1135,7 +1063,7 @@ rm -f po/stamp-po
%{?arg_firewalld} \
%{?arg_firewalld_zone} \
%{?arg_wireshark} \
%{?arg_pm_utils} \
--without-pm-utils \
--with-nss-plugin \
%{arg_packager} \
%{arg_packager_version} \
@ -1147,19 +1075,16 @@ rm -f po/stamp-po
--enable-expensive-tests \
--with-init-script=systemd \
%{?arg_login_shell}
make %{?_smp_mflags} V=1
gzip -9 ChangeLog
%install
rm -fr %{buildroot}
export SOURCE_DATE_EPOCH=$(stat --printf='%Y' %{_specdir}/%{name}.spec)
cd %{_vpath_builddir}
%make_install %{?_smp_mflags} SYSTEMD_UNIT_DIR=%{_unitdir} V=1
make %{?_smp_mflags} -C examples distclean V=1
rm -f $RPM_BUILD_ROOT%{_libdir}/*.la
rm -f $RPM_BUILD_ROOT%{_libdir}/*.a
rm -f $RPM_BUILD_ROOT%{_libdir}/libvirt/lock-driver/*.la
@ -1181,8 +1106,8 @@ install -d -m 0755 $RPM_BUILD_ROOT%{_datadir}/lib/libvirt/dnsmasq/
install -d -m 0755 $RPM_BUILD_ROOT%{_datadir}/libvirt/networks/
cp $RPM_BUILD_ROOT%{_sysconfdir}/libvirt/qemu/networks/default.xml \
$RPM_BUILD_ROOT%{_datadir}/libvirt/networks/default.xml
rm -f $RPM_BUILD_ROOT%{_sysconfdir}/libvirt/qemu/networks/default.xml
rm -f $RPM_BUILD_ROOT%{_sysconfdir}/libvirt/qemu/networks/autostart/default.xml
# libvirt saves this file with mode 0600
chmod 0600 $RPM_BUILD_ROOT%{_sysconfdir}/libvirt/qemu/networks/default.xml
# nwfilter files are installed in /usr/share/libvirt and copied to /etc in %post
# to avoid verification errors on changed files in /etc
@ -1239,21 +1164,19 @@ mv $RPM_BUILD_ROOT%{_datadir}/systemtap/tapset/libvirt_qemu_probes.stp \
%endif
%check
cd tests
# These tests don't current work in a mock build root
for i in nodeinfotest seclabeltest
do
rm -f $i
printf 'int main(void) { return 0; }' > $i.c
printf '#!/bin/sh\nexit 0\n' > $i
chmod +x $i
done
cd %{_vpath_builddir}
if ! make %{?_smp_mflags} check VIR_TEST_DEBUG=1
then
cat test-suite.log || true
cat tests/test-suite.log || true
exit 1
fi
%post libs
/usr/sbin/ldconfig
%postun libs
/usr/sbin/ldconfig
%pre daemon
# 'libvirt' group is just to allow password-less polkit access to
# libvirtd. The uid number is irrelevant, so we use dynamic allocation
@ -1266,6 +1189,8 @@ exit 0
%systemd_post virtlockd.socket virtlockd-admin.socket
%systemd_post virtlogd.socket virtlogd-admin.socket
%systemd_post libvirtd.socket libvirtd-ro.socket libvirtd-admin.socket
%systemd_post libvirtd-tcp.socket libvirtd-tls.socket
%systemd_post libvirtd.service
# request daemon restart in posttrans
@ -1274,6 +1199,8 @@ touch %{_localstatedir}/lib/rpm-state/libvirt/restart || :
%preun daemon
%systemd_preun libvirtd.service
%systemd_preun libvirtd-tcp.socket libvirtd-tls.socket
%systemd_preun libvirtd.socket libvirtd-ro.socket libvirtd-admin.socket
%systemd_preun virtlogd.socket virtlogd-admin.socket virtlogd.service
%systemd_preun virtlockd.socket virtlockd-admin.socket virtlockd.service
@ -1298,10 +1225,51 @@ fi
%posttrans daemon
if [ -f %{_localstatedir}/lib/rpm-state/libvirt/restart ]; then
/bin/systemctl try-restart libvirtd.service >/dev/null 2>&1 || :
# See if user has previously modified their install to
# tell libvirtd to use --listen
grep -E '^LIBVIRTD_ARGS=.*--listen' /etc/sysconfig/libvirtd 1>/dev/null 2>&1
if test $? = 0
then
# Then lets keep honouring --listen and *not* use
# systemd socket activation, because switching things
# might confuse mgmt tool like puppet/ansible that
# expect the old style libvirtd
/bin/systemctl mask libvirtd.socket >/dev/null 2>&1 || :
/bin/systemctl mask libvirtd-ro.socket >/dev/null 2>&1 || :
/bin/systemctl mask libvirtd-admin.socket >/dev/null 2>&1 || :
/bin/systemctl mask libvirtd-tls.socket >/dev/null 2>&1 || :
/bin/systemctl mask libvirtd-tcp.socket >/dev/null 2>&1 || :
else
# Old libvirtd owns the sockets and will delete them on
# shutdown. Can't use a try-restart as libvirtd will simply
# own the sockets again when it comes back up. Thus we must
# do this particular ordering, so that we get libvirtd
# running with socket activation in use
/bin/systemctl is-active libvirtd.service 1>/dev/null 2>&1
if test $? = 0
then
/bin/systemctl stop libvirtd.service >/dev/null 2>&1 || :
/bin/systemctl try-restart libvirtd.socket >/dev/null 2>&1 || :
/bin/systemctl try-restart libvirtd-ro.socket >/dev/null 2>&1 || :
/bin/systemctl try-restart libvirtd-admin.socket >/dev/null 2>&1 || :
/bin/systemctl start libvirtd.service >/dev/null 2>&1 || :
fi
fi
fi
rm -rf %{_localstatedir}/lib/rpm-state/libvirt || :
%post daemon-driver-network
%if %{with_firewalld_zone}
%firewalld_reload
%endif
%postun daemon-driver-network
%if %{with_firewalld_zone}
%firewalld_reload
%endif
%post daemon-config-network
if test $1 -eq 1 && test ! -f %{_sysconfdir}/libvirt/qemu/networks/default.xml ; then
# see if the network used by default network creates a conflict,
@ -1338,6 +1306,8 @@ if test $1 -eq 1 && test ! -f %{_sysconfdir}/libvirt/qemu/networks/default.xml ;
< %{_datadir}/libvirt/networks/default.xml \
> %{_sysconfdir}/libvirt/qemu/networks/default.xml
ln -s ../default.xml %{_sysconfdir}/libvirt/qemu/networks/autostart/default.xml
# libvirt saves this file with mode 0600
chmod 0600 %{_sysconfdir}/libvirt/qemu/networks/default.xml
# Make sure libvirt picks up the new network defininiton
mkdir -p %{_localstatedir}/lib/rpm-state/libvirt || :
@ -1352,6 +1322,8 @@ rm -rf %{_localstatedir}/lib/rpm-state/libvirt || :
%post daemon-config-nwfilter
cp %{_datadir}/libvirt/nwfilter/*.xml %{_sysconfdir}/libvirt/nwfilter/
# libvirt saves these files with mode 600
chmod 600 %{_sysconfdir}/libvirt/nwfilter/*.xml
# Make sure libvirt picks up the new nwfilter defininitons
mkdir -p %{_localstatedir}/lib/rpm-state/libvirt || :
touch %{_localstatedir}/lib/rpm-state/libvirt/restart || :
@ -1363,16 +1335,6 @@ fi
rm -rf %{_localstatedir}/lib/rpm-state/libvirt || :
%triggerun -- libvirt < 0.9.4
%{_bindir}/systemd-sysv-convert --save libvirtd >/dev/null 2>&1 ||:
# If the package is allowed to autostart:
/bin/systemctl --no-reload enable libvirtd.service >/dev/null 2>&1 ||:
# Run these because the SysV package being removed won't do them
/sbin/chkconfig --del libvirtd >/dev/null 2>&1 || :
/bin/systemctl try-restart libvirtd.service >/dev/null 2>&1 || :
%if %{with_qemu}
%pre daemon-driver-qemu
# We want soft static allocation of well-known ids, as disk images
@ -1395,32 +1357,11 @@ exit 0
%systemd_preun libvirt-guests.service
%post client
/sbin/ldconfig
%systemd_post libvirt-guests.service
%postun client
/sbin/ldconfig
%systemd_postun libvirt-guests.service
%triggerun client -- libvirt < 0.9.4
%{_bindir}/systemd-sysv-convert --save libvirt-guests >/dev/null 2>&1 ||:
# If the package is allowed to autostart:
/bin/systemctl --no-reload enable libvirt-guests.service >/dev/null 2>&1 ||:
# Run this because the SysV package being removed won't do them
/sbin/chkconfig --del libvirt-guests >/dev/null 2>&1 || :
%if %{with_sanlock}
%post lock-sanlock
if getent group sanlock > /dev/null ; then
chmod 0770 %{_localstatedir}/lib/libvirt/sanlock
chown root:sanlock %{_localstatedir}/lib/libvirt/sanlock
fi
%endif
%if %{with_lxc}
%pre login-shell
getent group virtlogin >/dev/null || groupadd -r virtlogin
@ -1430,29 +1371,25 @@ exit 0
%files
%files docs
%doc AUTHORS ChangeLog.gz NEWS README README.md
%doc libvirt-docs/*
# API docs
%dir %{_datadir}/gtk-doc/html/libvirt/
%doc %{_datadir}/gtk-doc/html/libvirt/*.devhelp
%doc %{_datadir}/gtk-doc/html/libvirt/*.html
%doc %{_datadir}/gtk-doc/html/libvirt/*.png
%doc %{_datadir}/gtk-doc/html/libvirt/*.css
%doc examples/c/admin
%doc examples/c/domain
%doc examples/c/misc
%doc examples/polkit
%doc examples/sh
%doc examples/systemtap
%doc examples/xml
%doc AUTHORS ChangeLog NEWS README README.md
%doc %{_vpath_builddir}/libvirt-docs/*
%files daemon
%dir %attr(0700, root, root) %{_sysconfdir}/libvirt/
%{_unitdir}/libvirtd.service
%{_unitdir}/libvirtd.socket
%{_unitdir}/libvirtd-ro.socket
%{_unitdir}/libvirtd-admin.socket
%{_unitdir}/libvirtd-tcp.socket
%{_unitdir}/libvirtd-tls.socket
%{_unitdir}/virtproxyd.service
%{_unitdir}/virtproxyd.socket
%{_unitdir}/virtproxyd-ro.socket
%{_unitdir}/virtproxyd-admin.socket
%{_unitdir}/virtproxyd-tcp.socket
%{_unitdir}/virtproxyd-tls.socket
%{_unitdir}/virt-guest-shutdown.target
%{_unitdir}/virtlogd.service
%{_unitdir}/virtlogd.socket
@ -1464,6 +1401,7 @@ exit 0
%config(noreplace) %{_sysconfdir}/sysconfig/virtlogd
%config(noreplace) %{_sysconfdir}/sysconfig/virtlockd
%config(noreplace) %{_sysconfdir}/libvirt/libvirtd.conf
%config(noreplace) %{_sysconfdir}/libvirt/virtproxyd.conf
%config(noreplace) %{_sysconfdir}/libvirt/virtlogd.conf
%config(noreplace) %{_sysconfdir}/libvirt/virtlockd.conf
%config(noreplace) %{_sysconfdir}/sasl2/libvirt.conf
@ -1472,7 +1410,7 @@ exit 0
%config(noreplace) %{_sysconfdir}/logrotate.d/libvirtd
%dir %{_datadir}/libvirt/
%ghost %dir %{_localstatedir}/run/libvirt/
%ghost %dir %{_rundir}/libvirt/
%dir %attr(0711, root, root) %{_localstatedir}/lib/libvirt/images/
%dir %attr(0711, root, root) %{_localstatedir}/lib/libvirt/filesystems/
@ -1491,6 +1429,8 @@ exit 0
%{_datadir}/augeas/lenses/tests/test_virtlogd.aug
%{_datadir}/augeas/lenses/virtlockd.aug
%{_datadir}/augeas/lenses/tests/test_virtlockd.aug
%{_datadir}/augeas/lenses/virtproxyd.aug
%{_datadir}/augeas/lenses/tests/test_virtproxyd.aug
%{_datadir}/augeas/lenses/libvirt_lockd.aug
%if %{with_qemu}
%{_datadir}/augeas/lenses/tests/test_libvirt_lockd.aug
@ -1505,6 +1445,7 @@ exit 0
%attr(0755, root, root) %{_libexecdir}/libvirt_iohelper
%attr(0755, root, root) %{_sbindir}/libvirtd
%attr(0755, root, root) %{_sbindir}/virtproxyd
%attr(0755, root, root) %{_sbindir}/virtlogd
%attr(0755, root, root) %{_sbindir}/virtlockd
@ -1513,11 +1454,11 @@ exit 0
%{_mandir}/man8/virtlockd.8*
%{_mandir}/man7/virkey*.7*
%doc examples/polkit/*.rules
%files daemon-config-network
%dir %{_datadir}/libvirt/networks/
%{_datadir}/libvirt/networks/default.xml
%ghost %{_sysconfdir}/libvirt/qemu/networks/default.xml
%ghost %{_sysconfdir}/libvirt/qemu/networks/autostart/default.xml
%files daemon-config-nwfilter
%dir %{_datadir}/libvirt/nwfilter/
@ -1525,13 +1466,29 @@ exit 0
%ghost %{_sysconfdir}/libvirt/nwfilter/*.xml
%files daemon-driver-interface
%config(noreplace) %{_sysconfdir}/libvirt/virtinterfaced.conf
%{_datadir}/augeas/lenses/virtinterfaced.aug
%{_datadir}/augeas/lenses/tests/test_virtinterfaced.aug
%{_unitdir}/virtinterfaced.service
%{_unitdir}/virtinterfaced.socket
%{_unitdir}/virtinterfaced-ro.socket
%{_unitdir}/virtinterfaced-admin.socket
%attr(0755, root, root) %{_sbindir}/virtinterfaced
%{_libdir}/%{name}/connection-driver/libvirt_driver_interface.so
%files daemon-driver-network
%config(noreplace) %{_sysconfdir}/libvirt/virtnetworkd.conf
%{_datadir}/augeas/lenses/virtnetworkd.aug
%{_datadir}/augeas/lenses/tests/test_virtnetworkd.aug
%{_unitdir}/virtnetworkd.service
%{_unitdir}/virtnetworkd.socket
%{_unitdir}/virtnetworkd-ro.socket
%{_unitdir}/virtnetworkd-admin.socket
%attr(0755, root, root) %{_sbindir}/virtnetworkd
%dir %attr(0700, root, root) %{_sysconfdir}/libvirt/qemu/
%dir %attr(0700, root, root) %{_sysconfdir}/libvirt/qemu/networks/
%dir %attr(0700, root, root) %{_sysconfdir}/libvirt/qemu/networks/autostart
%ghost %dir %{_localstatedir}/run/libvirt/network/
%ghost %dir %{_rundir}/libvirt/network/
%dir %attr(0700, root, root) %{_localstatedir}/lib/libvirt/network/
%dir %attr(0755, root, root) %{_localstatedir}/lib/libvirt/dnsmasq/
%attr(0755, root, root) %{_libexecdir}/libvirt_leaseshelper
@ -1542,19 +1499,51 @@ exit 0
%endif
%files daemon-driver-nodedev
%config(noreplace) %{_sysconfdir}/libvirt/virtnodedevd.conf
%{_datadir}/augeas/lenses/virtnodedevd.aug
%{_datadir}/augeas/lenses/tests/test_virtnodedevd.aug
%{_unitdir}/virtnodedevd.service
%{_unitdir}/virtnodedevd.socket
%{_unitdir}/virtnodedevd-ro.socket
%{_unitdir}/virtnodedevd-admin.socket
%attr(0755, root, root) %{_sbindir}/virtnodedevd
%{_libdir}/%{name}/connection-driver/libvirt_driver_nodedev.so
%files daemon-driver-nwfilter
%config(noreplace) %{_sysconfdir}/libvirt/virtnwfilterd.conf
%{_datadir}/augeas/lenses/virtnwfilterd.aug
%{_datadir}/augeas/lenses/tests/test_virtnwfilterd.aug
%{_unitdir}/virtnwfilterd.service
%{_unitdir}/virtnwfilterd.socket
%{_unitdir}/virtnwfilterd-ro.socket
%{_unitdir}/virtnwfilterd-admin.socket
%attr(0755, root, root) %{_sbindir}/virtnwfilterd
%dir %attr(0700, root, root) %{_sysconfdir}/libvirt/nwfilter/
%ghost %dir %{_localstatedir}/run/libvirt/network/
%ghost %dir %{_rundir}/libvirt/network/
%{_libdir}/%{name}/connection-driver/libvirt_driver_nwfilter.so
%files daemon-driver-secret
%config(noreplace) %{_sysconfdir}/libvirt/virtsecretd.conf
%{_datadir}/augeas/lenses/virtsecretd.aug
%{_datadir}/augeas/lenses/tests/test_virtsecretd.aug
%{_unitdir}/virtsecretd.service
%{_unitdir}/virtsecretd.socket
%{_unitdir}/virtsecretd-ro.socket
%{_unitdir}/virtsecretd-admin.socket
%attr(0755, root, root) %{_sbindir}/virtsecretd
%{_libdir}/%{name}/connection-driver/libvirt_driver_secret.so
%files daemon-driver-storage
%files daemon-driver-storage-core
%config(noreplace) %{_sysconfdir}/libvirt/virtstoraged.conf
%{_datadir}/augeas/lenses/virtstoraged.aug
%{_datadir}/augeas/lenses/tests/test_virtstoraged.aug
%{_unitdir}/virtstoraged.service
%{_unitdir}/virtstoraged.socket
%{_unitdir}/virtstoraged-ro.socket
%{_unitdir}/virtstoraged-admin.socket
%attr(0755, root, root) %{_sbindir}/virtstoraged
%attr(0755, root, root) %{_libexecdir}/libvirt_parthelper
%{_libdir}/%{name}/connection-driver/libvirt_driver_storage.so
%{_libdir}/%{name}/storage-backend/libvirt_storage_backend_fs.so
@ -1603,12 +1592,20 @@ exit 0
%if %{with_qemu}
%files daemon-driver-qemu
%config(noreplace) %{_sysconfdir}/libvirt/virtqemud.conf
%{_datadir}/augeas/lenses/virtqemud.aug
%{_datadir}/augeas/lenses/tests/test_virtqemud.aug
%{_unitdir}/virtqemud.service
%{_unitdir}/virtqemud.socket
%{_unitdir}/virtqemud-ro.socket
%{_unitdir}/virtqemud-admin.socket
%attr(0755, root, root) %{_sbindir}/virtqemud
%dir %attr(0700, root, root) %{_sysconfdir}/libvirt/qemu/
%dir %attr(0700, root, root) %{_localstatedir}/log/libvirt/qemu/
%config(noreplace) %{_sysconfdir}/libvirt/qemu.conf
%config(noreplace) %{_sysconfdir}/libvirt/qemu-lockd.conf
%config(noreplace) %{_sysconfdir}/logrotate.d/libvirtd.qemu
%ghost %dir %attr(0700, root, root) %{_localstatedir}/run/libvirt/qemu/
%ghost %dir %{_rundir}/libvirt/qemu/
%dir %attr(0751, %{qemu_user}, %{qemu_group}) %{_localstatedir}/lib/libvirt/qemu/
%dir %attr(0750, %{qemu_user}, %{qemu_group}) %{_localstatedir}/cache/libvirt/qemu/
%{_datadir}/augeas/lenses/libvirtd_qemu.aug
@ -1616,14 +1613,24 @@ exit 0
%{_libdir}/%{name}/connection-driver/libvirt_driver_qemu.so
%dir %attr(0711, root, root) %{_localstatedir}/lib/libvirt/swtpm/
%dir %attr(0711, root, root) %{_localstatedir}/log/swtpm/libvirt/qemu/
%{_bindir}/virt-qemu-run
%{_mandir}/man1/virt-qemu-run.1*
%endif
%if %{with_lxc}
%files daemon-driver-lxc
%config(noreplace) %{_sysconfdir}/libvirt/virtlxcd.conf
%{_datadir}/augeas/lenses/virtlxcd.aug
%{_datadir}/augeas/lenses/tests/test_virtlxcd.aug
%{_unitdir}/virtlxcd.service
%{_unitdir}/virtlxcd.socket
%{_unitdir}/virtlxcd-ro.socket
%{_unitdir}/virtlxcd-admin.socket
%attr(0755, root, root) %{_sbindir}/virtlxcd
%dir %attr(0700, root, root) %{_localstatedir}/log/libvirt/lxc/
%config(noreplace) %{_sysconfdir}/libvirt/lxc.conf
%config(noreplace) %{_sysconfdir}/logrotate.d/libvirtd.lxc
%ghost %dir %{_localstatedir}/run/libvirt/lxc/
%ghost %dir %{_rundir}/libvirt/lxc/
%dir %attr(0700, root, root) %{_localstatedir}/lib/libvirt/lxc/
%{_datadir}/augeas/lenses/libvirtd_lxc.aug
%{_datadir}/augeas/lenses/tests/test_libvirtd_lxc.aug
@ -1633,19 +1640,35 @@ exit 0
%if %{with_libxl}
%files daemon-driver-libxl
%config(noreplace) %{_sysconfdir}/libvirt/virtxend.conf
%{_datadir}/augeas/lenses/virtxend.aug
%{_datadir}/augeas/lenses/tests/test_virtxend.aug
%{_unitdir}/virtxend.service
%{_unitdir}/virtxend.socket
%{_unitdir}/virtxend-ro.socket
%{_unitdir}/virtxend-admin.socket
%attr(0755, root, root) %{_sbindir}/virtxend
%config(noreplace) %{_sysconfdir}/libvirt/libxl.conf
%config(noreplace) %{_sysconfdir}/logrotate.d/libvirtd.libxl
%config(noreplace) %{_sysconfdir}/libvirt/libxl-lockd.conf
%{_datadir}/augeas/lenses/libvirtd_libxl.aug
%{_datadir}/augeas/lenses/tests/test_libvirtd_libxl.aug
%dir %attr(0700, root, root) %{_localstatedir}/log/libvirt/libxl/
%ghost %dir %{_localstatedir}/run/libvirt/libxl/
%ghost %dir %{_rundir}/libvirt/libxl/
%dir %attr(0700, root, root) %{_localstatedir}/lib/libvirt/libxl/
%{_libdir}/%{name}/connection-driver/libvirt_driver_libxl.so
%endif
%if %{with_vbox}
%files daemon-driver-vbox
%config(noreplace) %{_sysconfdir}/libvirt/virtvboxd.conf
%{_datadir}/augeas/lenses/virtvboxd.aug
%{_datadir}/augeas/lenses/tests/test_virtvboxd.aug
%{_unitdir}/virtvboxd.service
%{_unitdir}/virtvboxd.socket
%{_unitdir}/virtvboxd-ro.socket
%{_unitdir}/virtvboxd-admin.socket
%attr(0755, root, root) %{_sbindir}/virtvboxd
%{_libdir}/%{name}/connection-driver/libvirt_driver_vbox.so
%endif
@ -1680,7 +1703,7 @@ exit 0
%attr(0755, root, root) %{_libdir}/libvirt/lock-driver/sanlock.so
%{_datadir}/augeas/lenses/libvirt_sanlock.aug
%{_datadir}/augeas/lenses/tests/test_libvirt_sanlock.aug
%dir %attr(0700, root, root) %{_localstatedir}/lib/libvirt/sanlock
%dir %attr(0770, root, sanlock) %{_localstatedir}/lib/libvirt/sanlock
%{_sbindir}/virt-sanlock-cleanup
%{_mandir}/man8/virt-sanlock-cleanup.8*
%attr(0755, root, root) %{_libexecdir}/libvirt_sanlock_helper
@ -1711,7 +1734,7 @@ exit 0
%config(noreplace) %{_sysconfdir}/sysconfig/libvirt-guests
%attr(0755, root, root) %{_libexecdir}/libvirt-guests.sh
%files libs -f %{name}.lang
%files libs -f %{_vpath_builddir}/%{name}.lang
%license COPYING COPYING.LESSER
%config(noreplace) %{_sysconfdir}/libvirt/libvirt.conf
%config(noreplace) %{_sysconfdir}/libvirt/libvirt-admin.conf
@ -1727,7 +1750,9 @@ exit 0
%{_datadir}/libvirt/schemas/capability.rng
%{_datadir}/libvirt/schemas/cputypes.rng
%{_datadir}/libvirt/schemas/domain.rng
%{_datadir}/libvirt/schemas/domainbackup.rng
%{_datadir}/libvirt/schemas/domaincaps.rng
%{_datadir}/libvirt/schemas/domaincheckpoint.rng
%{_datadir}/libvirt/schemas/domaincommon.rng
%{_datadir}/libvirt/schemas/domainsnapshot.rng
%{_datadir}/libvirt/schemas/interface.rng
@ -1772,6 +1797,7 @@ exit 0
%if %{with_lxc}
%files login-shell
%attr(4750, root, virtlogin) %{_bindir}/virt-login-shell
%{_libexecdir}/virt-login-shell-helper
%config(noreplace) %{_sysconfdir}/libvirt/virt-login-shell.conf
%{_mandir}/man1/virt-login-shell.1*
%endif
@ -1787,6 +1813,7 @@ exit 0
%{_includedir}/libvirt/libvirt-admin.h
%{_includedir}/libvirt/libvirt-common.h
%{_includedir}/libvirt/libvirt-domain.h
%{_includedir}/libvirt/libvirt-domain-checkpoint.h
%{_includedir}/libvirt/libvirt-domain-snapshot.h
%{_includedir}/libvirt/libvirt-event.h
%{_includedir}/libvirt/libvirt-host.h
@ -1809,35 +1836,10 @@ exit 0
%{_datadir}/libvirt/api/libvirt-admin-api.xml
%{_datadir}/libvirt/api/libvirt-qemu-api.xml
%{_datadir}/libvirt/api/libvirt-lxc-api.xml
# Needed building python bindings
%doc docs/libvirt-api.xml
%changelog
* Sat May 09 2020 Xu Yandong <xuyandong2@huawei.com> - 5.5.0-7
- Cherry-pick CVE-2019-20485 patches.
* Mon Jan 06 2020 Xu Yandong <xuyandong2@huawei.com> - 5.5.0-6
- Translate running state to chinese.
* Wed Dec 25 2019 Xu Yandong <xuyandong2@huawei.com> - 5.5.0-5
- cherry-pick bugfix from upstream.
* Tue Dec 24 2019 Xu Yandong <xuyandong2@huawei.com> - 5.5.0-2
- Cherry-pick CVE-2019-11135 patches.
* Fri Nov 29 2019 openEuler Buildteam <buildteam@openeuler.org> - 5.5.0-1
- Remove zfs-fuse support for x86_64.
* Fri Sep 6 2019 openEuler Buildteam <buildteam@openeuler.org> - 5.5.0-1
- Support ARM CPU Host Model.
- Support Kunpeng-920 CPU.
* Wed Aug 28 2019 openEuler Buildteam <buildteam@openeuler.org> - 5.5.0-1
- Remove unnessary virObjectUnref after use VIR_AUTOUNREF
* Mon Aug 26 2019 openEuler Buildteam <buildteam@openeuler.org> - 5.5.0-1
- Use the same def of device when attach live and config.
* Thu Aug 15 2019 openEuler Buildteam <buildteam@openeuler.org> - 5.5.0-1
- Fix driver cleanup order to avoid coredump.
* Wed Aug 14 2019 openEuler Buildteam <buildteam@openeuler.org> - 5.5.0-1
- Avoid double free when prase device xml failed.
* Wed Jul 31 2019 openEuler Buildteam <buildteam@openeuler.org> - 5.5.0-1
- cherry-pick bugfix from upstream.
* Mon Jul 29 2019 openEuler Buildteam <buildteam@openeuler.org> - 5.5.0-1
- Backport some memory leak patches from Huawei.
* Tue Apr 14 2020 Xu Yandong <xuyandong2@huawei.com> - 6.2.0-1
- Rebase to version 6.2.0.
* Fri Jul 19 2019 openEuler Buildteam <buildteam@openeuler.org> - 5.5.0-1
- Update to 5.5.0 release, Initial package for openEuler.