!14 [feature] Sync codes with openEuler-20.03-LTS
Merge pull request !14 from zhanghailiang/master
This commit is contained in:
commit
00ca4958ae
Binary file not shown.
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
@ -1,8 +1,7 @@
|
||||
From d5ac07dee8c9337878ed0085e940c86d3f2ade0b Mon Sep 17 00:00:00 2001
|
||||
From 432afe3f14418ea5d2d69e62d678ef5bb08caaa1 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
|
||||
Date: Wed, 15 Apr 2020 11:55:43 +0800
|
||||
Subject: 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
|
||||
@ -14,10 +13,10 @@ Signed-off-by: Xu Yandong <xuyandong2@huawei.com>
|
||||
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
|
||||
index c0e30f6..057f871 100644
|
||||
--- a/src/qemu/qemu_cgroup.c
|
||||
+++ b/src/qemu/qemu_cgroup.c
|
||||
@@ -870,8 +870,11 @@ qemuSetupCpuCgroup(virDomainObjPtr vm)
|
||||
@@ -904,8 +904,11 @@ qemuSetupCpuCgroup(virDomainObjPtr vm)
|
||||
if (virTypedParamsAddULLong(&eventParams, &eventNparams,
|
||||
&eventMaxparams,
|
||||
VIR_DOMAIN_TUNABLE_CPU_CPU_SHARES,
|
||||
@ -31,5 +30,5 @@ index ca76c4f..8a00703 100644
|
||||
event = virDomainEventTunableNewFromObj(vm, eventParams, eventNparams);
|
||||
}
|
||||
--
|
||||
2.19.1
|
||||
2.23.0
|
||||
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
@ -0,0 +1,44 @@
|
||||
From 1e6875a732d896138d3bc2351e5284d1ad13dd59 Mon Sep 17 00:00:00 2001
|
||||
From: Xu Yandong <xuyandong2@huawei.com>
|
||||
Date: Wed, 20 May 2020 02:33:27 -0400
|
||||
Subject: [PATCH] cpu/aarch64: enable host-model cpu for AArch64 architecture
|
||||
|
||||
The 'host-model' cpu is support by kunpeng-v virtualization
|
||||
suit, skip hypervisor host-model externsion checking on AArch64
|
||||
architecture.
|
||||
|
||||
Signed-off-by: Xu Yandong <xuyandong2@huawei.com>
|
||||
---
|
||||
src/qemu/qemu_command.c | 2 +-
|
||||
tests/qemuxml2argvtest.c | 2 --
|
||||
2 files changed, 1 insertion(+), 3 deletions(-)
|
||||
|
||||
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
|
||||
index 2f0e919..2f65b8d 100644
|
||||
--- a/src/qemu/qemu_command.c
|
||||
+++ b/src/qemu/qemu_command.c
|
||||
@@ -6582,7 +6582,7 @@ qemuBuildCpuModelArgStr(virQEMUDriverPtr driver,
|
||||
break;
|
||||
}
|
||||
|
||||
- if ((ARCH_IS_S390(def->os.arch) || ARCH_IS_ARM(def->os.arch)) &&
|
||||
+ if (ARCH_IS_S390(def->os.arch) &&
|
||||
cpu->features &&
|
||||
!virQEMUCapsGet(qemuCaps, QEMU_CAPS_QUERY_CPU_MODEL_EXPANSION)) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
|
||||
index 596dd7a..2153e44 100644
|
||||
--- a/tests/qemuxml2argvtest.c
|
||||
+++ b/tests/qemuxml2argvtest.c
|
||||
@@ -2736,8 +2736,6 @@ mymain(void)
|
||||
DO_TEST("aarch64-noacpi-nouefi", NONE);
|
||||
DO_TEST_PARSE_ERROR("aarch64-acpi-nouefi", NONE);
|
||||
|
||||
- /* QEMU 4.0.0 didn't have support for aarch64 CPU features */
|
||||
- DO_TEST_CAPS_ARCH_VER_FAILURE("aarch64-features-sve", "aarch64", "4.0.0");
|
||||
/* aarch64 doesn't support the same CPU features as x86 */
|
||||
DO_TEST_CAPS_ARCH_LATEST_FAILURE("aarch64-features-wrong", "aarch64");
|
||||
/* Can't enable vector lengths when SVE is overall disabled */
|
||||
--
|
||||
1.8.3.1
|
||||
|
||||
@ -0,0 +1,51 @@
|
||||
From efde450d2d0648475cde04f04f5e26c1a006c226 Mon Sep 17 00:00:00 2001
|
||||
From: Xu Yandong <xuyandong2@huawei.com>
|
||||
Date: Fri, 17 Apr 2020 14:40:27 +0800
|
||||
Subject: cpu/arm: add cpu data free function to virCPUarmDataFree
|
||||
|
||||
Signed-off-by: Xu Yandong <xuyandong2@huawei.com>
|
||||
---
|
||||
src/cpu/cpu_arm.c | 20 ++++++++++++++++++++
|
||||
1 file changed, 20 insertions(+)
|
||||
|
||||
diff --git a/src/cpu/cpu_arm.c b/src/cpu/cpu_arm.c
|
||||
index ee58021..230cd27 100644
|
||||
--- a/src/cpu/cpu_arm.c
|
||||
+++ b/src/cpu/cpu_arm.c
|
||||
@@ -61,6 +61,25 @@ virCPUarmFeatureFree(virCPUarmFeaturePtr feature)
|
||||
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(virCPUarmFeature, virCPUarmFeatureFree);
|
||||
|
||||
+static void
|
||||
+virCPUarmDataClear(virCPUarmData *data)
|
||||
+{
|
||||
+ if (!data)
|
||||
+ return;
|
||||
+
|
||||
+ VIR_FREE(data->features);
|
||||
+}
|
||||
+
|
||||
+static void
|
||||
+virCPUarmDataFree(virCPUDataPtr cpuData)
|
||||
+{
|
||||
+ if (!cpuData)
|
||||
+ return;
|
||||
+
|
||||
+ virCPUarmDataClear(&cpuData->data.arm);
|
||||
+ VIR_FREE(cpuData);
|
||||
+}
|
||||
+
|
||||
typedef struct _virCPUarmMap virCPUarmMap;
|
||||
typedef virCPUarmMap *virCPUarmMapPtr;
|
||||
struct _virCPUarmMap {
|
||||
@@ -259,6 +278,7 @@ struct cpuArchDriver cpuDriverArm = {
|
||||
.compare = virCPUarmCompare,
|
||||
.decode = NULL,
|
||||
.encode = NULL,
|
||||
+ .dataFree = virCPUarmDataFree,
|
||||
.baseline = virCPUarmBaseline,
|
||||
.update = virCPUarmUpdate,
|
||||
.validateFeatures = virCPUarmValidateFeatures,
|
||||
--
|
||||
2.23.0
|
||||
|
||||
275
libvirt-cpu-arm-add-decode-function.patch
Normal file
275
libvirt-cpu-arm-add-decode-function.patch
Normal file
@ -0,0 +1,275 @@
|
||||
From c69a629367b0e9bfa1a034301a4c3f88ad080586 Mon Sep 17 00:00:00 2001
|
||||
From: Xu Yandong <xuyandong2@huawei.com>
|
||||
Date: Sat, 18 Apr 2020 11:16:13 +0800
|
||||
Subject: cpu/arm: add decode function
|
||||
|
||||
Signed-off-by: Xu Yandong <xuyandong2@huawei.com>
|
||||
---
|
||||
src/cpu/cpu_arm.c | 150 ++++++++++++++++++++++++++++++++++--------
|
||||
src/cpu_map/index.xml | 3 -
|
||||
2 files changed, 122 insertions(+), 31 deletions(-)
|
||||
|
||||
diff --git a/src/cpu/cpu_arm.c b/src/cpu/cpu_arm.c
|
||||
index d85f111..eb9b1c9 100644
|
||||
--- a/src/cpu/cpu_arm.c
|
||||
+++ b/src/cpu/cpu_arm.c
|
||||
@@ -55,7 +55,6 @@ virCPUarmFeatureFree(virCPUarmFeaturePtr feature)
|
||||
return;
|
||||
|
||||
g_free(feature->name);
|
||||
-
|
||||
g_free(feature);
|
||||
}
|
||||
|
||||
@@ -80,6 +79,8 @@ virCPUarmDataFree(virCPUDataPtr cpuData)
|
||||
g_free(cpuData);
|
||||
}
|
||||
|
||||
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(virCPUData, virCPUarmDataFree);
|
||||
+
|
||||
typedef struct _virCPUarmVendor virCPUarmVendor;
|
||||
typedef virCPUarmVendor *virCPUarmVendorPtr;
|
||||
struct _virCPUarmVendor {
|
||||
@@ -103,6 +104,8 @@ virCPUarmVendorFree(virCPUarmVendorPtr vendor)
|
||||
VIR_FREE(vendor);
|
||||
}
|
||||
|
||||
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(virCPUarmVendor, virCPUarmVendorFree);
|
||||
+
|
||||
typedef struct _virCPUarmModel virCPUarmModel;
|
||||
typedef virCPUarmModel *virCPUarmModelPtr;
|
||||
struct _virCPUarmModel {
|
||||
@@ -175,6 +178,38 @@ virCPUarmMapFree(virCPUarmMapPtr map)
|
||||
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(virCPUarmMap, virCPUarmMapFree);
|
||||
|
||||
+static virCPUarmVendorPtr
|
||||
+virCPUarmVendorFindByID(virCPUarmMapPtr map,
|
||||
+ unsigned long vendor_id)
|
||||
+{
|
||||
+ size_t i;
|
||||
+
|
||||
+ for (i = 0; i < map->vendors->len; i++) {
|
||||
+ virCPUarmVendorPtr vendor = g_ptr_array_index(map->vendors, i);
|
||||
+
|
||||
+ if (vendor->value == vendor_id)
|
||||
+ return vendor;
|
||||
+ }
|
||||
+
|
||||
+ return NULL;
|
||||
+}
|
||||
+
|
||||
+static virCPUarmVendorPtr
|
||||
+virCPUarmVendorFindByName(virCPUarmMapPtr map,
|
||||
+ const char *name)
|
||||
+{
|
||||
+ size_t i;
|
||||
+
|
||||
+ for (i = 0; i < map->vendors->len; i++) {
|
||||
+ virCPUarmVendorPtr vendor = g_ptr_array_index(map->vendors, i);
|
||||
+
|
||||
+ if (STREQ(vendor->name, name))
|
||||
+ return vendor;
|
||||
+ }
|
||||
+
|
||||
+ return NULL;
|
||||
+}
|
||||
+
|
||||
static virCPUarmFeaturePtr
|
||||
virCPUarmMapFeatureFind(virCPUarmMapPtr map,
|
||||
const char *name)
|
||||
@@ -213,36 +248,43 @@ virCPUarmMapFeatureParse(xmlXPathContextPtr ctxt G_GNUC_UNUSED,
|
||||
return 0;
|
||||
}
|
||||
|
||||
-static virCPUarmVendorPtr
|
||||
-virCPUarmVendorFindByID(virCPUarmMapPtr map,
|
||||
- unsigned long vendor_id)
|
||||
+static int
|
||||
+armCpuDataParseFeatures(virCPUDefPtr cpu,
|
||||
+ const virCPUarmData *cpuData)
|
||||
{
|
||||
+ int ret = -1;
|
||||
size_t i;
|
||||
+ char **features;
|
||||
|
||||
- for (i = 0; i < map->vendors->len; i++) {
|
||||
- virCPUarmVendorPtr vendor = g_ptr_array_index(map->vendors, i);
|
||||
+ if (!cpu || !cpuData)
|
||||
+ return ret;
|
||||
|
||||
- if (vendor->value == vendor_id)
|
||||
- return vendor;
|
||||
- }
|
||||
+ if (!(features = virStringSplitCount(cpuData->features, " ",
|
||||
+ 0, &cpu->nfeatures)))
|
||||
+ return ret;
|
||||
|
||||
- return NULL;
|
||||
-}
|
||||
+ if (cpu->nfeatures) {
|
||||
+ if (VIR_ALLOC_N(cpu->features, cpu->nfeatures) < 0)
|
||||
+ goto error;
|
||||
|
||||
-static virCPUarmVendorPtr
|
||||
-virCPUarmVendorFindByName(virCPUarmMapPtr map,
|
||||
- const char *name)
|
||||
-{
|
||||
- size_t i;
|
||||
+ for (i = 0; i < cpu->nfeatures; i++) {
|
||||
+ cpu->features[i].policy = VIR_CPU_FEATURE_REQUIRE;
|
||||
+ cpu->features[i].name = g_strdup(features[i]);
|
||||
+ }
|
||||
+ }
|
||||
|
||||
- for (i = 0; i < map->vendors->len; i++) {
|
||||
- virCPUarmVendorPtr vendor = g_ptr_array_index(map->vendors, i);
|
||||
+ ret = 0;
|
||||
|
||||
- if (STREQ(vendor->name, name))
|
||||
- return vendor;
|
||||
- }
|
||||
+cleanup:
|
||||
+ virStringListFree(features);
|
||||
+ return ret;
|
||||
|
||||
- return NULL;
|
||||
+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
|
||||
@@ -252,7 +294,6 @@ virCPUarmVendorParse(xmlXPathContextPtr ctxt,
|
||||
{
|
||||
virCPUarmMapPtr map = (virCPUarmMapPtr)data;
|
||||
g_autoptr(virCPUarmVendor) vendor = NULL;
|
||||
- int ret = -1;
|
||||
|
||||
if (virCPUarmVendorFindByName(map, name)) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
@@ -289,7 +330,7 @@ virCPUarmModelFindByPVR(virCPUarmMapPtr map,
|
||||
for (i = 0; i < map->models->len; i++) {
|
||||
virCPUarmModelPtr model = g_ptr_array_index(map->models, i);
|
||||
|
||||
- if (STREQ(model->pvr, pvr))
|
||||
+ if (model->data.pvr == pvr)
|
||||
return model;
|
||||
}
|
||||
|
||||
@@ -299,7 +340,7 @@ virCPUarmModelFindByPVR(virCPUarmMapPtr map,
|
||||
|
||||
static virCPUarmModelPtr
|
||||
virCPUarmModelFindByName(virCPUarmMapPtr map,
|
||||
- const char *name)
|
||||
+ const char *name)
|
||||
{
|
||||
size_t i;
|
||||
|
||||
@@ -321,7 +362,6 @@ virCPUarmModelParse(xmlXPathContextPtr ctxt,
|
||||
virCPUarmMapPtr map = (virCPUarmMapPtr)data;
|
||||
g_autoptr(virCPUarmModel) model = NULL;
|
||||
char *vendor = NULL;
|
||||
- int ret = -1;
|
||||
|
||||
if (virCPUarmModelFindByName(map, name)) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
@@ -404,6 +444,60 @@ virCPUarmGetMap(void)
|
||||
return cpuMap;
|
||||
}
|
||||
|
||||
+static int
|
||||
+virCPUarmDecode(virCPUDefPtr cpu,
|
||||
+ const virCPUarmData *cpuData,
|
||||
+ virDomainCapsCPUModelsPtr models)
|
||||
+{
|
||||
+ virCPUarmMapPtr map;
|
||||
+ virCPUarmModelPtr model;
|
||||
+ virCPUarmVendorPtr vendor = NULL;
|
||||
+
|
||||
+ if (!cpuData || !(map = virCPUarmGetMap()))
|
||||
+ return -1;
|
||||
+
|
||||
+ if (!(model = virCPUarmModelFindByPVR(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;
|
||||
+ }
|
||||
+
|
||||
+ cpu->model = g_strdup(model->name);
|
||||
+
|
||||
+ if (cpuData->vendor_id &&
|
||||
+ !(vendor = virCPUarmVendorFindByID(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)
|
||||
+ cpu->vendor = g_strdup(vendor->name);
|
||||
+
|
||||
+ if (cpuData->features &&
|
||||
+ armCpuDataParseFeatures(cpu, cpuData) < 0)
|
||||
+ return -1;
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int
|
||||
+virCPUarmDecodeCPUData(virCPUDefPtr cpu,
|
||||
+ const virCPUData *data,
|
||||
+ virDomainCapsCPUModelsPtr models)
|
||||
+{
|
||||
+ return virCPUarmDecode(cpu, &data->data.arm, models);
|
||||
+}
|
||||
+
|
||||
static int
|
||||
virCPUarmUpdate(virCPUDefPtr guest,
|
||||
const virCPUDef *host)
|
||||
@@ -432,7 +526,7 @@ virCPUarmUpdate(virCPUDefPtr guest,
|
||||
guest->match = VIR_CPU_MATCH_EXACT;
|
||||
ret = 0;
|
||||
|
||||
- cleanup:
|
||||
+cleanup:
|
||||
virCPUDefFree(updated);
|
||||
return ret;
|
||||
}
|
||||
@@ -493,7 +587,7 @@ struct cpuArchDriver cpuDriverArm = {
|
||||
.arch = archs,
|
||||
.narch = G_N_ELEMENTS(archs),
|
||||
.compare = virCPUarmCompare,
|
||||
- .decode = NULL,
|
||||
+ .decode = virCPUarmDecodeCPUData,
|
||||
.encode = NULL,
|
||||
.dataFree = virCPUarmDataFree,
|
||||
.baseline = virCPUarmBaseline,
|
||||
diff --git a/src/cpu_map/index.xml b/src/cpu_map/index.xml
|
||||
index 2e78834..985af86 100644
|
||||
--- a/src/cpu_map/index.xml
|
||||
+++ b/src/cpu_map/index.xml
|
||||
@@ -86,9 +86,6 @@
|
||||
|
||||
<arch name='arm'>
|
||||
<include filename='arm_features.xml'/>
|
||||
- </arch>
|
||||
-
|
||||
- <arch name='arm'>
|
||||
<include filename="arm_vendors.xml"/>
|
||||
|
||||
<!-- ARM-based CPU models -->
|
||||
--
|
||||
2.23.0
|
||||
|
||||
287
libvirt-cpu-arm-add-load-cpu-map-parse-function.patch
Normal file
287
libvirt-cpu-arm-add-load-cpu-map-parse-function.patch
Normal file
@ -0,0 +1,287 @@
|
||||
From a0574d45603010761d3f3034f97457fda94d2266 Mon Sep 17 00:00:00 2001
|
||||
From: Xu Yandong <xuyandong2@huawei.com>
|
||||
Date: Fri, 17 Apr 2020 18:13:32 +0800
|
||||
Subject: cpu/arm: add load cpu map parse function
|
||||
|
||||
Signed-off-by: Xu Yandong <xuyandong2@huawei.com>
|
||||
---
|
||||
src/cpu/cpu_arm.c | 223 +++++++++++++++++++++++++++++++++++++++++++++-
|
||||
1 file changed, 220 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/src/cpu/cpu_arm.c b/src/cpu/cpu_arm.c
|
||||
index 230cd27..d85f111 100644
|
||||
--- a/src/cpu/cpu_arm.c
|
||||
+++ b/src/cpu/cpu_arm.c
|
||||
@@ -67,7 +67,7 @@ virCPUarmDataClear(virCPUarmData *data)
|
||||
if (!data)
|
||||
return;
|
||||
|
||||
- VIR_FREE(data->features);
|
||||
+ g_free(data->features);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -77,12 +77,64 @@ virCPUarmDataFree(virCPUDataPtr cpuData)
|
||||
return;
|
||||
|
||||
virCPUarmDataClear(&cpuData->data.arm);
|
||||
- VIR_FREE(cpuData);
|
||||
+ g_free(cpuData);
|
||||
}
|
||||
|
||||
+typedef struct _virCPUarmVendor virCPUarmVendor;
|
||||
+typedef virCPUarmVendor *virCPUarmVendorPtr;
|
||||
+struct _virCPUarmVendor {
|
||||
+ char *name;
|
||||
+ unsigned long value;
|
||||
+};
|
||||
+
|
||||
+static virCPUarmVendorPtr
|
||||
+virCPUarmVendorNew(void)
|
||||
+{
|
||||
+ return g_new0(virCPUarmVendor, 1);
|
||||
+}
|
||||
+
|
||||
+static void
|
||||
+virCPUarmVendorFree(virCPUarmVendorPtr vendor)
|
||||
+{
|
||||
+ if (!vendor)
|
||||
+ return;
|
||||
+
|
||||
+ g_free(vendor->name);
|
||||
+ VIR_FREE(vendor);
|
||||
+}
|
||||
+
|
||||
+typedef struct _virCPUarmModel virCPUarmModel;
|
||||
+typedef virCPUarmModel *virCPUarmModelPtr;
|
||||
+struct _virCPUarmModel {
|
||||
+ char *name;
|
||||
+ virCPUarmVendorPtr vendor;
|
||||
+ virCPUarmData data;
|
||||
+};
|
||||
+
|
||||
+static virCPUarmModelPtr
|
||||
+virCPUarmModelNew(void)
|
||||
+{
|
||||
+ return g_new0(virCPUarmModel, 1);
|
||||
+}
|
||||
+
|
||||
+static void
|
||||
+virCPUarmModelFree(virCPUarmModelPtr model)
|
||||
+{
|
||||
+ if (!model)
|
||||
+ return;
|
||||
+
|
||||
+ virCPUarmDataClear(&model->data);
|
||||
+ g_free(model->name);
|
||||
+ g_free(model);
|
||||
+}
|
||||
+
|
||||
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(virCPUarmModel, virCPUarmModelFree);
|
||||
+
|
||||
typedef struct _virCPUarmMap virCPUarmMap;
|
||||
typedef virCPUarmMap *virCPUarmMapPtr;
|
||||
struct _virCPUarmMap {
|
||||
+ GPtrArray *vendors;
|
||||
+ GPtrArray *models;
|
||||
GPtrArray *features;
|
||||
};
|
||||
|
||||
@@ -93,6 +145,14 @@ virCPUarmMapNew(void)
|
||||
|
||||
map = g_new0(virCPUarmMap, 1);
|
||||
|
||||
+ map->vendors = g_ptr_array_new();
|
||||
+ g_ptr_array_set_free_func(map->vendors,
|
||||
+ (GDestroyNotify) virCPUarmVendorFree);
|
||||
+
|
||||
+ map->models = g_ptr_array_new();
|
||||
+ g_ptr_array_set_free_func(map->models,
|
||||
+ (GDestroyNotify) virCPUarmModelFree);
|
||||
+
|
||||
map->features = g_ptr_array_new();
|
||||
g_ptr_array_set_free_func(map->features,
|
||||
(GDestroyNotify) virCPUarmFeatureFree);
|
||||
@@ -106,6 +166,8 @@ virCPUarmMapFree(virCPUarmMapPtr map)
|
||||
if (!map)
|
||||
return;
|
||||
|
||||
+ g_ptr_array_free(map->vendors, TRUE);
|
||||
+ g_ptr_array_free(map->models, TRUE);
|
||||
g_ptr_array_free(map->features, TRUE);
|
||||
|
||||
g_free(map);
|
||||
@@ -151,6 +213,161 @@ virCPUarmMapFeatureParse(xmlXPathContextPtr ctxt G_GNUC_UNUSED,
|
||||
return 0;
|
||||
}
|
||||
|
||||
+static virCPUarmVendorPtr
|
||||
+virCPUarmVendorFindByID(virCPUarmMapPtr map,
|
||||
+ unsigned long vendor_id)
|
||||
+{
|
||||
+ size_t i;
|
||||
+
|
||||
+ for (i = 0; i < map->vendors->len; i++) {
|
||||
+ virCPUarmVendorPtr vendor = g_ptr_array_index(map->vendors, i);
|
||||
+
|
||||
+ if (vendor->value == vendor_id)
|
||||
+ return vendor;
|
||||
+ }
|
||||
+
|
||||
+ return NULL;
|
||||
+}
|
||||
+
|
||||
+static virCPUarmVendorPtr
|
||||
+virCPUarmVendorFindByName(virCPUarmMapPtr map,
|
||||
+ const char *name)
|
||||
+{
|
||||
+ size_t i;
|
||||
+
|
||||
+ for (i = 0; i < map->vendors->len; i++) {
|
||||
+ virCPUarmVendorPtr vendor = g_ptr_array_index(map->vendors, i);
|
||||
+
|
||||
+ if (STREQ(vendor->name, name))
|
||||
+ return vendor;
|
||||
+ }
|
||||
+
|
||||
+ return NULL;
|
||||
+}
|
||||
+
|
||||
+static int
|
||||
+virCPUarmVendorParse(xmlXPathContextPtr ctxt,
|
||||
+ const char *name,
|
||||
+ void *data)
|
||||
+{
|
||||
+ virCPUarmMapPtr map = (virCPUarmMapPtr)data;
|
||||
+ g_autoptr(virCPUarmVendor) vendor = NULL;
|
||||
+ int ret = -1;
|
||||
+
|
||||
+ if (virCPUarmVendorFindByName(map, name)) {
|
||||
+ virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
+ _("CPU vendor %s already defined"), name);
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
+ vendor = virCPUarmVendorNew();
|
||||
+ vendor->name = g_strdup(name);
|
||||
+
|
||||
+ if (virXPathULongHex("string(@value)", ctxt, &vendor->value) < 0) {
|
||||
+ virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
+ "%s", _("Missing CPU vendor value"));
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
+ if (virCPUarmVendorFindByID(map, vendor->value)) {
|
||||
+ virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
+ _("CPU vendor value 0x%2lx already defined"), vendor->value);
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
+ g_ptr_array_add(map->vendors, g_steal_pointer(&vendor));
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static virCPUarmModelPtr
|
||||
+virCPUarmModelFindByPVR(virCPUarmMapPtr map,
|
||||
+ unsigned long pvr)
|
||||
+{
|
||||
+ size_t i;
|
||||
+
|
||||
+ for (i = 0; i < map->models->len; i++) {
|
||||
+ virCPUarmModelPtr model = g_ptr_array_index(map->models, i);
|
||||
+
|
||||
+ if (STREQ(model->pvr, pvr))
|
||||
+ return model;
|
||||
+ }
|
||||
+
|
||||
+ return NULL;
|
||||
+
|
||||
+}
|
||||
+
|
||||
+static virCPUarmModelPtr
|
||||
+virCPUarmModelFindByName(virCPUarmMapPtr map,
|
||||
+ const char *name)
|
||||
+{
|
||||
+ size_t i;
|
||||
+
|
||||
+ for (i = 0; i < map->models->len; i++) {
|
||||
+ virCPUarmModelPtr model = g_ptr_array_index(map->models, i);
|
||||
+
|
||||
+ if (STREQ(model->name, name))
|
||||
+ return model;
|
||||
+ }
|
||||
+
|
||||
+ return NULL;
|
||||
+}
|
||||
+
|
||||
+static int
|
||||
+virCPUarmModelParse(xmlXPathContextPtr ctxt,
|
||||
+ const char *name,
|
||||
+ void *data)
|
||||
+{
|
||||
+ virCPUarmMapPtr map = (virCPUarmMapPtr)data;
|
||||
+ g_autoptr(virCPUarmModel) model = NULL;
|
||||
+ char *vendor = NULL;
|
||||
+ int ret = -1;
|
||||
+
|
||||
+ if (virCPUarmModelFindByName(map, name)) {
|
||||
+ virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
+ _("CPU model %s already defined"), name);
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
+ model = virCPUarmModelNew();
|
||||
+ model->name = g_strdup(name);
|
||||
+
|
||||
+ 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"),
|
||||
+ name);
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
+ if (!(model->vendor = virCPUarmVendorFindByName(map, vendor))) {
|
||||
+ virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
+ _("Unknown vendor %s referenced by CPU model %s"),
|
||||
+ vendor, model->name);
|
||||
+ return -1;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ if (!virXPathBoolean("boolean(./pvr)", ctxt)) {
|
||||
+ virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
+ _("Missing PVR information for CPU model %s"),
|
||||
+ model->name);
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
+ 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);
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
+ g_ptr_array_add(map->models, g_steal_pointer(&model));
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
static virCPUarmMapPtr
|
||||
virCPUarmLoadMap(void)
|
||||
{
|
||||
@@ -158,7 +375,7 @@ virCPUarmLoadMap(void)
|
||||
|
||||
map = virCPUarmMapNew();
|
||||
|
||||
- if (cpuMapLoad("arm", NULL, virCPUarmMapFeatureParse, NULL, map) < 0)
|
||||
+ if (cpuMapLoad("arm", virCPUarmVendorParse, virCPUarmMapFeatureParse, virCPUarmModelParse, map) < 0)
|
||||
return NULL;
|
||||
|
||||
return g_steal_pointer(&map);
|
||||
--
|
||||
2.23.0
|
||||
|
||||
@ -1,133 +1,127 @@
|
||||
From 4c3a9684e7fccef83158a4a2f74680c6d8e166f7 Mon Sep 17 00:00:00 2001
|
||||
From 208c9f1eb9a06d2550b7b3cfe0172840925255d4 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
|
||||
Date: Mon, 20 Apr 2020 17:29:17 +0800
|
||||
Subject: cpu/arm: add virCPUarmGetHost implment
|
||||
|
||||
Signed-off-by: Xu Yandong <xuyandong2@huawei.com>
|
||||
---
|
||||
src/cpu/cpu_arm.c | 92 +++++++++++++++++++++++++++++++++++++++++++++++
|
||||
1 file changed, 92 insertions(+)
|
||||
src/cpu/cpu_arm.c | 86 +++++++++++++++++++++++++++++++++++++++++++++++
|
||||
1 file changed, 86 insertions(+)
|
||||
|
||||
diff --git a/src/cpu/cpu_arm.c b/src/cpu/cpu_arm.c
|
||||
index b4c41c5..b3bc379 100644
|
||||
index eb9b1c9..78e604c 100644
|
||||
--- a/src/cpu/cpu_arm.c
|
||||
+++ b/src/cpu/cpu_arm.c
|
||||
@@ -532,6 +532,74 @@ armMakeCPUData(virArch arch,
|
||||
@@ -26,9 +26,15 @@
|
||||
#include "cpu_map.h"
|
||||
#include "virstring.h"
|
||||
#include "virxml.h"
|
||||
+#include "virfile.h"
|
||||
|
||||
#define VIR_FROM_THIS VIR_FROM_CPU
|
||||
|
||||
+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,
|
||||
@@ -531,6 +537,85 @@ cleanup:
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
+
|
||||
+static int
|
||||
+armCpuDataFromCpuInfo(virCPUarmData *data)
|
||||
+{
|
||||
+ int ret = -1;
|
||||
+ g_autofree char *str_vendor = NULL;
|
||||
+ g_autofree char *str_pvr = NULL;
|
||||
+ g_autofree char *outbuf = NULL;
|
||||
+ char *eol = NULL;
|
||||
+ char *str_vendor = NULL;
|
||||
+ char *str_pvr = NULL;
|
||||
+ char *outbuf = NULL;
|
||||
+ const char *cur;
|
||||
+
|
||||
+ if (!data)
|
||||
+ return ret;
|
||||
+ return -1;
|
||||
+
|
||||
+ if (virFileReadAll(CPUINFO, CPUINFO_FILE_LEN, &outbuf) < 0) {
|
||||
+ virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
+ _("Failed to open %s"), CPUINFO);
|
||||
+ goto cleanup;
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
+ /* Account for format 'CPU implementer : XXXX' */
|
||||
+ if ((cur = strstr(outbuf, "CPU implementer")) == NULL) {
|
||||
+ virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
+ _("there is no \"CPU implementer\" info in %s"), CPUINFO);
|
||||
+ goto cleanup;
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
+ /* 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 ||
|
||||
+ if (!eol || !(str_vendor = g_strndup(cur, eol - cur)) ||
|
||||
+ virStrToLong_ul(str_vendor, NULL, 16, &data->vendor_id) < 0)
|
||||
+ goto cleanup;
|
||||
+ return -1;
|
||||
+
|
||||
+ /* Account for format 'CPU part : XXXX' */
|
||||
+ if ((cur = strstr(outbuf, "CPU part")) == NULL) {
|
||||
+ virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
+ _("there is no \"CPU part\" info in %s"), CPUINFO);
|
||||
+ goto cleanup;
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
+ cur = strchr(cur, ':') + 1;
|
||||
+ eol = strchr(cur, '\n');
|
||||
+ virSkipSpaces(&cur);
|
||||
+ if (!eol || VIR_STRNDUP(str_pvr, cur, eol - cur) < 0 ||
|
||||
+ if (!eol || !(str_pvr = g_strndup(cur, eol - cur)) ||
|
||||
+ virStrToLong_ul(str_pvr, NULL, 16, &data->pvr) < 0)
|
||||
+ goto cleanup;
|
||||
+ return -1;
|
||||
+
|
||||
+ /* Account for format 'CPU Features : XXXX' */
|
||||
+ if ((cur = strstr(outbuf, "Features")) == NULL) {
|
||||
+ virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
+ _("there is no \"Features\" info in %s"), CPUINFO);
|
||||
+ goto cleanup;
|
||||
+ return -1;
|
||||
+ }
|
||||
+ cur = strchr(cur, ':') + 1;
|
||||
+ eol = strchr(cur, '\n');
|
||||
+ virSkipSpaces(&cur);
|
||||
+ if (eol && VIR_STRNDUP(data->features, cur, eol - cur) < 0)
|
||||
+ goto cleanup;
|
||||
+ if (eol && !(data->features = g_strndup(cur, eol - cur)))
|
||||
+ return -1;
|
||||
+
|
||||
+ ret = 0;
|
||||
+
|
||||
+ cleanup:
|
||||
+ VIR_FREE(outbuf);
|
||||
+ VIR_FREE(str_vendor);
|
||||
+ VIR_FREE(str_pvr);
|
||||
+ return ret;
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+
|
||||
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;
|
||||
+ g_autoptr(virCPUData) cpuData = NULL;
|
||||
+
|
||||
+ if (virCPUarmDriverInitialize() < 0)
|
||||
+ goto cleanup;
|
||||
+ return -1;
|
||||
+
|
||||
+ if (!(cpuData = virCPUDataNew(archs[0])))
|
||||
+ goto cleanup;
|
||||
+ return -1;
|
||||
+
|
||||
+ if (armCpuDataFromCpuInfo(&cpuData->data.arm) < 0)
|
||||
+ goto cleanup;
|
||||
+ return -1;
|
||||
+
|
||||
+ ret = armDecodeCPUData(cpu, cpuData, models);
|
||||
+
|
||||
+ cleanup:
|
||||
+ virCPUarmDataFree(cpuData);
|
||||
+ return ret;
|
||||
+ return virCPUarmDecodeCPUData(cpu, cpuData, models);
|
||||
+}
|
||||
+
|
||||
|
||||
static int
|
||||
virCPUarmUpdate(virCPUDefPtr guest,
|
||||
@@ -926,6 +1017,7 @@ struct cpuArchDriver cpuDriverArm = {
|
||||
.decode = armDecodeCPUData,
|
||||
static virCPUDefPtr
|
||||
virCPUarmBaseline(virCPUDefPtr *cpus,
|
||||
@@ -590,6 +675,7 @@ struct cpuArchDriver cpuDriverArm = {
|
||||
.decode = virCPUarmDecodeCPUData,
|
||||
.encode = NULL,
|
||||
.dataFree = virCPUarmDataFree,
|
||||
+ .getHost = virCPUarmGetHost,
|
||||
.baseline = virCPUarmBaseline,
|
||||
.update = virCPUarmUpdate,
|
||||
};
|
||||
.validateFeatures = virCPUarmValidateFeatures,
|
||||
--
|
||||
2.19.1
|
||||
2.23.0
|
||||
|
||||
216
libvirt-cpu-arm-implment-cpu-baseline-function.patch
Normal file
216
libvirt-cpu-arm-implment-cpu-baseline-function.patch
Normal file
@ -0,0 +1,216 @@
|
||||
From 4606782bde2a6e75e88d782fc58e5db5365502c2 Mon Sep 17 00:00:00 2001
|
||||
From: Xu Yandong <xuyandong2@huawei.com>
|
||||
Date: Mon, 20 Apr 2020 19:17:56 +0800
|
||||
Subject: cpu/arm: implment cpu baseline function
|
||||
|
||||
Signed-off-by: Xu Yandong <xuyandong2@huawei.com>
|
||||
---
|
||||
src/cpu/cpu_arm.c | 178 ++++++++++++++++++++++++++++++++++++++++++++--
|
||||
1 file changed, 174 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/src/cpu/cpu_arm.c b/src/cpu/cpu_arm.c
|
||||
index 78e604c..a7c9523 100644
|
||||
--- a/src/cpu/cpu_arm.c
|
||||
+++ b/src/cpu/cpu_arm.c
|
||||
@@ -616,24 +616,194 @@ virCPUarmGetHost(virCPUDefPtr cpu,
|
||||
return virCPUarmDecodeCPUData(cpu, cpuData, models);
|
||||
}
|
||||
|
||||
+static void
|
||||
+virCPUarmDataIntersect(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
|
||||
+virCPUarmDataCopy(virCPUarmData *dst, const virCPUarmData *src)
|
||||
+{
|
||||
+ dst->features = g_strdup(src->features);
|
||||
+ dst->vendor_id = src->vendor_id;
|
||||
+ dst->pvr = src->pvr;
|
||||
+}
|
||||
+
|
||||
+static virCPUarmModelPtr
|
||||
+virCPUarmModelCopy(virCPUarmModelPtr model)
|
||||
+{
|
||||
+ g_autoptr(virCPUarmModel) copy = NULL;
|
||||
+
|
||||
+ copy = virCPUarmModelNew();
|
||||
+
|
||||
+ virCPUarmDataCopy(©->data, &model->data);
|
||||
+ copy->name = g_strdup(model->name);
|
||||
+ copy->vendor = model->vendor;
|
||||
+
|
||||
+ return g_steal_pointer(©);
|
||||
+}
|
||||
+
|
||||
+static virCPUarmModelPtr
|
||||
+virCPUarmModelFromCPU(const virCPUDef *cpu,
|
||||
+ virCPUarmMapPtr map)
|
||||
+{
|
||||
+ g_autoptr(virCPUarmModel) 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 = virCPUarmModelFindByName(map, cpu->model))) {
|
||||
+ virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
+ _("Unknown CPU model %s"), cpu->model);
|
||||
+ return NULL;
|
||||
+ }
|
||||
+
|
||||
+ if (!(model = virCPUarmModelCopy(model)))
|
||||
+ return NULL;
|
||||
+
|
||||
+ if (cpu->vendor) {
|
||||
+ if (!(vendor = virCPUarmVendorFindByName(map, cpu->vendor))) {
|
||||
+ virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
+ _("Unknown CPU vendor %s"), cpu->vendor);
|
||||
+ return NULL;
|
||||
+ }
|
||||
+ model->data.vendor_id = vendor->value;
|
||||
+ }
|
||||
+
|
||||
+ if (cpu->nfeatures) {
|
||||
+ if (VIR_REALLOC_N(features, cpu->nfeatures + 1) < 0)
|
||||
+ return model;
|
||||
+
|
||||
+ features[cpu->nfeatures] = NULL;
|
||||
+ for (i = 0; i < cpu->nfeatures; i++)
|
||||
+ features[i] = g_strdup(cpu->features[i].name);
|
||||
+ VIR_FREE(model->data.features);
|
||||
+ model->data.features = virStringListJoin((const char **)features, " ");
|
||||
+ }
|
||||
+
|
||||
+ virStringListFree(features);
|
||||
+ return g_steal_pointer(&model);
|
||||
+}
|
||||
|
||||
static virCPUDefPtr
|
||||
virCPUarmBaseline(virCPUDefPtr *cpus,
|
||||
- unsigned int ncpus G_GNUC_UNUSED,
|
||||
- virDomainCapsCPUModelsPtr models G_GNUC_UNUSED,
|
||||
+ unsigned int ncpus,
|
||||
+ virDomainCapsCPUModelsPtr models,
|
||||
const char **features G_GNUC_UNUSED,
|
||||
bool migratable G_GNUC_UNUSED)
|
||||
{
|
||||
- virCPUDefPtr cpu = NULL;
|
||||
+ virCPUarmMapPtr map = NULL;
|
||||
+ g_autoptr(virCPUDef) cpu = NULL;
|
||||
+ g_autoptr(virCPUarmModel) model = NULL;
|
||||
+ g_autoptr(virCPUarmModel) baseModel = NULL;
|
||||
+ virCPUarmVendorPtr vendor = NULL;
|
||||
+ bool outputVendor = true;
|
||||
+ size_t i;
|
||||
|
||||
cpu = virCPUDefNew();
|
||||
|
||||
cpu->model = g_strdup(cpus[0]->model);
|
||||
|
||||
+ 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()))
|
||||
+ return NULL;
|
||||
+
|
||||
+ if (!(baseModel = virCPUarmModelFromCPU(cpus[0], map)))
|
||||
+ return NULL;
|
||||
+
|
||||
+ if (!cpus[0]->vendor) {
|
||||
+ outputVendor = false;
|
||||
+ } else if (!(vendor = virCPUarmVendorFindByName(map, cpus[0]->vendor))) {
|
||||
+ virReportError(VIR_ERR_OPERATION_FAILED,
|
||||
+ _("Unknown CPU vendor %s"), cpus[0]->vendor);
|
||||
+ return NULL;
|
||||
+ }
|
||||
+
|
||||
+ for (i = 0; i < ncpus; i++) {
|
||||
+ const char *vn = NULL;
|
||||
+ if (!(model = virCPUarmModelFromCPU(cpus[i], map)))
|
||||
+ return NULL;
|
||||
+
|
||||
+ if (cpus[i]->vendor) {
|
||||
+ vn = cpus[i]->vendor;
|
||||
+ } else {
|
||||
+ outputVendor = false;
|
||||
+ }
|
||||
+
|
||||
+ if (vn) {
|
||||
+ if (!vendor) {
|
||||
+ if (!(vendor = virCPUarmVendorFindByName(map, vn))) {
|
||||
+ virReportError(VIR_ERR_OPERATION_FAILED,
|
||||
+ _("Unknown CPU vendor %s"), vn);
|
||||
+ return NULL;
|
||||
+ }
|
||||
+ } else if (STRNEQ(vendor->name, vn)) {
|
||||
+ virReportError(VIR_ERR_OPERATION_FAILED,
|
||||
+ "%s", _("CPU vendors do not match"));
|
||||
+ return NULL;
|
||||
+ }
|
||||
+
|
||||
+ virCPUarmDataIntersect(&baseModel->data, &model->data);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ if (virCPUarmDecode(cpu, &baseModel->data, models) < 0)
|
||||
+ return NULL;
|
||||
+
|
||||
+ if (!outputVendor)
|
||||
+ g_free(cpu->vendor);
|
||||
|
||||
- return cpu;
|
||||
+ return g_steal_pointer(&cpu);
|
||||
}
|
||||
|
||||
static virCPUCompareResult
|
||||
--
|
||||
2.23.0
|
||||
|
||||
239
libvirt-cpu-arm-implment-cpu-compare-function.patch
Normal file
239
libvirt-cpu-arm-implment-cpu-compare-function.patch
Normal file
@ -0,0 +1,239 @@
|
||||
From 1a70b1e3bdbd8d0dcf9281341bc23b4ff2ffaa3a Mon Sep 17 00:00:00 2001
|
||||
From: Xu Yandong <xuyandong2@huawei.com>
|
||||
Date: Mon, 20 Apr 2020 19:33:49 +0800
|
||||
Subject: cpu/arm: implment cpu compare function
|
||||
|
||||
Signed-off-by: Xu Yandong <xuyandong2@huawei.com>
|
||||
---
|
||||
src/cpu/cpu_arm.c | 196 +++++++++++++++++++++++++++++++++++++++++++++-
|
||||
1 file changed, 193 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/src/cpu/cpu_arm.c b/src/cpu/cpu_arm.c
|
||||
index a7c9523..3ef54b9 100644
|
||||
--- a/src/cpu/cpu_arm.c
|
||||
+++ b/src/cpu/cpu_arm.c
|
||||
@@ -21,6 +21,7 @@
|
||||
|
||||
#include <config.h>
|
||||
|
||||
+#include "virlog.h"
|
||||
#include "viralloc.h"
|
||||
#include "cpu.h"
|
||||
#include "cpu_map.h"
|
||||
@@ -30,6 +31,8 @@
|
||||
|
||||
#define VIR_FROM_THIS VIR_FROM_CPU
|
||||
|
||||
+VIR_LOG_INIT("cpu.cpu_arm");
|
||||
+
|
||||
static const char *sysinfoCpuinfo = "/proc/cpuinfo";
|
||||
|
||||
#define CPUINFO sysinfoCpuinfo
|
||||
@@ -806,14 +809,201 @@ virCPUarmBaseline(virCPUDefPtr *cpus,
|
||||
return g_steal_pointer(&cpu);
|
||||
}
|
||||
|
||||
+static bool
|
||||
+virCPUarmFeaturesIsSub(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 virCPUDataPtr
|
||||
+armMakeCPUData(virArch arch,
|
||||
+ virCPUarmData *data)
|
||||
+{
|
||||
+ virCPUDataPtr cpuData;
|
||||
+
|
||||
+ if (!(cpuData = virCPUDataNew(arch)))
|
||||
+ return NULL;
|
||||
+
|
||||
+ virCPUarmDataCopy(&cpuData->data.arm, data);
|
||||
+
|
||||
+ return cpuData;
|
||||
+}
|
||||
+
|
||||
static virCPUCompareResult
|
||||
-virCPUarmCompare(virCPUDefPtr host G_GNUC_UNUSED,
|
||||
- virCPUDefPtr cpu G_GNUC_UNUSED,
|
||||
- bool failMessages G_GNUC_UNUSED)
|
||||
+armCompute(virCPUDefPtr host,
|
||||
+ virCPUDefPtr cpu,
|
||||
+ virCPUDataPtr *guestData,
|
||||
+ char **message)
|
||||
{
|
||||
+ virCPUarmMapPtr map = NULL;
|
||||
+ g_autoptr(virCPUarmModel) hostModel = NULL;
|
||||
+ g_autoptr(virCPUarmModel) guestModel = NULL;
|
||||
+ virArch arch;
|
||||
+ size_t i;
|
||||
+
|
||||
+ if (cpu->arch != VIR_ARCH_NONE) {
|
||||
+ bool found = false;
|
||||
+
|
||||
+ for (i = 0; i < G_N_ELEMENTS(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)
|
||||
+ *message = g_strdup_printf(_("CPU arch %s does not match host arch"),
|
||||
+ virArchToString(cpu->arch));
|
||||
+
|
||||
+ return VIR_CPU_COMPARE_INCOMPATIBLE;
|
||||
+ }
|
||||
+ 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)
|
||||
+ *message = g_strdup_printf(_("host CPU vendor does not match required "
|
||||
+ "CPU vendor %s"),
|
||||
+ cpu->vendor);
|
||||
+
|
||||
+ return VIR_CPU_COMPARE_INCOMPATIBLE;
|
||||
+ }
|
||||
+
|
||||
+ if (!(map = virCPUarmGetMap()))
|
||||
+ return VIR_CPU_COMPARE_ERROR;
|
||||
+
|
||||
+ /* Host CPU information */
|
||||
+ if (!(hostModel = virCPUarmModelFromCPU(host, map)))
|
||||
+ return VIR_CPU_COMPARE_ERROR;
|
||||
+
|
||||
+ 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 = virCPUarmModelCopy(hostModel);
|
||||
+ break;
|
||||
+
|
||||
+ case VIR_CPU_MODE_CUSTOM:
|
||||
+ /* custom:
|
||||
+ * look up guest CPU information */
|
||||
+ guestModel = virCPUarmModelFromCPU(cpu, map);
|
||||
+ break;
|
||||
+ }
|
||||
+ } else {
|
||||
+ /* Other host CPU information */
|
||||
+ guestModel = virCPUarmModelFromCPU(cpu, map);
|
||||
+ }
|
||||
+
|
||||
+ if (!guestModel)
|
||||
+ return VIR_CPU_COMPARE_ERROR;
|
||||
+
|
||||
+ 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)
|
||||
+ *message = g_strdup_printf(_("host CPU model %s does not match required "
|
||||
+ "CPU model %s"),
|
||||
+ hostModel->name, guestModel->name);
|
||||
+
|
||||
+ return VIR_CPU_COMPARE_INCOMPATIBLE;
|
||||
+ }
|
||||
+
|
||||
+ if (!virCPUarmFeaturesIsSub(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)
|
||||
+ *message = g_strdup_printf(_("guest CPU features '%s' is not subset of "
|
||||
+ "host CPU features '%s'"),
|
||||
+ guestModel->data.features,
|
||||
+ hostModel->data.features);
|
||||
+
|
||||
+ return VIR_CPU_COMPARE_INCOMPATIBLE;
|
||||
+ }
|
||||
+
|
||||
+ if (guestData &&
|
||||
+ !(*guestData = armMakeCPUData(arch, &guestModel->data)))
|
||||
+ return VIR_CPU_COMPARE_ERROR;
|
||||
+
|
||||
return VIR_CPU_COMPARE_IDENTICAL;
|
||||
}
|
||||
|
||||
+static virCPUCompareResult
|
||||
+virCPUarmCompare(virCPUDefPtr host,
|
||||
+ virCPUDefPtr cpu,
|
||||
+ bool failMessages)
|
||||
+{
|
||||
+ virCPUCompareResult ret = VIR_CPU_COMPARE_ERROR;
|
||||
+ g_autofree char *message = NULL;
|
||||
+
|
||||
+ if (!host || !host->model) {
|
||||
+ if (failMessages) {
|
||||
+ virReportError(VIR_ERR_CPU_INCOMPATIBLE, "%s",
|
||||
+ _("unknown host CPU"));
|
||||
+ } else {
|
||||
+ VIR_WARN("unknown host CPU");
|
||||
+ return VIR_CPU_COMPARE_INCOMPATIBLE;
|
||||
+ }
|
||||
+ return VIR_CPU_COMPARE_ERROR;
|
||||
+ }
|
||||
+
|
||||
+ ret = armCompute(host, cpu, NULL, &message);
|
||||
+
|
||||
+ if (failMessages && ret == VIR_CPU_COMPARE_INCOMPATIBLE) {
|
||||
+ if (message) {
|
||||
+ virReportError(VIR_ERR_CPU_INCOMPATIBLE, "%s", message);
|
||||
+ } else {
|
||||
+ virReportError(VIR_ERR_CPU_INCOMPATIBLE, NULL);
|
||||
+ }
|
||||
+ return VIR_CPU_COMPARE_ERROR;
|
||||
+ }
|
||||
+
|
||||
+ return ret;
|
||||
+}
|
||||
+
|
||||
static int
|
||||
virCPUarmValidateFeatures(virCPUDefPtr cpu)
|
||||
{
|
||||
--
|
||||
2.23.0
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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(©->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
|
||||
|
||||
@ -1,12 +1,12 @@
|
||||
From e814e4a7e227cd681b9dd95aedc93f3a087c42a1 Mon Sep 17 00:00:00 2001
|
||||
From 43ebd81b60121ce002a58ebc046b19f31bb23cb6 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
|
||||
Date: Thu, 16 Apr 2020 11:00:49 +0800
|
||||
Subject: cpu: introduce virCPUarmData to virCPUData
|
||||
|
||||
support vendor and model for virConnectGetCapabilities in ARM,
|
||||
introduce virCPUarmData to virCPUData.
|
||||
introduce virCPUarmData to virCPUData union, CPUarmData include
|
||||
vendor id, pvr and cpu features.
|
||||
|
||||
Signed-off-by: Xu Yandong <xuyandong2.huawei.com>
|
||||
Signed-off-by: Xu Yandong <xuyandong2@huawei.com>
|
||||
---
|
||||
src/cpu/cpu.h | 2 ++
|
||||
src/cpu/cpu_arm_data.h | 32 ++++++++++++++++++++++++++++++++
|
||||
@ -14,7 +14,7 @@ Signed-off-by: Xu Yandong <xuyandong2.huawei.com>
|
||||
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
|
||||
index f779d2b..ec22a18 100644
|
||||
--- a/src/cpu/cpu.h
|
||||
+++ b/src/cpu/cpu.h
|
||||
@@ -27,6 +27,7 @@
|
||||
@ -72,5 +72,5 @@ index 0000000..72b3a29
|
||||
+ char *features;
|
||||
+};
|
||||
--
|
||||
2.19.1
|
||||
2.23.0
|
||||
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
@ -1,10 +1,10 @@
|
||||
From 4274e2d7d00058b5a6aca7c4b256c0c6fb01d69d Mon Sep 17 00:00:00 2001
|
||||
From b305f4c05d22277ba6092bc0c2a15b752959bdec 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
|
||||
Date: Thu, 16 Apr 2020 10:57:11 +0800
|
||||
Subject: cpu_map: Introduce arm CPU models
|
||||
|
||||
support vendor and model for virConnectGetCapabilities in ARM,
|
||||
add arm cpu info to cpu map
|
||||
Support vendor and model for virConnectGetCapabilities in ARM,
|
||||
add arm cpu info to cpu map.
|
||||
|
||||
Signed-off-by: Xu Yandong <xuyandong2@huawei.com>
|
||||
---
|
||||
@ -23,11 +23,11 @@ Signed-off-by: Xu Yandong <xuyandong2@huawei.com>
|
||||
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
|
||||
index be64c9a..8663877 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 \
|
||||
@@ -67,6 +67,11 @@ cpumap_DATA = \
|
||||
cpu_map/x86_Skylake-Server-noTSX-IBRS.xml \
|
||||
cpu_map/x86_Westmere.xml \
|
||||
cpu_map/x86_Westmere-IBRS.xml \
|
||||
+ cpu_map/arm_vendors.xml \
|
||||
@ -40,7 +40,7 @@ index ce8a311..3b63203 100644
|
||||
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
|
||||
index 0000000..b681546
|
||||
--- /dev/null
|
||||
+++ b/src/cpu_map/arm_Kunpeng-920.xml
|
||||
@@ -0,0 +1,24 @@
|
||||
@ -125,12 +125,12 @@ index 0000000..840bf9a
|
||||
+ <vendor name="Intel" value="0x69"/>
|
||||
+</cpus>
|
||||
diff --git a/src/cpu_map/index.xml b/src/cpu_map/index.xml
|
||||
index 3c6885f..d222fd3 100644
|
||||
index 50b030d..2e78834 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"/>
|
||||
@@ -87,4 +87,16 @@
|
||||
<arch name='arm'>
|
||||
<include filename='arm_features.xml'/>
|
||||
</arch>
|
||||
+
|
||||
+ <arch name='arm'>
|
||||
@ -146,5 +146,5 @@ index 3c6885f..d222fd3 100644
|
||||
+ </arch>
|
||||
</cpus>
|
||||
--
|
||||
2.19.1
|
||||
2.23.0
|
||||
|
||||
|
||||
@ -0,0 +1,41 @@
|
||||
From f67e57fa41c76e21effd9e61773319ef424a5265 Mon Sep 17 00:00:00 2001
|
||||
From: Xu Yandong <xuyandong2@huawei.com>
|
||||
Date: Tue, 26 May 2020 20:08:07 +0800
|
||||
Subject: [PATCH] cpu_map: add kunpeng-920 features to arm features
|
||||
|
||||
Signed-off-by: Xu Yandong <xuyandong2@huawei.com>
|
||||
---
|
||||
src/cpu_map/arm_features.xml | 19 +++++++++++++++++++
|
||||
1 file changed, 19 insertions(+)
|
||||
|
||||
diff --git a/src/cpu_map/arm_features.xml b/src/cpu_map/arm_features.xml
|
||||
index 8a53384..5bed298 100644
|
||||
--- a/src/cpu_map/arm_features.xml
|
||||
+++ b/src/cpu_map/arm_features.xml
|
||||
@@ -19,4 +19,23 @@
|
||||
<feature name='sve1920'/>
|
||||
<feature name='sve2048'/>
|
||||
|
||||
+ <!-- Kunpeng-920 cpu features -->
|
||||
+ <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'/>
|
||||
</cpus>
|
||||
--
|
||||
2.23.0
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
From c53f20683ef66939d94e690e875500628a5b4f3f Mon Sep 17 00:00:00 2001
|
||||
From cdf8379fbddb8c51f35af2934908e80524a3fd6a 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
|
||||
Date: Wed, 15 Apr 2020 14:03:07 +0800
|
||||
Subject: nodedev: fix potential heap use after free
|
||||
|
||||
After move device enumumeration into a thread(commit 9f0ae0b18e3),
|
||||
flag driversInitialized no longer represent stateInitialized finished
|
||||
@ -10,51 +10,39 @@ 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(-)
|
||||
src/node_device/node_device_udev.c | 4 +++-
|
||||
1 file changed, 3 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/node_device/node_device_udev.c b/src/node_device/node_device_udev.c
|
||||
index 276bf3d..cac9447 100644
|
||||
index 8451903..a1391fb 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;
|
||||
@@ -1261,8 +1261,8 @@ udevSetParent(struct udev_device *device,
|
||||
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;
|
||||
parent_device = device;
|
||||
+ virObjectRef(driver->devs);
|
||||
do {
|
||||
-
|
||||
parent_device = udev_device_get_parent(parent_device);
|
||||
if (parent_device == NULL)
|
||||
break;
|
||||
@@ -1272,6 +1272,7 @@ udevSetParent(struct udev_device *device,
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("Could not get syspath for parent of '%s'"),
|
||||
udev_device_get_syspath(parent_device));
|
||||
+ virObjectUnref(driver->devs);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -1348,14 +1351,14 @@ udevAddOneDevice(struct udev_device *device)
|
||||
if (udevSetParent(device, def) != 0)
|
||||
goto cleanup;
|
||||
@@ -1289,6 +1290,7 @@ udevSetParent(struct udev_device *device,
|
||||
if (!def->parent)
|
||||
def->parent = g_strdup("computer");
|
||||
|
||||
- if ((obj = virNodeDeviceObjListFindByName(driver->devs, def->name))) {
|
||||
+ if ((obj = virNodeDeviceObjListFindByName(devs, def->name))) {
|
||||
virNodeDeviceObjEndAPI(&obj);
|
||||
new_device = false;
|
||||
}
|
||||
+ virObjectUnref(driver->devs);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* 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
|
||||
2.23.0
|
||||
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
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
|
||||
From 26c64d58383d391add464b7f640fd6111f0d82d3 Mon Sep 17 00:00:00 2001
|
||||
From: Xu Yandong <xuyandong2@huawei.com>
|
||||
Date: Wed, 15 Apr 2020 14:17:32 +0800
|
||||
Subject: po: Refresh translation for running state
|
||||
|
||||
Signed-off-by: Xu Yandong <xuyandong2@huawei.com>
|
||||
---
|
||||
@ -9,10 +9,10 @@ Signed-off-by: Xu Yandong <xuyandong2@huawei.com>
|
||||
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
|
||||
index 94920d1..3d588ab 100644
|
||||
--- a/po/zh_CN.mini.po
|
||||
+++ b/po/zh_CN.mini.po
|
||||
@@ -19558,7 +19558,7 @@ msgid "rule node requires direction attribute"
|
||||
@@ -19075,7 +19075,7 @@ msgid "rule node requires direction attribute"
|
||||
msgstr "rule 节点需要 direction 属性"
|
||||
|
||||
msgid "running"
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
From 7487eaefca026da3b0ccc8e8872a8e7ba0101640 Mon Sep 17 00:00:00 2001
|
||||
From 2d72ad8dfbd8987379a58fd9b280cdaf4d191542 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
|
||||
Date: Wed, 15 Apr 2020 11:14:35 +0800
|
||||
Subject: qemu: add pointer check in qemuMonitorLastError
|
||||
|
||||
We found a exception when libvirt occurrs segmentation fault.
|
||||
thread 1 is waiting object lock in qemuConnectMonitor,
|
||||
@ -9,15 +9,16 @@ 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>
|
||||
Signed-off-by: Xu Yandong <xuyandong2@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
|
||||
index a62fed8..cc62948 100644
|
||||
--- a/src/qemu/qemu_monitor.c
|
||||
+++ b/src/qemu/qemu_monitor.c
|
||||
@@ -1103,7 +1103,7 @@ qemuMonitorSend(qemuMonitorPtr mon,
|
||||
@@ -966,7 +966,7 @@ qemuMonitorSend(qemuMonitorPtr mon,
|
||||
virErrorPtr
|
||||
qemuMonitorLastError(qemuMonitorPtr mon)
|
||||
{
|
||||
@ -27,5 +28,5 @@ index 731be2e..a5eeec6 100644
|
||||
|
||||
return virErrorCopyNew(&mon->lastError);
|
||||
--
|
||||
2.19.1
|
||||
2.23.0
|
||||
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
@ -1,33 +1,34 @@
|
||||
From 19078ccc1e2160dcb4b223097c6bbc032567514b Mon Sep 17 00:00:00 2001
|
||||
From d6cf1204db14d2ba76b640268f253d2ea6f0c131 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
|
||||
Date: Wed, 15 Apr 2020 11:28:41 +0800
|
||||
Subject: 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>
|
||||
Signed-off-by: Xu Yandong <xuyandong2@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
|
||||
index 8a1801d..65b47ec 100644
|
||||
--- a/src/qemu/qemu_migration.c
|
||||
+++ b/src/qemu/qemu_migration.c
|
||||
@@ -1032,6 +1032,11 @@ qemuMigrationSrcNBDStorageCopy(virQEMUDriverPtr driver,
|
||||
@@ -1048,6 +1048,11 @@ qemuMigrationSrcNBDStorageCopy(virQEMUDriverPtr driver,
|
||||
if (rv < 0)
|
||||
goto cleanup;
|
||||
return -1;
|
||||
|
||||
+ if (!virDomainObjIsActive(vm)) {
|
||||
+ VIR_ERROR(_("domain is no longer running, migrate will end"));
|
||||
+ goto cleanup;
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
if (priv->job.abortJob) {
|
||||
priv->job.current->status = QEMU_DOMAIN_JOB_STATUS_CANCELED;
|
||||
virReportError(VIR_ERR_OPERATION_ABORTED, _("%s: %s"),
|
||||
--
|
||||
2.19.1
|
||||
2.23.0
|
||||
|
||||
|
||||
@ -1,21 +1,22 @@
|
||||
From 34b8be0d7bd7980ee8be6ca70685788ed81b087b Mon Sep 17 00:00:00 2001
|
||||
From 4f4ebf64009e402db79bf53db1226966bf5c0a99 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
|
||||
Date: Wed, 15 Apr 2020 11:11:16 +0800
|
||||
Subject: 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>
|
||||
Signed-off-by: Xu Yandong <xuyandong2@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
|
||||
index ff97f10..8bc5368 100644
|
||||
--- a/src/qemu/qemu_driver.c
|
||||
+++ b/src/qemu/qemu_driver.c
|
||||
@@ -5093,6 +5093,8 @@ qemuDomainPinVcpuLive(virDomainObjPtr vm,
|
||||
@@ -5175,6 +5175,8 @@ qemuDomainPinVcpuLive(virDomainObjPtr vm,
|
||||
goto cleanup;
|
||||
|
||||
event = virDomainEventTunableNewFromObj(vm, eventParams, eventNparams);
|
||||
@ -24,16 +25,16 @@ index ef2e980..5791c42 100644
|
||||
|
||||
ret = 0;
|
||||
|
||||
@@ -5101,6 +5103,8 @@ qemuDomainPinVcpuLive(virDomainObjPtr vm,
|
||||
@@ -5182,6 +5184,8 @@ qemuDomainPinVcpuLive(virDomainObjPtr vm,
|
||||
virBitmapFree(tmpmap);
|
||||
virCgroupFree(&cgroup_vcpu);
|
||||
VIR_FREE(str);
|
||||
virObjectEventStateQueue(driver->domainEventState, event);
|
||||
+ if (eventParams)
|
||||
+ virTypedParamsFree(eventParams, eventNparams);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -5308,6 +5312,8 @@ qemuDomainPinEmulator(virDomainPtr dom,
|
||||
@@ -5388,6 +5392,8 @@ qemuDomainPinEmulator(virDomainPtr dom,
|
||||
goto endjob;
|
||||
|
||||
event = virDomainEventTunableNewFromDom(dom, eventParams, eventNparams);
|
||||
@ -42,16 +43,16 @@ index ef2e980..5791c42 100644
|
||||
}
|
||||
|
||||
if (persistentDef) {
|
||||
@@ -5329,6 +5335,8 @@ qemuDomainPinEmulator(virDomainPtr dom,
|
||||
@@ -5409,6 +5415,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,
|
||||
virDomainObjEndAPI(&vm);
|
||||
@@ -5871,6 +5879,8 @@ qemuDomainPinIOThread(virDomainPtr dom,
|
||||
goto endjob;
|
||||
|
||||
event = virDomainEventTunableNewFromDom(dom, eventParams, eventNparams);
|
||||
@ -60,15 +61,15 @@ index ef2e980..5791c42 100644
|
||||
}
|
||||
|
||||
if (persistentDef) {
|
||||
@@ -5824,6 +5834,8 @@ qemuDomainPinIOThread(virDomainPtr dom,
|
||||
@@ -5902,6 +5912,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);
|
||||
virDomainObjEndAPI(&vm);
|
||||
--
|
||||
2.19.1
|
||||
2.23.0
|
||||
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
From 940df0f99ab0fcc350fca0df29c74b2f6674cb8a Mon Sep 17 00:00:00 2001
|
||||
From 89b60f0cefe533a5fda021fae303e7662c141d02 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
|
||||
Subject: [PATCH 11/11] tests: add baseline test cases for arm CPU
|
||||
|
||||
add baseline test cases for aarch64
|
||||
|
||||
@ -35,10 +35,10 @@ Signed-off-by: Xu Yandong <xuyandong2@huawei.com>
|
||||
create mode 100644 tests/cputestdata/aarch64-baseline-one-feature.xml
|
||||
|
||||
diff --git a/tests/cputest.c b/tests/cputest.c
|
||||
index 6e28e05..ee754bb 100644
|
||||
index e4b4531..3657fa4 100644
|
||||
--- a/tests/cputest.c
|
||||
+++ b/tests/cputest.c
|
||||
@@ -1207,6 +1207,13 @@ mymain(void)
|
||||
@@ -1194,6 +1194,13 @@ mymain(void)
|
||||
DO_TEST_BASELINE(VIR_ARCH_PPC64, "same-model", 0, 0);
|
||||
DO_TEST_BASELINE(VIR_ARCH_PPC64, "legacy", 0, -1);
|
||||
|
||||
@ -259,5 +259,5 @@ index 0000000..e0ae15f
|
||||
+</cpu>
|
||||
+</cpuTest>
|
||||
--
|
||||
2.19.1
|
||||
2.23.0
|
||||
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
From 0535b2880dd5804170490f8156a95964bd2f1ad3 Mon Sep 17 00:00:00 2001
|
||||
From 8c57ff0e9b940eb1e29a4aa3e8a9d04b03424989 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
|
||||
Subject: tests: add cpu compare test cases for arm CPU
|
||||
|
||||
add cpu compare test cases for arm CPU
|
||||
|
||||
@ -31,10 +31,10 @@ Signed-off-by: Xu Yandong <xuyandong2@huawei.com>
|
||||
create mode 100644 tests/cputestdata/aarch64-host.xml
|
||||
|
||||
diff --git a/tests/cputest.c b/tests/cputest.c
|
||||
index ee754bb..c0903bf 100644
|
||||
index 1f59f0d..e4b4531 100644
|
||||
--- a/tests/cputest.c
|
||||
+++ b/tests/cputest.c
|
||||
@@ -1163,6 +1163,16 @@ mymain(void)
|
||||
@@ -1140,6 +1140,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);
|
||||
|
||||
@ -167,5 +167,5 @@ index 0000000..60c20f2
|
||||
+ <feature name='crc32'/>
|
||||
+</cpu>
|
||||
--
|
||||
2.19.1
|
||||
2.23.0
|
||||
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
53
libvirt-util-virdaemon-fix-waiting-for-child-processes.patch
Normal file
53
libvirt-util-virdaemon-fix-waiting-for-child-processes.patch
Normal file
@ -0,0 +1,53 @@
|
||||
From 66ee42dc1a3a1445fed97c000f949ae0455bf948 Mon Sep 17 00:00:00 2001
|
||||
From: Rafael Fonseca <r4f4rfs@gmail.com>
|
||||
Date: Tue, 21 Apr 2020 15:55:46 +0800
|
||||
Subject: util: virdaemon: fix waiting for child processes
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Unlike `waitpid`, `virProcessWait` only returns -1 (error) or 0
|
||||
(success), so comparing that to `pid` will always be false and the
|
||||
parent will report failure with:
|
||||
|
||||
error : main:851 : Failed to fork as daemon: No such file or directory
|
||||
|
||||
even though the grandchild process is succesfully running. Note that the
|
||||
errno message is misleading: it was last set when trying to find a
|
||||
restart state file.
|
||||
|
||||
Signed-off-by: Rafael Fonseca <r4f4rfs@gmail.com>
|
||||
Reported-by: Marcin Krol <hawk@tld-linux.org>
|
||||
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
||||
Signed-off-by: Ján Tomko <jtomko@redhat.com>
|
||||
(cherry-picked from commit a87e4788d2ee3d74cef5679d2961689d4e4a96a3)
|
||||
Signed-off-by: Xu Yandong <xuyandong2@huawei.com>
|
||||
---
|
||||
src/util/virdaemon.c | 5 ++---
|
||||
1 file changed, 2 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/src/util/virdaemon.c b/src/util/virdaemon.c
|
||||
index 5d92c7d..99530fd 100644
|
||||
--- a/src/util/virdaemon.c
|
||||
+++ b/src/util/virdaemon.c
|
||||
@@ -97,15 +97,14 @@ virDaemonForkIntoBackground(const char *argv0)
|
||||
default:
|
||||
{
|
||||
/* parent */
|
||||
- int got, exitstatus = 0;
|
||||
+ int exitstatus = 0;
|
||||
int ret;
|
||||
char status;
|
||||
|
||||
VIR_FORCE_CLOSE(statuspipe[1]);
|
||||
|
||||
/* We wait to make sure the first child forked successfully */
|
||||
- if ((got = virProcessWait(pid, &exitstatus, 0)) < 0 ||
|
||||
- got != pid ||
|
||||
+ if (virProcessWait(pid, &exitstatus, 0) < 0 ||
|
||||
exitstatus != 0) {
|
||||
goto error;
|
||||
}
|
||||
--
|
||||
2.23.0
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
88
libvirt-virsh-Fix-return-code-for-dump-and-migrate.patch
Normal file
88
libvirt-virsh-Fix-return-code-for-dump-and-migrate.patch
Normal file
@ -0,0 +1,88 @@
|
||||
From 0009ad3497c09ecf45412511edf765f695a506dd Mon Sep 17 00:00:00 2001
|
||||
From: Andrea Bolognani <abologna@redhat.com>
|
||||
Date: Tue, 21 Apr 2020 19:06:16 +0200
|
||||
Subject: virsh: Fix return code for dump and migrate
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
When the job monitoring logic was refactored, these two commands
|
||||
were not converted properly and the result is that a successful
|
||||
dump or migration (char '0') would be reported as a failed one
|
||||
(int 48) instead.
|
||||
|
||||
Fixes: dc0771cfa2e78ffecd7c8234538ee548748d7bef
|
||||
Reported-by: Brian Rak <brak@gameservers.com>
|
||||
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
|
||||
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
|
||||
(cherry-picked from commit 3169e06a2080bf3335d947de4d4f6235bf2f440d)
|
||||
Signed-off-by: Xu Yandong <xuyandong2@huawei.com>
|
||||
---
|
||||
tools/virsh-domain.c | 10 +++-------
|
||||
1 file changed, 3 insertions(+), 7 deletions(-)
|
||||
|
||||
diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
|
||||
index 2dc7c38..afe360c 100644
|
||||
--- a/tools/virsh-domain.c
|
||||
+++ b/tools/virsh-domain.c
|
||||
@@ -5436,7 +5436,6 @@ static const vshCmdOptDef opts_dump[] = {
|
||||
static void
|
||||
doDump(void *opaque)
|
||||
{
|
||||
- char ret = '1';
|
||||
virshCtrlData *data = opaque;
|
||||
vshControl *ctl = data->ctl;
|
||||
const vshCmd *cmd = data->cmd;
|
||||
@@ -5508,7 +5507,7 @@ doDump(void *opaque)
|
||||
}
|
||||
}
|
||||
|
||||
- ret = '0';
|
||||
+ data->ret = 0;
|
||||
out:
|
||||
#ifndef WIN32
|
||||
pthread_sigmask(SIG_SETMASK, &oldsigmask, NULL);
|
||||
@@ -5516,7 +5515,6 @@ doDump(void *opaque)
|
||||
#endif /* !WIN32 */
|
||||
if (dom)
|
||||
virshDomainFree(dom);
|
||||
- data->ret = ret;
|
||||
g_main_loop_quit(data->eventLoop);
|
||||
}
|
||||
|
||||
@@ -10722,7 +10720,6 @@ static const vshCmdOptDef opts_migrate[] = {
|
||||
static void
|
||||
doMigrate(void *opaque)
|
||||
{
|
||||
- char ret = '1';
|
||||
virDomainPtr dom = NULL;
|
||||
const char *desturi = NULL;
|
||||
const char *opt = NULL;
|
||||
@@ -11001,14 +10998,14 @@ doMigrate(void *opaque)
|
||||
|
||||
if (flags & VIR_MIGRATE_PEER2PEER || vshCommandOptBool(cmd, "direct")) {
|
||||
if (virDomainMigrateToURI3(dom, desturi, params, nparams, flags) == 0)
|
||||
- ret = '0';
|
||||
+ data->ret = 0;
|
||||
} else {
|
||||
/* For traditional live migration, connect to the destination host directly. */
|
||||
virDomainPtr ddom = NULL;
|
||||
|
||||
if ((ddom = virDomainMigrate3(dom, dconn, params, nparams, flags))) {
|
||||
virshDomainFree(ddom);
|
||||
- ret = '0';
|
||||
+ data->ret = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11019,7 +11016,6 @@ doMigrate(void *opaque)
|
||||
#endif /* !WIN32 */
|
||||
virTypedParamsFree(params, nparams);
|
||||
virshDomainFree(dom);
|
||||
- data->ret = ret;
|
||||
g_main_loop_quit(data->eventLoop);
|
||||
return;
|
||||
|
||||
--
|
||||
2.23.0
|
||||
|
||||
44
libvirt-virsh-Fix-return-code-for-dump.patch
Normal file
44
libvirt-virsh-Fix-return-code-for-dump.patch
Normal file
@ -0,0 +1,44 @@
|
||||
From 3e4b15eb78b5815ad4101644efc37bd2bab6608e Mon Sep 17 00:00:00 2001
|
||||
From: Xu Yandong <xuyandong2@huawei.com>
|
||||
Date: Mon, 4 May 2020 16:36:19 +0800
|
||||
Subject: [PATCH] virsh: Fix return code for dump
|
||||
|
||||
After the commit dc0771c, ret variable no longer
|
||||
represents the status of the return code, use
|
||||
data->ret replace it.
|
||||
|
||||
Signed-off-by: Xu Yandong <xuyandong2@huawei.com>
|
||||
---
|
||||
tools/virsh-domain.c | 5 ++---
|
||||
1 file changed, 2 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
|
||||
index afe360c..0a62308 100644
|
||||
--- a/tools/virsh-domain.c
|
||||
+++ b/tools/virsh-domain.c
|
||||
@@ -5522,7 +5522,6 @@ static bool
|
||||
cmdDump(vshControl *ctl, const vshCmd *cmd)
|
||||
{
|
||||
virDomainPtr dom;
|
||||
- bool ret = false;
|
||||
bool verbose = false;
|
||||
const char *name = NULL;
|
||||
const char *to = NULL;
|
||||
@@ -5556,12 +5555,12 @@ cmdDump(vshControl *ctl, const vshCmd *cmd)
|
||||
|
||||
virThreadJoin(&workerThread);
|
||||
|
||||
- if (!ret)
|
||||
+ if (!data.ret)
|
||||
vshPrintExtra(ctl, _("\nDomain %s dumped to %s\n"), name, to);
|
||||
|
||||
cleanup:
|
||||
virshDomainFree(dom);
|
||||
- return !ret;
|
||||
+ return !data.ret;
|
||||
}
|
||||
|
||||
static const vshCmdInfo info_screenshot[] = {
|
||||
--
|
||||
2.23.0
|
||||
|
||||
@ -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(¶ms, &nparams, &maxparams,
|
||||
- VIR_MIGRATE_PARAM_PARALLEL_CONNECTIONS,
|
||||
- intOpt) < 0)
|
||||
- goto save_error;
|
||||
+ } else if (rv > 0) {
|
||||
+ if (virTypedParamsAddInt(¶ms, &nparams, &maxparams,
|
||||
+ VIR_MIGRATE_PARAM_PARALLEL_CONNECTIONS,
|
||||
+ intOpt) < 0)
|
||||
+ goto save_error;
|
||||
+ }
|
||||
|
||||
if (vshCommandOptBool(cmd, "live"))
|
||||
flags |= VIR_MIGRATE_LIVE;
|
||||
--
|
||||
2.19.1
|
||||
|
||||
452
libvirt.spec
452
libvirt.spec
@ -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_fuse 0%{!?_without_fuse:0}
|
||||
%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,15 +95,10 @@
|
||||
|
||||
%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
|
||||
Version: 6.2.0
|
||||
Release: 6
|
||||
License: LGPLv2+
|
||||
URL: https://libvirt.org/
|
||||
@ -122,55 +107,27 @@ 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
|
||||
|
||||
|
||||
Patch0000: libvirt-qemu-fix-potential-memory-leak.patch
|
||||
Patch0001: libvirt-qemu-add-pointer-check-in-qemuMonitorLastError.patch
|
||||
Patch0002: libvirt-qemu-fix-a-concurrent-operation-situation.patch
|
||||
Patch0003: libvirt-cgroup-cleanup-eventParams-when-virTypedParamsAddULL.patch
|
||||
Patch0004: libvirt-nodedev-fix-potential-heap-use-after-free.patch
|
||||
Patch0005: libvirt-po-Refresh-translation-for-running-state.patch
|
||||
Patch0006: libvirt-cpu_map-Introduce-arm-CPU-models.patch
|
||||
Patch0007: libvirt-cpu-introduce-virCPUarmData-to-virCPUData.patch
|
||||
Patch0008: libvirt-cpu-arm-add-cpu-data-free-function-to-virCPUarmDataF.patch
|
||||
Patch0009: libvirt-cpu-arm-add-load-cpu-map-parse-function.patch
|
||||
Patch0010: libvirt-cpu-arm-add-decode-function.patch
|
||||
Patch0011: libvirt-cpu-arm-add-virCPUarmGetHost-implment.patch
|
||||
Patch0012: libvirt-cpu-arm-implment-cpu-baseline-function.patch
|
||||
Patch0013: libvirt-cpu-arm-implment-cpu-compare-function.patch
|
||||
Patch0014: libvirt-tests-add-cpu-compare-test-cases-for-arm-CPU.patch
|
||||
Patch0015: libvirt-tests-add-baseline-test-cases-for-arm-CPU.patch
|
||||
Patch0016: libvirt-util-virdaemon-fix-waiting-for-child-processes.patch
|
||||
Patch0017: libvirt-virsh-Fix-return-code-for-dump-and-migrate.patch
|
||||
Patch0018: libvirt-virsh-Fix-return-code-for-dump.patch
|
||||
Patch0019: libvirt-cpu-aarch64-enable-host-model-cpu-for-AArch64-archit.patch
|
||||
Patch0020: libvirt-cpu_map-add-kunpeng-920-features-as-known-features.patch
|
||||
|
||||
Requires: libvirt-daemon = %{version}-%{release}
|
||||
Requires: libvirt-daemon-config-network = %{version}-%{release}
|
||||
@ -207,18 +164,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
|
||||
@ -240,9 +196,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
|
||||
@ -271,9 +226,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
|
||||
@ -296,7 +253,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
|
||||
|
||||
@ -330,7 +287,7 @@ BuildRequires: numad
|
||||
%endif
|
||||
|
||||
%if %{with_wireshark}
|
||||
BuildRequires: wireshark-devel >= 2.1.0
|
||||
BuildRequires: wireshark-devel >= 2.4.0
|
||||
%endif
|
||||
|
||||
%if %{with_libssh}
|
||||
@ -340,7 +297,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
|
||||
@ -363,6 +322,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
|
||||
|
||||
@ -371,20 +333,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
|
||||
@ -488,6 +446,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
|
||||
@ -567,7 +528,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
|
||||
@ -650,9 +612,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
|
||||
@ -829,8 +788,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
|
||||
@ -861,7 +818,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
|
||||
@ -947,12 +904,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
|
||||
@ -1043,12 +994,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}
|
||||
@ -1084,22 +1029,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 \
|
||||
@ -1134,7 +1084,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} \
|
||||
@ -1146,19 +1096,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
|
||||
@ -1180,8 +1127,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
|
||||
@ -1238,21 +1185,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
|
||||
@ -1265,6 +1210,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
|
||||
@ -1273,6 +1220,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
|
||||
|
||||
@ -1297,10 +1246,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,
|
||||
@ -1337,6 +1327,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 || :
|
||||
@ -1351,6 +1343,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 || :
|
||||
@ -1362,16 +1356,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
|
||||
@ -1394,32 +1378,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
|
||||
@ -1429,29 +1392,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
|
||||
@ -1463,6 +1422,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
|
||||
@ -1471,7 +1431,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/
|
||||
@ -1490,6 +1450,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
|
||||
@ -1504,6 +1466,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
|
||||
|
||||
@ -1512,11 +1475,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/
|
||||
@ -1524,13 +1487,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
|
||||
@ -1541,19 +1520,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
|
||||
@ -1602,12 +1613,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
|
||||
@ -1615,14 +1634,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
|
||||
@ -1632,19 +1661,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
|
||||
|
||||
@ -1679,7 +1724,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
|
||||
@ -1710,7 +1755,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
|
||||
@ -1726,7 +1771,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
|
||||
@ -1771,6 +1818,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
|
||||
@ -1786,6 +1834,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
|
||||
@ -1808,33 +1857,22 @@ 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
|
||||
* 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.
|
||||
* Tue May 26 2020 Xu Yandong <xuyandong2@huawei.com> - 6.2.0-6
|
||||
- Introduce Kunpeng-920 cpu features.
|
||||
* Wed May 20 2020 Xu Yandong <xuyandong2@huawei.com> - 6.2.0-5
|
||||
- Enable 'host-model' cpu mode.
|
||||
* Mon May 11 2020 Xu Yandong <xuyandong2@huawei.com> - 6.2.0-4
|
||||
- Fix virdaemon waiting for child processes return code error.
|
||||
- Fix virsh dump and migrate return code error.
|
||||
* Mon May 11 2020 Xu Yandong <xuyandong2@huawei.com> - 6.2.0-3
|
||||
- Checkout cpu capabilities support for ARM architecture.
|
||||
- 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.
|
||||
* Mon Apr 20 2020 Xu Yandong <xuyandong2@huawei.com> - 6.2.0-2
|
||||
- Checkout bugfixs from 5.5.0 release.
|
||||
* 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.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user