[libvirt] [PATCH] storage: Default pool permission mode to 0711
by Osier Yang
Per the typical use of libvirt is to fork the qemu process with
qemu:qemu. Setting the pool permission mode as 0700 by default
will prevent the guest start with permission reason.
Define macro for the default pool and vol permission modes
incidentally.
---
src/conf/storage_conf.c | 11 ++++++++---
1 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/src/conf/storage_conf.c b/src/conf/storage_conf.c
index bf4567f..6d4987b 100644
--- a/src/conf/storage_conf.c
+++ b/src/conf/storage_conf.c
@@ -47,6 +47,8 @@
#define VIR_FROM_THIS VIR_FROM_STORAGE
+#define DEFAULT_POOL_PERM_MODE 0711
+#define DEFAULT_VOL_PERM_MODE 0600
VIR_ENUM_IMPL(virStoragePool,
VIR_STORAGE_POOL_LAST,
@@ -812,7 +814,8 @@ virStoragePoolDefParseXML(xmlXPathContextPtr ctxt) {
goto cleanup;
if (virStorageDefParsePerms(ctxt, &ret->target.perms,
- "./target/permissions", 0700) < 0)
+ "./target/permissions",
+ DEFAULT_POOL_PERM_MODE) < 0)
goto cleanup;
}
@@ -1137,7 +1140,8 @@ virStorageVolDefParseXML(virStoragePoolDefPtr pool,
}
if (virStorageDefParsePerms(ctxt, &ret->target.perms,
- "./target/permissions", 0600) < 0)
+ "./target/permissions",
+ DEFAULT_VOL_PERM_MODE) < 0)
goto cleanup;
node = virXPathNode("./target/encryption", ctxt);
@@ -1168,7 +1172,8 @@ virStorageVolDefParseXML(virStoragePoolDefPtr pool,
}
if (virStorageDefParsePerms(ctxt, &ret->backingStore.perms,
- "./backingStore/permissions", 0600) < 0)
+ "./backingStore/permissions",
+ DEFAULT_VOL_PERM_MODE) < 0)
goto cleanup;
return ret;
--
1.7.7.3
12 years, 5 months
[libvirt] [PATCHv3 0/4] Fix filling of nodeinfo structure and add test cases
by Peter Krempa
For explanation why this is needed see 2/4. Patch 1/4 are test data split
out from 1/3 of the previous version to ease reviewing of 2/4.
Peter Krempa (4):
nodeinfo_test: Enhance test data before changing nodeinfo gathering
nodeinfo: Fix gathering of nodeinfo data structure
test: Add new test case for nodeinfotest
test: Add test case for nodeinfotest if host machine doesn't have
NUMA
src/nodeinfo.c | 311 +++++++++-------
.../linux-nodeinfo-sysfs-test-2/node/node0/cpu0 | 1 +
.../linux-nodeinfo-sysfs-test-2/node/node0/cpu1 | 1 +
.../linux-nodeinfo-sysfs-test-3-cpu-x86-output.txt | 2 +-
.../linux-nodeinfo-sysfs-test-3/node/node0/cpu0 | 1 +
.../linux-nodeinfo-sysfs-test-3/node/node0/cpu12 | 1 +
.../linux-nodeinfo-sysfs-test-3/node/node0/cpu16 | 1 +
.../linux-nodeinfo-sysfs-test-3/node/node0/cpu20 | 1 +
.../linux-nodeinfo-sysfs-test-3/node/node0/cpu4 | 1 +
.../linux-nodeinfo-sysfs-test-3/node/node0/cpu8 | 1 +
.../linux-nodeinfo-sysfs-test-3/node/node1/cpu24 | 1 +
.../linux-nodeinfo-sysfs-test-3/node/node1/cpu28 | 1 +
.../linux-nodeinfo-sysfs-test-3/node/node1/cpu32 | 1 +
.../linux-nodeinfo-sysfs-test-3/node/node1/cpu36 | 1 +
.../linux-nodeinfo-sysfs-test-3/node/node1/cpu40 | 1 +
.../linux-nodeinfo-sysfs-test-3/node/node1/cpu44 | 1 +
.../linux-nodeinfo-sysfs-test-3/node/node2/cpu11 | 1 +
.../linux-nodeinfo-sysfs-test-3/node/node2/cpu15 | 1 +
.../linux-nodeinfo-sysfs-test-3/node/node2/cpu19 | 1 +
.../linux-nodeinfo-sysfs-test-3/node/node2/cpu23 | 1 +
.../linux-nodeinfo-sysfs-test-3/node/node2/cpu3 | 1 +
.../linux-nodeinfo-sysfs-test-3/node/node2/cpu7 | 1 +
.../linux-nodeinfo-sysfs-test-3/node/node3/cpu27 | 1 +
.../linux-nodeinfo-sysfs-test-3/node/node3/cpu31 | 1 +
.../linux-nodeinfo-sysfs-test-3/node/node3/cpu35 | 1 +
.../linux-nodeinfo-sysfs-test-3/node/node3/cpu39 | 1 +
.../linux-nodeinfo-sysfs-test-3/node/node3/cpu43 | 1 +
.../linux-nodeinfo-sysfs-test-3/node/node3/cpu47 | 1 +
.../linux-nodeinfo-sysfs-test-3/node/node4/cpu10 | 1 +
.../linux-nodeinfo-sysfs-test-3/node/node4/cpu14 | 1 +
.../linux-nodeinfo-sysfs-test-3/node/node4/cpu18 | 1 +
.../linux-nodeinfo-sysfs-test-3/node/node4/cpu2 | 1 +
.../linux-nodeinfo-sysfs-test-3/node/node4/cpu22 | 1 +
.../linux-nodeinfo-sysfs-test-3/node/node4/cpu6 | 1 +
.../linux-nodeinfo-sysfs-test-3/node/node5/cpu26 | 1 +
.../linux-nodeinfo-sysfs-test-3/node/node5/cpu30 | 1 +
.../linux-nodeinfo-sysfs-test-3/node/node5/cpu34 | 1 +
.../linux-nodeinfo-sysfs-test-3/node/node5/cpu38 | 1 +
.../linux-nodeinfo-sysfs-test-3/node/node5/cpu42 | 1 +
.../linux-nodeinfo-sysfs-test-3/node/node5/cpu46 | 1 +
.../linux-nodeinfo-sysfs-test-3/node/node6/cpu1 | 1 +
.../linux-nodeinfo-sysfs-test-3/node/node6/cpu13 | 1 +
.../linux-nodeinfo-sysfs-test-3/node/node6/cpu17 | 1 +
.../linux-nodeinfo-sysfs-test-3/node/node6/cpu21 | 1 +
.../linux-nodeinfo-sysfs-test-3/node/node6/cpu5 | 1 +
.../linux-nodeinfo-sysfs-test-3/node/node6/cpu9 | 1 +
.../linux-nodeinfo-sysfs-test-3/node/node7/cpu25 | 1 +
.../linux-nodeinfo-sysfs-test-3/node/node7/cpu29 | 1 +
.../linux-nodeinfo-sysfs-test-3/node/node7/cpu33 | 1 +
.../linux-nodeinfo-sysfs-test-3/node/node7/cpu37 | 1 +
.../linux-nodeinfo-sysfs-test-3/node/node7/cpu41 | 1 +
.../linux-nodeinfo-sysfs-test-3/node/node7/cpu45 | 1 +
.../linux-nodeinfo-sysfs-test-3/node/possible | Bin 4 -> 5 bytes
.../linux-nodeinfo-sysfs-test-4-cpu-x86-output.txt | 1 +
.../linux-nodeinfo-sysfs-test-4-x86.cpuinfo | 400 ++++++++++++++++++++
.../cpu/cpu0/topology/core_id | 1 +
.../cpu/cpu0/topology/physical_package_id | 1 +
.../cpu/cpu0/topology/thread_siblings | 1 +
.../linux-nodeinfo-sysfs-test-4/cpu/cpu1/online | 1 +
.../cpu/cpu1/topology/core_id | 1 +
.../cpu/cpu1/topology/physical_package_id | 1 +
.../cpu/cpu1/topology/thread_siblings | 1 +
.../linux-nodeinfo-sysfs-test-4/cpu/cpu10/online | 1 +
.../cpu/cpu10/topology/core_id | 1 +
.../cpu/cpu10/topology/physical_package_id | 1 +
.../cpu/cpu10/topology/thread_siblings | 1 +
.../linux-nodeinfo-sysfs-test-4/cpu/cpu11/online | 1 +
.../cpu/cpu11/topology/core_id | 1 +
.../cpu/cpu11/topology/physical_package_id | 1 +
.../cpu/cpu11/topology/thread_siblings | 1 +
.../linux-nodeinfo-sysfs-test-4/cpu/cpu12/online | 1 +
.../cpu/cpu12/topology/core_id | 1 +
.../cpu/cpu12/topology/physical_package_id | 1 +
.../cpu/cpu12/topology/thread_siblings | 1 +
.../linux-nodeinfo-sysfs-test-4/cpu/cpu13/online | 1 +
.../cpu/cpu13/topology/core_id | 1 +
.../cpu/cpu13/topology/physical_package_id | 1 +
.../cpu/cpu13/topology/thread_siblings | 1 +
.../linux-nodeinfo-sysfs-test-4/cpu/cpu14/online | 1 +
.../cpu/cpu14/topology/core_id | 1 +
.../cpu/cpu14/topology/physical_package_id | 1 +
.../cpu/cpu14/topology/thread_siblings | 1 +
.../linux-nodeinfo-sysfs-test-4/cpu/cpu15/online | 1 +
.../cpu/cpu15/topology/core_id | 1 +
.../cpu/cpu15/topology/physical_package_id | 1 +
.../cpu/cpu15/topology/thread_siblings | 1 +
.../linux-nodeinfo-sysfs-test-4/cpu/cpu2/online | 1 +
.../cpu/cpu2/topology/core_id | 1 +
.../cpu/cpu2/topology/physical_package_id | 1 +
.../cpu/cpu2/topology/thread_siblings | 1 +
.../linux-nodeinfo-sysfs-test-4/cpu/cpu3/online | 1 +
.../cpu/cpu3/topology/core_id | 1 +
.../cpu/cpu3/topology/physical_package_id | 1 +
.../cpu/cpu3/topology/thread_siblings | 1 +
.../linux-nodeinfo-sysfs-test-4/cpu/cpu4/online | 1 +
.../cpu/cpu4/topology/core_id | 1 +
.../cpu/cpu4/topology/physical_package_id | 1 +
.../cpu/cpu4/topology/thread_siblings | 1 +
.../linux-nodeinfo-sysfs-test-4/cpu/cpu5/online | 1 +
.../cpu/cpu5/topology/core_id | 1 +
.../cpu/cpu5/topology/physical_package_id | 1 +
.../cpu/cpu5/topology/thread_siblings | 1 +
.../linux-nodeinfo-sysfs-test-4/cpu/cpu6/online | 1 +
.../cpu/cpu6/topology/core_id | 1 +
.../cpu/cpu6/topology/physical_package_id | 1 +
.../cpu/cpu6/topology/thread_siblings | 1 +
.../linux-nodeinfo-sysfs-test-4/cpu/cpu7/online | 1 +
.../cpu/cpu7/topology/core_id | 1 +
.../cpu/cpu7/topology/physical_package_id | 1 +
.../cpu/cpu7/topology/thread_siblings | 1 +
.../linux-nodeinfo-sysfs-test-4/cpu/cpu8/online | 1 +
.../cpu/cpu8/topology/core_id | 1 +
.../cpu/cpu8/topology/physical_package_id | 1 +
.../cpu/cpu8/topology/thread_siblings | 1 +
.../linux-nodeinfo-sysfs-test-4/cpu/cpu9/online | 1 +
.../cpu/cpu9/topology/core_id | 1 +
.../cpu/cpu9/topology/physical_package_id | 1 +
.../cpu/cpu9/topology/thread_siblings | 1 +
.../linux-nodeinfo-sysfs-test-4/node/node0/cpu0 | 1 +
.../linux-nodeinfo-sysfs-test-4/node/node0/cpu1 | 1 +
.../linux-nodeinfo-sysfs-test-4/node/node0/cpu2 | 1 +
.../linux-nodeinfo-sysfs-test-4/node/node0/cpu3 | 1 +
.../linux-nodeinfo-sysfs-test-4/node/node0/cpu4 | 1 +
.../linux-nodeinfo-sysfs-test-4/node/node0/cpu5 | 1 +
.../linux-nodeinfo-sysfs-test-4/node/node0/cpu6 | 1 +
.../linux-nodeinfo-sysfs-test-4/node/node0/cpu7 | 1 +
.../linux-nodeinfo-sysfs-test-4/node/node0/meminfo | 29 ++
.../linux-nodeinfo-sysfs-test-4/node/node1/cpu10 | 1 +
.../linux-nodeinfo-sysfs-test-4/node/node1/cpu11 | 1 +
.../linux-nodeinfo-sysfs-test-4/node/node1/cpu12 | 1 +
.../linux-nodeinfo-sysfs-test-4/node/node1/cpu13 | 1 +
.../linux-nodeinfo-sysfs-test-4/node/node1/cpu14 | 1 +
.../linux-nodeinfo-sysfs-test-4/node/node1/cpu15 | 1 +
.../linux-nodeinfo-sysfs-test-4/node/node1/cpu8 | 1 +
.../linux-nodeinfo-sysfs-test-4/node/node1/cpu9 | 1 +
.../linux-nodeinfo-sysfs-test-4/node/node1/meminfo | 29 ++
.../linux-nodeinfo-sysfs-test-4/node/possible | Bin 0 -> 5 bytes
.../linux-nodeinfo-sysfs-test-5-cpu-x86-output.txt | 1 +
.../linux-nodeinfo-sysfs-test-5-x86.cpuinfo | 100 +++++
.../cpu/cpu0/topology/core_id | 1 +
.../cpu/cpu0/topology/core_siblings | 1 +
.../cpu/cpu0/topology/core_siblings_list | 1 +
.../cpu/cpu0/topology/physical_package_id | 1 +
.../cpu/cpu0/topology/thread_siblings | 1 +
.../cpu/cpu0/topology/thread_siblings_list | 1 +
.../linux-nodeinfo-sysfs-test-5/cpu/cpu1/online | 1 +
.../cpu/cpu1/topology/core_id | 1 +
.../cpu/cpu1/topology/core_siblings | 1 +
.../cpu/cpu1/topology/core_siblings_list | 1 +
.../cpu/cpu1/topology/physical_package_id | 1 +
.../cpu/cpu1/topology/thread_siblings | 1 +
.../cpu/cpu1/topology/thread_siblings_list | 1 +
.../linux-nodeinfo-sysfs-test-5/cpu/cpu2/online | 1 +
.../cpu/cpu2/topology/core_id | 1 +
.../cpu/cpu2/topology/core_siblings | 1 +
.../cpu/cpu2/topology/core_siblings_list | 1 +
.../cpu/cpu2/topology/physical_package_id | 1 +
.../cpu/cpu2/topology/thread_siblings | 1 +
.../cpu/cpu2/topology/thread_siblings_list | 1 +
.../linux-nodeinfo-sysfs-test-5/cpu/cpu3/online | 1 +
.../cpu/cpu3/topology/core_id | 1 +
.../cpu/cpu3/topology/core_siblings | 1 +
.../cpu/cpu3/topology/core_siblings_list | 1 +
.../cpu/cpu3/topology/physical_package_id | 1 +
.../cpu/cpu3/topology/thread_siblings | 1 +
.../cpu/cpu3/topology/thread_siblings_list | 1 +
tests/nodeinfotest.c | 2 +
167 files changed, 903 insertions(+), 128 deletions(-)
create mode 120000 tests/nodeinfodata/linux-nodeinfo-sysfs-test-2/node/node0/cpu0
create mode 120000 tests/nodeinfodata/linux-nodeinfo-sysfs-test-2/node/node0/cpu1
create mode 120000 tests/nodeinfodata/linux-nodeinfo-sysfs-test-3/node/node0/cpu0
create mode 120000 tests/nodeinfodata/linux-nodeinfo-sysfs-test-3/node/node0/cpu12
create mode 120000 tests/nodeinfodata/linux-nodeinfo-sysfs-test-3/node/node0/cpu16
create mode 120000 tests/nodeinfodata/linux-nodeinfo-sysfs-test-3/node/node0/cpu20
create mode 120000 tests/nodeinfodata/linux-nodeinfo-sysfs-test-3/node/node0/cpu4
create mode 120000 tests/nodeinfodata/linux-nodeinfo-sysfs-test-3/node/node0/cpu8
create mode 120000 tests/nodeinfodata/linux-nodeinfo-sysfs-test-3/node/node1/cpu24
create mode 120000 tests/nodeinfodata/linux-nodeinfo-sysfs-test-3/node/node1/cpu28
create mode 120000 tests/nodeinfodata/linux-nodeinfo-sysfs-test-3/node/node1/cpu32
create mode 120000 tests/nodeinfodata/linux-nodeinfo-sysfs-test-3/node/node1/cpu36
create mode 120000 tests/nodeinfodata/linux-nodeinfo-sysfs-test-3/node/node1/cpu40
create mode 120000 tests/nodeinfodata/linux-nodeinfo-sysfs-test-3/node/node1/cpu44
create mode 120000 tests/nodeinfodata/linux-nodeinfo-sysfs-test-3/node/node2/cpu11
create mode 120000 tests/nodeinfodata/linux-nodeinfo-sysfs-test-3/node/node2/cpu15
create mode 120000 tests/nodeinfodata/linux-nodeinfo-sysfs-test-3/node/node2/cpu19
create mode 120000 tests/nodeinfodata/linux-nodeinfo-sysfs-test-3/node/node2/cpu23
create mode 120000 tests/nodeinfodata/linux-nodeinfo-sysfs-test-3/node/node2/cpu3
create mode 120000 tests/nodeinfodata/linux-nodeinfo-sysfs-test-3/node/node2/cpu7
create mode 120000 tests/nodeinfodata/linux-nodeinfo-sysfs-test-3/node/node3/cpu27
create mode 120000 tests/nodeinfodata/linux-nodeinfo-sysfs-test-3/node/node3/cpu31
create mode 120000 tests/nodeinfodata/linux-nodeinfo-sysfs-test-3/node/node3/cpu35
create mode 120000 tests/nodeinfodata/linux-nodeinfo-sysfs-test-3/node/node3/cpu39
create mode 120000 tests/nodeinfodata/linux-nodeinfo-sysfs-test-3/node/node3/cpu43
create mode 120000 tests/nodeinfodata/linux-nodeinfo-sysfs-test-3/node/node3/cpu47
create mode 120000 tests/nodeinfodata/linux-nodeinfo-sysfs-test-3/node/node4/cpu10
create mode 120000 tests/nodeinfodata/linux-nodeinfo-sysfs-test-3/node/node4/cpu14
create mode 120000 tests/nodeinfodata/linux-nodeinfo-sysfs-test-3/node/node4/cpu18
create mode 120000 tests/nodeinfodata/linux-nodeinfo-sysfs-test-3/node/node4/cpu2
create mode 120000 tests/nodeinfodata/linux-nodeinfo-sysfs-test-3/node/node4/cpu22
create mode 120000 tests/nodeinfodata/linux-nodeinfo-sysfs-test-3/node/node4/cpu6
create mode 120000 tests/nodeinfodata/linux-nodeinfo-sysfs-test-3/node/node5/cpu26
create mode 120000 tests/nodeinfodata/linux-nodeinfo-sysfs-test-3/node/node5/cpu30
create mode 120000 tests/nodeinfodata/linux-nodeinfo-sysfs-test-3/node/node5/cpu34
create mode 120000 tests/nodeinfodata/linux-nodeinfo-sysfs-test-3/node/node5/cpu38
create mode 120000 tests/nodeinfodata/linux-nodeinfo-sysfs-test-3/node/node5/cpu42
create mode 120000 tests/nodeinfodata/linux-nodeinfo-sysfs-test-3/node/node5/cpu46
create mode 120000 tests/nodeinfodata/linux-nodeinfo-sysfs-test-3/node/node6/cpu1
create mode 120000 tests/nodeinfodata/linux-nodeinfo-sysfs-test-3/node/node6/cpu13
create mode 120000 tests/nodeinfodata/linux-nodeinfo-sysfs-test-3/node/node6/cpu17
create mode 120000 tests/nodeinfodata/linux-nodeinfo-sysfs-test-3/node/node6/cpu21
create mode 120000 tests/nodeinfodata/linux-nodeinfo-sysfs-test-3/node/node6/cpu5
create mode 120000 tests/nodeinfodata/linux-nodeinfo-sysfs-test-3/node/node6/cpu9
create mode 120000 tests/nodeinfodata/linux-nodeinfo-sysfs-test-3/node/node7/cpu25
create mode 120000 tests/nodeinfodata/linux-nodeinfo-sysfs-test-3/node/node7/cpu29
create mode 120000 tests/nodeinfodata/linux-nodeinfo-sysfs-test-3/node/node7/cpu33
create mode 120000 tests/nodeinfodata/linux-nodeinfo-sysfs-test-3/node/node7/cpu37
create mode 120000 tests/nodeinfodata/linux-nodeinfo-sysfs-test-3/node/node7/cpu41
create mode 120000 tests/nodeinfodata/linux-nodeinfo-sysfs-test-3/node/node7/cpu45
create mode 100644 tests/nodeinfodata/linux-nodeinfo-sysfs-test-4-cpu-x86-output.txt
create mode 100644 tests/nodeinfodata/linux-nodeinfo-sysfs-test-4-x86.cpuinfo
create mode 100644 tests/nodeinfodata/linux-nodeinfo-sysfs-test-4/cpu/cpu0/topology/core_id
create mode 100644 tests/nodeinfodata/linux-nodeinfo-sysfs-test-4/cpu/cpu0/topology/physical_package_id
create mode 100644 tests/nodeinfodata/linux-nodeinfo-sysfs-test-4/cpu/cpu0/topology/thread_siblings
create mode 100644 tests/nodeinfodata/linux-nodeinfo-sysfs-test-4/cpu/cpu1/online
create mode 100644 tests/nodeinfodata/linux-nodeinfo-sysfs-test-4/cpu/cpu1/topology/core_id
create mode 100644 tests/nodeinfodata/linux-nodeinfo-sysfs-test-4/cpu/cpu1/topology/physical_package_id
create mode 100644 tests/nodeinfodata/linux-nodeinfo-sysfs-test-4/cpu/cpu1/topology/thread_siblings
create mode 100644 tests/nodeinfodata/linux-nodeinfo-sysfs-test-4/cpu/cpu10/online
create mode 100644 tests/nodeinfodata/linux-nodeinfo-sysfs-test-4/cpu/cpu10/topology/core_id
create mode 100644 tests/nodeinfodata/linux-nodeinfo-sysfs-test-4/cpu/cpu10/topology/physical_package_id
create mode 100644 tests/nodeinfodata/linux-nodeinfo-sysfs-test-4/cpu/cpu10/topology/thread_siblings
create mode 100644 tests/nodeinfodata/linux-nodeinfo-sysfs-test-4/cpu/cpu11/online
create mode 100644 tests/nodeinfodata/linux-nodeinfo-sysfs-test-4/cpu/cpu11/topology/core_id
create mode 100644 tests/nodeinfodata/linux-nodeinfo-sysfs-test-4/cpu/cpu11/topology/physical_package_id
create mode 100644 tests/nodeinfodata/linux-nodeinfo-sysfs-test-4/cpu/cpu11/topology/thread_siblings
create mode 100644 tests/nodeinfodata/linux-nodeinfo-sysfs-test-4/cpu/cpu12/online
create mode 100644 tests/nodeinfodata/linux-nodeinfo-sysfs-test-4/cpu/cpu12/topology/core_id
create mode 100644 tests/nodeinfodata/linux-nodeinfo-sysfs-test-4/cpu/cpu12/topology/physical_package_id
create mode 100644 tests/nodeinfodata/linux-nodeinfo-sysfs-test-4/cpu/cpu12/topology/thread_siblings
create mode 100644 tests/nodeinfodata/linux-nodeinfo-sysfs-test-4/cpu/cpu13/online
create mode 100644 tests/nodeinfodata/linux-nodeinfo-sysfs-test-4/cpu/cpu13/topology/core_id
create mode 100644 tests/nodeinfodata/linux-nodeinfo-sysfs-test-4/cpu/cpu13/topology/physical_package_id
create mode 100644 tests/nodeinfodata/linux-nodeinfo-sysfs-test-4/cpu/cpu13/topology/thread_siblings
create mode 100644 tests/nodeinfodata/linux-nodeinfo-sysfs-test-4/cpu/cpu14/online
create mode 100644 tests/nodeinfodata/linux-nodeinfo-sysfs-test-4/cpu/cpu14/topology/core_id
create mode 100644 tests/nodeinfodata/linux-nodeinfo-sysfs-test-4/cpu/cpu14/topology/physical_package_id
create mode 100644 tests/nodeinfodata/linux-nodeinfo-sysfs-test-4/cpu/cpu14/topology/thread_siblings
create mode 100644 tests/nodeinfodata/linux-nodeinfo-sysfs-test-4/cpu/cpu15/online
create mode 100644 tests/nodeinfodata/linux-nodeinfo-sysfs-test-4/cpu/cpu15/topology/core_id
create mode 100644 tests/nodeinfodata/linux-nodeinfo-sysfs-test-4/cpu/cpu15/topology/physical_package_id
create mode 100644 tests/nodeinfodata/linux-nodeinfo-sysfs-test-4/cpu/cpu15/topology/thread_siblings
create mode 100644 tests/nodeinfodata/linux-nodeinfo-sysfs-test-4/cpu/cpu2/online
create mode 100644 tests/nodeinfodata/linux-nodeinfo-sysfs-test-4/cpu/cpu2/topology/core_id
create mode 100644 tests/nodeinfodata/linux-nodeinfo-sysfs-test-4/cpu/cpu2/topology/physical_package_id
create mode 100644 tests/nodeinfodata/linux-nodeinfo-sysfs-test-4/cpu/cpu2/topology/thread_siblings
create mode 100644 tests/nodeinfodata/linux-nodeinfo-sysfs-test-4/cpu/cpu3/online
create mode 100644 tests/nodeinfodata/linux-nodeinfo-sysfs-test-4/cpu/cpu3/topology/core_id
create mode 100644 tests/nodeinfodata/linux-nodeinfo-sysfs-test-4/cpu/cpu3/topology/physical_package_id
create mode 100644 tests/nodeinfodata/linux-nodeinfo-sysfs-test-4/cpu/cpu3/topology/thread_siblings
create mode 100644 tests/nodeinfodata/linux-nodeinfo-sysfs-test-4/cpu/cpu4/online
create mode 100644 tests/nodeinfodata/linux-nodeinfo-sysfs-test-4/cpu/cpu4/topology/core_id
create mode 100644 tests/nodeinfodata/linux-nodeinfo-sysfs-test-4/cpu/cpu4/topology/physical_package_id
create mode 100644 tests/nodeinfodata/linux-nodeinfo-sysfs-test-4/cpu/cpu4/topology/thread_siblings
create mode 100644 tests/nodeinfodata/linux-nodeinfo-sysfs-test-4/cpu/cpu5/online
create mode 100644 tests/nodeinfodata/linux-nodeinfo-sysfs-test-4/cpu/cpu5/topology/core_id
create mode 100644 tests/nodeinfodata/linux-nodeinfo-sysfs-test-4/cpu/cpu5/topology/physical_package_id
create mode 100644 tests/nodeinfodata/linux-nodeinfo-sysfs-test-4/cpu/cpu5/topology/thread_siblings
create mode 100644 tests/nodeinfodata/linux-nodeinfo-sysfs-test-4/cpu/cpu6/online
create mode 100644 tests/nodeinfodata/linux-nodeinfo-sysfs-test-4/cpu/cpu6/topology/core_id
create mode 100644 tests/nodeinfodata/linux-nodeinfo-sysfs-test-4/cpu/cpu6/topology/physical_package_id
create mode 100644 tests/nodeinfodata/linux-nodeinfo-sysfs-test-4/cpu/cpu6/topology/thread_siblings
create mode 100644 tests/nodeinfodata/linux-nodeinfo-sysfs-test-4/cpu/cpu7/online
create mode 100644 tests/nodeinfodata/linux-nodeinfo-sysfs-test-4/cpu/cpu7/topology/core_id
create mode 100644 tests/nodeinfodata/linux-nodeinfo-sysfs-test-4/cpu/cpu7/topology/physical_package_id
create mode 100644 tests/nodeinfodata/linux-nodeinfo-sysfs-test-4/cpu/cpu7/topology/thread_siblings
create mode 100644 tests/nodeinfodata/linux-nodeinfo-sysfs-test-4/cpu/cpu8/online
create mode 100644 tests/nodeinfodata/linux-nodeinfo-sysfs-test-4/cpu/cpu8/topology/core_id
create mode 100644 tests/nodeinfodata/linux-nodeinfo-sysfs-test-4/cpu/cpu8/topology/physical_package_id
create mode 100644 tests/nodeinfodata/linux-nodeinfo-sysfs-test-4/cpu/cpu8/topology/thread_siblings
create mode 100644 tests/nodeinfodata/linux-nodeinfo-sysfs-test-4/cpu/cpu9/online
create mode 100644 tests/nodeinfodata/linux-nodeinfo-sysfs-test-4/cpu/cpu9/topology/core_id
create mode 100644 tests/nodeinfodata/linux-nodeinfo-sysfs-test-4/cpu/cpu9/topology/physical_package_id
create mode 100644 tests/nodeinfodata/linux-nodeinfo-sysfs-test-4/cpu/cpu9/topology/thread_siblings
create mode 120000 tests/nodeinfodata/linux-nodeinfo-sysfs-test-4/node/node0/cpu0
create mode 120000 tests/nodeinfodata/linux-nodeinfo-sysfs-test-4/node/node0/cpu1
create mode 120000 tests/nodeinfodata/linux-nodeinfo-sysfs-test-4/node/node0/cpu2
create mode 120000 tests/nodeinfodata/linux-nodeinfo-sysfs-test-4/node/node0/cpu3
create mode 120000 tests/nodeinfodata/linux-nodeinfo-sysfs-test-4/node/node0/cpu4
create mode 120000 tests/nodeinfodata/linux-nodeinfo-sysfs-test-4/node/node0/cpu5
create mode 120000 tests/nodeinfodata/linux-nodeinfo-sysfs-test-4/node/node0/cpu6
create mode 120000 tests/nodeinfodata/linux-nodeinfo-sysfs-test-4/node/node0/cpu7
create mode 100644 tests/nodeinfodata/linux-nodeinfo-sysfs-test-4/node/node0/meminfo
create mode 120000 tests/nodeinfodata/linux-nodeinfo-sysfs-test-4/node/node1/cpu10
create mode 120000 tests/nodeinfodata/linux-nodeinfo-sysfs-test-4/node/node1/cpu11
create mode 120000 tests/nodeinfodata/linux-nodeinfo-sysfs-test-4/node/node1/cpu12
create mode 120000 tests/nodeinfodata/linux-nodeinfo-sysfs-test-4/node/node1/cpu13
create mode 120000 tests/nodeinfodata/linux-nodeinfo-sysfs-test-4/node/node1/cpu14
create mode 120000 tests/nodeinfodata/linux-nodeinfo-sysfs-test-4/node/node1/cpu15
create mode 120000 tests/nodeinfodata/linux-nodeinfo-sysfs-test-4/node/node1/cpu8
create mode 120000 tests/nodeinfodata/linux-nodeinfo-sysfs-test-4/node/node1/cpu9
create mode 100644 tests/nodeinfodata/linux-nodeinfo-sysfs-test-4/node/node1/meminfo
create mode 100644 tests/nodeinfodata/linux-nodeinfo-sysfs-test-4/node/possible
create mode 100644 tests/nodeinfodata/linux-nodeinfo-sysfs-test-5-cpu-x86-output.txt
create mode 100644 tests/nodeinfodata/linux-nodeinfo-sysfs-test-5-x86.cpuinfo
create mode 100644 tests/nodeinfodata/linux-nodeinfo-sysfs-test-5/cpu/cpu0/topology/core_id
create mode 100644 tests/nodeinfodata/linux-nodeinfo-sysfs-test-5/cpu/cpu0/topology/core_siblings
create mode 100644 tests/nodeinfodata/linux-nodeinfo-sysfs-test-5/cpu/cpu0/topology/core_siblings_list
create mode 100644 tests/nodeinfodata/linux-nodeinfo-sysfs-test-5/cpu/cpu0/topology/physical_package_id
create mode 100644 tests/nodeinfodata/linux-nodeinfo-sysfs-test-5/cpu/cpu0/topology/thread_siblings
create mode 100644 tests/nodeinfodata/linux-nodeinfo-sysfs-test-5/cpu/cpu0/topology/thread_siblings_list
create mode 100644 tests/nodeinfodata/linux-nodeinfo-sysfs-test-5/cpu/cpu1/online
create mode 100644 tests/nodeinfodata/linux-nodeinfo-sysfs-test-5/cpu/cpu1/topology/core_id
create mode 100644 tests/nodeinfodata/linux-nodeinfo-sysfs-test-5/cpu/cpu1/topology/core_siblings
create mode 100644 tests/nodeinfodata/linux-nodeinfo-sysfs-test-5/cpu/cpu1/topology/core_siblings_list
create mode 100644 tests/nodeinfodata/linux-nodeinfo-sysfs-test-5/cpu/cpu1/topology/physical_package_id
create mode 100644 tests/nodeinfodata/linux-nodeinfo-sysfs-test-5/cpu/cpu1/topology/thread_siblings
create mode 100644 tests/nodeinfodata/linux-nodeinfo-sysfs-test-5/cpu/cpu1/topology/thread_siblings_list
create mode 100644 tests/nodeinfodata/linux-nodeinfo-sysfs-test-5/cpu/cpu2/online
create mode 100644 tests/nodeinfodata/linux-nodeinfo-sysfs-test-5/cpu/cpu2/topology/core_id
create mode 100644 tests/nodeinfodata/linux-nodeinfo-sysfs-test-5/cpu/cpu2/topology/core_siblings
create mode 100644 tests/nodeinfodata/linux-nodeinfo-sysfs-test-5/cpu/cpu2/topology/core_siblings_list
create mode 100644 tests/nodeinfodata/linux-nodeinfo-sysfs-test-5/cpu/cpu2/topology/physical_package_id
create mode 100644 tests/nodeinfodata/linux-nodeinfo-sysfs-test-5/cpu/cpu2/topology/thread_siblings
create mode 100644 tests/nodeinfodata/linux-nodeinfo-sysfs-test-5/cpu/cpu2/topology/thread_siblings_list
create mode 100644 tests/nodeinfodata/linux-nodeinfo-sysfs-test-5/cpu/cpu3/online
create mode 100644 tests/nodeinfodata/linux-nodeinfo-sysfs-test-5/cpu/cpu3/topology/core_id
create mode 100644 tests/nodeinfodata/linux-nodeinfo-sysfs-test-5/cpu/cpu3/topology/core_siblings
create mode 100644 tests/nodeinfodata/linux-nodeinfo-sysfs-test-5/cpu/cpu3/topology/core_siblings_list
create mode 100644 tests/nodeinfodata/linux-nodeinfo-sysfs-test-5/cpu/cpu3/topology/physical_package_id
create mode 100644 tests/nodeinfodata/linux-nodeinfo-sysfs-test-5/cpu/cpu3/topology/thread_siblings
create mode 100644 tests/nodeinfodata/linux-nodeinfo-sysfs-test-5/cpu/cpu3/topology/thread_siblings_list
--
1.7.8.6
12 years, 5 months
[libvirt] [PATCH] docs: added description of the vendor_id attribute
by Hendrik Schwartke
---
docs/formatdomain.html.in | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index 94c555f..b6e0d5d 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -779,7 +779,11 @@
in which case an attempt to start a domain requesting an unsupported
CPU model will fail. Supported values for <code>fallback</code>
attribute are: <code>allow</code> (this is the default), and
- <code>forbid</code>.</dd>
+ <code>forbid</code>. The optional <code>vendor_id</code> attribute
+ (<span class="since">Since 0.9.14</span>) can be used to set the
+ vendor id seen by the guest. It must be exactly 12 characters long.
+ If not set the vendor id of the host is used. Typical possible
+ values are "AuthenticAMD" and "GenuineIntel".</dd>
<dt><code>vendor</code></dt>
<dd><span class="since">Since 0.8.3</span> the content of the
--
1.7.9.5
12 years, 5 months
[libvirt] Problem setting CPU topology
by Zeeshan Ali (Khattak)
Hi,
I'm trying to set exact CPU topology to qemu-kvm domains to match
host's topology. In my case, host topology is: 1 socket, 2 cores and 2
threads. If I set the XML like this:
<domain type='kvm'>
..
<vcpu placement='static'>4</vcpu>
<os>
<type arch='i686' machine='pc-0.15'>hvm</type>
<boot dev='hd'/>
</os>
<cpu mode='host-model'>
<model fallback='allow'/>
<topology sockets='1' cores='2' threads='2'/>
</cpu>
..
The qemu commandline launched for this domain looks like this:
/usr/bin/qemu-kvm -name fedora17-2 -S -M pc-0.15 -cpu
core2duo,+lahf_lm,+rdtscp,+aes,+popcnt,+sse4.2,+sse4.1,+pdcm,+xtpr,+cx16,+tm2,+est,+smx,+vmx,+ds_cpl,+dtes64,+pclmuldq,+pbe,+tm,+ht,+ss,+acpi,+ds
-enable-kvm -m 1152 -smp 4,sockets=1,cores=2,threads=2 -uuid
c573342b-2876-05b8-098e-6d5314cab062 -nodefconfig -nodefaults -chardev
socket,id=charmonitor,path=/home/zeenix/.config/libvirt/qemu/lib/fedora17-2.monitor,server,nowait
-mon chardev=charmonitor,id=monitor,mode=control -rtc
base=utc,driftfix=slew -no-kvm-pit-reinjection -no-shutdown -no-acpi
-device piix3-usb-uhci,id=usb,bus=pci.0,addr=0x1.0x2 -device
virtio-serial-pci,id=virtio-serial0,bus=pci.0,addr=0x5 -drive
file=/home/zeenix/.local/share/gnome-boxes/images/fedora17-2,if=none,id=drive-virtio-disk0,format=qcow2,cache=none
-device virtio-blk-pci,scsi=off,bus=pci.0,addr=0x6,drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1
-drive file=/extra-data/ISOs/Fedora-17-i686-Live-Desktop.iso,if=none,id=drive-ide0-1-0,readonly=on,format=raw
-device ide-cd,bus=ide.1,unit=0,drive=drive-ide0-1-0,id=ide0-1-0
-netdev user,id=hostnet0 -device
rtl8139,netdev=hostnet0,id=net0,mac=52:54:00:21:6f:6e,bus=pci.0,addr=0x3
-chardev pty,id=charserial0 -device
isa-serial,chardev=charserial0,id=serial0 -chardev
spicevmc,id=charchannel0,name=vdagent -device
virtserialport,bus=virtio-serial0.0,nr=1,chardev=charchannel0,id=channel0,name=com.redhat.spice.0
-device usb-tablet,id=input0 -spice
port=5900,addr=127.0.0.1,disable-ticketing -vga qxl -global
qxl-vga.vram_size=67108864 -device AC97,id=sound0,bus=pci.0,addr=0x4
-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x7
Despite the '-smp 4,sockets=1,cores=2,threads=2', I see only 1 CPU
reported by '/proc/cpuinfo' in the guest F17 live.
However, when I manually launch a very similar commandline,':
/usr/bin/qemu-kvm -name fedora17-2 -M pc-0.15 -cpu
core2duo,+lahf_lm,+rdtscp,+aes,+popcnt,+sse4.2,+sse4.1,+pdcm,+xtpr,+cx16,+tm2,+est,+smx,+vmx,+ds_cpl,+dtes64,+pclmuldq,+pbe,+tm,+ht,+ss,+acpi,+ds
-m 1G -smp 4,cores=2,threads=2,sockets=1 -uuid
c573342b-2876-05b8-098e-6d5314cab062 -nodefconfig -enable-kvm -cdrom
/home/zeenix/ISOs/Fedora-17-i686-Live-Desktop.iso
I see 4 CPUs reported by '/proc/cpuinfo in the guest. Any clues?
--
Regards,
Zeeshan Ali (Khattak)
FSF member#5124
12 years, 5 months
[libvirt] [PATCHv3 0/5] Virtio support for S390
by Viktor Mihajlovski
As 0.9.13 is stabilizing and I will not be available next week
I am sending this reworked patch set already today, looking forward
to comments.
This series adds support for the s390 flavor of virtio devices.
Since the s390 virtio devices are not implemented as PCI devices
it is necessary to refactor some of the device address assignment
code.
v2 changes
resent as thread
v3 changes
renumbered new virtio-s390 capability
fixed incorrect whitespace
fixed subject lines
Viktor Mihajlovski (5):
qemu: Extended qemuDomainAssignAddresses to be callable from
everywhere.
qemu: Change tests to use (modified) qemuDomainAssignAddresses
S390: Add support for virtio-s390 devices.
S390: Domain Schema for s390-virtio machines.
S390: Adding testcases for s390
docs/schemas/domaincommon.rng | 20 +++
src/conf/domain_conf.c | 11 +-
src/conf/domain_conf.h | 1 +
src/qemu/qemu_capabilities.c | 7 +
src/qemu/qemu_capabilities.h | 1 +
src/qemu/qemu_command.c | 139 ++++++++++++++++++--
src/qemu/qemu_command.h | 6 +-
src/qemu/qemu_driver.c | 14 +-
src/qemu/qemu_process.c | 42 +------
.../qemuxml2argv-console-virtio-s390.args | 9 ++
.../qemuxml2argv-console-virtio-s390.xml | 24 ++++
.../qemuxml2argv-disk-virtio-s390.args | 5 +
.../qemuxml2argv-disk-virtio-s390.xml | 22 +++
.../qemuxml2argv-minimal-s390.args | 5 +
.../qemuxml2argvdata/qemuxml2argv-minimal-s390.xml | 21 +++
.../qemuxml2argv-net-virtio-s390.args | 5 +
.../qemuxml2argv-net-virtio-s390.xml | 22 +++
tests/qemuxml2argvtest.c | 20 ++--
tests/qemuxmlnstest.c | 13 +--
tests/testutilsqemu.c | 31 +++++
20 files changed, 332 insertions(+), 86 deletions(-)
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-console-virtio-s390.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-console-virtio-s390.xml
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-disk-virtio-s390.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-disk-virtio-s390.xml
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-minimal-s390.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-minimal-s390.xml
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-net-virtio-s390.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-net-virtio-s390.xml
12 years, 5 months
[libvirt] [PATCH] fix failure when building with --disable-debug
by Hu Tao
When building with --disable-debug, VIR_DEBUG expands to a nop.
But parameters to VIR_DEBUG can be variables that are passed only
to VIR_DEBUG. In the case the building system complains about unused
variables.
---
src/libvirt_private.syms | 1 +
src/util/logging.c | 15 +++++++++++++++
src/util/logging.h | 3 ++-
3 files changed, 18 insertions(+), 1 deletion(-)
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index b173590..48c4df7 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -739,6 +739,7 @@ virLockManagerRelease;
# logging.h
+virEatParam;
virLogDefineFilter;
virLogDefineOutput;
virLogEmergencyDumpAll;
diff --git a/src/util/logging.c b/src/util/logging.c
index f8233cd..999dd01 100644
--- a/src/util/logging.c
+++ b/src/util/logging.c
@@ -1262,3 +1262,18 @@ void virLogSetFromEnv(void) {
if (debugEnv && *debugEnv)
virLogParseOutputs(debugEnv);
}
+
+/**
+ * virEatParam:
+ *
+ * Do nothing but eat parameters. See VIR_DEBUG_INT.
+ *
+ * Currently only VIR_DEBUG_INT uses this function, which could
+ * have been defined right before VIR_DEBUG_INT, but it makes
+ * `make syntax-check' unhappy about ATTRIBUTE_UNUSED appearing
+ * in .h file.
+ */
+void virEatParam(void *unused ATTRIBUTE_UNUSED, ...)
+{
+ /* do nothing */
+}
diff --git a/src/util/logging.h b/src/util/logging.h
index 70318d0..b96a115 100644
--- a/src/util/logging.h
+++ b/src/util/logging.h
@@ -35,7 +35,7 @@
virLogMessage(category, VIR_LOG_DEBUG, f, l, 0, __VA_ARGS__)
# else
# define VIR_DEBUG_INT(category, f, l, ...) \
- do { } while (0)
+ virEatParam((void*)category, f, l, __VA_ARGS__)
# endif /* !ENABLE_DEBUG */
# define VIR_INFO_INT(category, f, l, ...) \
@@ -142,4 +142,5 @@ extern void virLogVMessage(const char *category, int priority,
va_list vargs) ATTRIBUTE_FMT_PRINTF(6, 0);
extern int virLogSetBufferSize(int size);
extern void virLogEmergencyDumpAll(int signum);
+void virEatParam(void *unused, ...);
#endif
--
1.7.10.2
12 years, 5 months
[libvirt] [PATCHv2] openvz: Handle domain obj hash map errors
by Guido Günther
This makes the driver fail with a clear error message in case of UUID
collisions (for example if somebody copied a container configuration
without updating the UUID) and also raises an error on other hash map
failures.
OpenVZ itself doesn't complain about duplicate UUIDs since this
parameter is only used by libvirt.
---
This version adds an extra check for hash collisions and keeps the
generic failure message for all other errors in virHashAddEntry.
Cheers,
-- Guido
src/openvz/openvz_conf.c | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/src/openvz/openvz_conf.c b/src/openvz/openvz_conf.c
index 503c8a0..91cd125 100644
--- a/src/openvz/openvz_conf.c
+++ b/src/openvz/openvz_conf.c
@@ -684,8 +684,18 @@ int openvzLoadDomains(struct openvz_driver *driver) {
openvzReadMemConf(dom->def, veid);
virUUIDFormat(dom->def->uuid, uuidstr);
- if (virHashAddEntry(driver->domains.objs, uuidstr, dom) < 0)
+ if (virHashLookup(driver->domains.objs, uuidstr)) {
+ openvzError(VIR_ERR_INTERNAL_ERROR,
+ _("Duplicate container UUID %s detected for %d"),
+ uuidstr,
+ veid);
+ goto cleanup;
+ }
+ if (virHashAddEntry(driver->domains.objs, uuidstr, dom) < 0) {
+ openvzError(VIR_ERR_INTERNAL_ERROR,
+ _("Could not add UUID for container %d"), veid);
goto cleanup;
+ }
virDomainObjUnlock(dom);
dom = NULL;
--
1.7.10.4
12 years, 5 months
[libvirt] [PATCH] Fix /domain/features setting in qemuParseCommandLine
by Christophe Fergeau
Commit 5e6ce1 moved down detection of the ACPI feature in
qemuParseCommandLine. However, when ACPI is detected, it clears
all feature flags in def->features to only set ACPI. This used to
be fine because this was the first place were def->features was set,
but after the move this is no longer necessarily true because this
block comes before the ACPI check:
if (strstr(def->emulator, "kvm")) {
def->virtType = VIR_DOMAIN_VIRT_KVM;
def->features |= (1 << VIR_DOMAIN_FEATURE_PAE);
}
Since def is allocated in qemuParseCommandLine using VIR_ALLOC, we
can always use |= when modifying def->features
---
This is an issue I noticed while reading this code for other reasons,
I have only compile-tested it and I'm not sure how to test it.
Christophe
src/qemu/qemu_command.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 6549f57..0065e83 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -7547,7 +7547,7 @@ virDomainDefPtr qemuParseCommandLine(virCapsPtr caps,
goto no_memory;
if (STREQ(def->os.arch, "i686")||STREQ(def->os.arch, "x86_64"))
- def->features = (1 << VIR_DOMAIN_FEATURE_ACPI)
+ def->features |= (1 << VIR_DOMAIN_FEATURE_ACPI)
/*| (1 << VIR_DOMAIN_FEATURE_APIC)*/;
#define WANT_VALUE() \
const char *val = progargv[++i]; \
--
1.7.10.4
12 years, 5 months
[libvirt] [glib PATCH] Add givr_domain_save_to_file() and gvir_domain_save_to_file_async
by Jovanka Gulicoska
---
libvirt-gobject/libvirt-gobject-domain.c | 138 ++++++++++++++++++++++++++++++
libvirt-gobject/libvirt-gobject-domain.h | 19 ++++
libvirt-gobject/libvirt-gobject.sym | 3 +
3 files changed, 160 insertions(+)
diff --git a/libvirt-gobject/libvirt-gobject-domain.c b/libvirt-gobject/libvirt-gobject-domain.c
index 088cd33..356b15b 100644
--- a/libvirt-gobject/libvirt-gobject-domain.c
+++ b/libvirt-gobject/libvirt-gobject-domain.c
@@ -55,6 +55,7 @@ enum {
VIR_RESUMED,
VIR_STOPPED,
VIR_UPDATED,
+ VIR_SAVED_TO_FILE,
LAST_SIGNAL
};
@@ -225,6 +226,16 @@ static void gvir_domain_class_init(GVirDomainClass *klass)
G_TYPE_NONE,
0);
+ signals[VIR_SAVED_TO_FILE] = g_signal_new("saved_to_file",
+ G_OBJECT_CLASS_TYPE(object_class),
+ G_SIGNAL_RUN_LAST | G_SIGNAL_NO_RECURSE |
+ G_SIGNAL_NO_HOOKS | G_SIGNAL_DETAILED,
+ G_STRUCT_OFFSET(GVirDomainClass, saved_to_file),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE,
+ 0);
+
g_type_class_add_private(klass, sizeof(GVirDomainPrivate));
}
@@ -556,6 +567,133 @@ gboolean gvir_domain_reboot(GVirDomain *dom,
return TRUE;
}
+gboolean gvir_domain_save_to_file_config(GVirDomain *dom,
+ gchar *filename,
+ GVirConfigDomain *conf,
+ guint flags,
+ GError **err)
+{
+ GVirDomainPrivate *priv;
+ gchar *custom_xml;
+ int ret;
+
+ g_return_val_if_fail(GVIR_IS_DOMAIN(dom), FALSE);
+ g_return_val_if_fail(GVIR_CONFIG_IS_DOMAIN (conf), FALSE);
+ g_return_val_if_fail(err == NULL || *err == NULL, FALSE);
+
+ priv = dom->priv;
+ custom_xml = gvir_config_object_to_xml(GVIR_CONFIG_OBJECT(conf));
+
+ if (flags || custom_xml) {
+ ret = virDomainSaveFlags(priv->handle, filename, custom_xml, flags);
+ g_free (custom_xml);
+ }
+ else {
+ ret = virDomainSave(priv->handle, filename);
+ g_free (custom_xml);
+ }
+ if (ret < 0) {
+ gvir_set_error_literal(err, GVIR_DOMAIN_ERROR,
+ 0,
+ "Unable to save domain to file");
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+typedef struct {
+ gchar *filename;
+ gchar *custom_xml;
+ guint flags;
+} DomainSaveToFileData;
+
+static void domain_save_to_file_data_free(DomainSaveToFileData *data)
+{
+ g_slice_free(DomainSaveToFileData, data);
+}
+
+static void
+gvir_domain_save_to_file_helper(GSimpleAsyncResult *res,
+ GObject *object,
+ GCancellable *cancellable G_GNUC_UNUSED)
+{
+ GVirDomain *dom = GVIR_DOMAIN(object);
+ DomainSaveToFileData *data;
+ GVirConfigDomain *conf;
+ GError *err = NULL;
+ // gchar *xml;
+
+ data = g_simple_async_result_get_op_res_gpointer(res);
+ // // xml = data->filename;
+ conf = gvir_domain_get_config(dom, data->flags, &err);
+
+ if (!gvir_domain_save_to_file_config(dom, data->filename, conf, data->flags, &err))
+ g_simple_async_result_take_error(res, err);
+ }
+
+/**
+ * gvir_domain_save_to_file_async:
+ * @dom: the domain
+ * @flags: the flags
+ * @cancellable: cancallation object
+ * @callback: (scope async): completion callback
+ * @user_data: (closure): opaque data for callback
+ *
+ * Asynchronous variant of #gvir_domain_save_to_file.
+ */
+
+void gvir_domain_save_to_file_async (GVirDomain *dom,
+ gchar *filename,
+ GVirConfigDomain *conf,
+ guint flags,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data)
+{
+ GSimpleAsyncResult *res;
+ DomainSaveToFileData *data;
+ gchar *xml;
+
+ g_return_if_fail(GVIR_IS_DOMAIN(dom));
+ g_return_if_fail(GVIR_CONFIG_IS_DOMAIN (conf));
+ g_return_if_fail((cancellable == NULL) || G_IS_CANCELLABLE(cancellable));
+
+ xml = gvir_config_object_to_xml(GVIR_CONFIG_OBJECT(conf));
+
+ data = g_slice_new0(DomainSaveToFileData);
+ data->filename = filename;
+ data->custom_xml = xml;
+ data->flags = flags;
+
+ res = g_simple_async_result_new(G_OBJECT(dom),
+ callback,
+ user_data,
+ gvir_domain_save_to_file_async);
+ g_simple_async_result_set_op_res_gpointer(res, data, (GDestroyNotify)domain_save_to_file_data_free);
+
+ g_simple_async_result_run_in_thread(res,
+ gvir_domain_save_to_file_helper,
+ G_PRIORITY_DEFAULT,
+ cancellable);
+
+ g_object_unref(res);
+}
+
+gboolean gvir_domain_save_to_file_finish(GVirDomain *dom,
+ GAsyncResult *result,
+ GError **err)
+{
+ g_return_val_if_fail(GVIR_IS_DOMAIN(dom), FALSE);
+ g_return_val_if_fail(g_simple_async_result_is_valid(result, G_OBJECT(dom), gvir_domain_save_to_file_async), FALSE);
+ g_return_val_if_fail(err == NULL || *err == NULL, FALSE);
+
+ if (g_simple_async_result_propagate_error(G_SIMPLE_ASYNC_RESULT(result), err))
+ return FALSE;
+
+ return TRUE;
+}
+
/**
* gvir_domain_get_config:
* @dom: the domain
diff --git a/libvirt-gobject/libvirt-gobject-domain.h b/libvirt-gobject/libvirt-gobject-domain.h
index 87b94f4..1df54de 100644
--- a/libvirt-gobject/libvirt-gobject-domain.h
+++ b/libvirt-gobject/libvirt-gobject-domain.h
@@ -65,6 +65,7 @@ struct _GVirDomainClass
void (*resumed)(GVirDomain *dom);
void (*updated)(GVirDomain *dom);
void (*suspended)(GVirDomain *dom);
+ void (*saved_to_file) (GVirDomain *dom);
gpointer padding[20];
};
@@ -148,6 +149,24 @@ gboolean gvir_domain_reboot(GVirDomain *dom,
guint flags,
GError **err);
+void gvir_domain_save_to_file_async (GVirDomain *dom,
+ gchar *filename,
+ GVirConfigDomain *conf,
+ guint flags,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+
+gboolean gvir_domain_save_to_file_finish(GVirDomain *dom,
+ GAsyncResult *result,
+ GError **err);
+
+gboolean gvir_domain_save_to_file_config(GVirDomain *dom,
+ gchar *filename,
+ GVirConfigDomain *conf,
+ guint flags,
+ GError **err);
+
GVirDomainInfo *gvir_domain_get_info(GVirDomain *dom,
GError **err);
void gvir_domain_get_info_async(GVirDomain *dom,
diff --git a/libvirt-gobject/libvirt-gobject.sym b/libvirt-gobject/libvirt-gobject.sym
index 94e441a..8ff9e24 100644
--- a/libvirt-gobject/libvirt-gobject.sym
+++ b/libvirt-gobject/libvirt-gobject.sym
@@ -75,6 +75,9 @@ LIBVIRT_GOBJECT_0.0.8 {
gvir_domain_get_persistent;
gvir_domain_get_saved;
gvir_domain_screenshot;
+ gvir_domain_save_to_file_config;
+ gvir_domain_save_to_file_async;
+ gvir_domain_save_to_file_finish;
gvir_domain_snapshot_get_type;
gvir_domain_snapshot_handle_get_type;
--
1.7.10.4
12 years, 5 months
[libvirt] [glib PATCH] Add gvir_connection_domain_restore() and gvir_connection_domain_restore_async()
by Jovanka Gulicoska
---
libvirt-gobject/libvirt-gobject-connection.c | 136 ++++++++++++++++++++++++++
libvirt-gobject/libvirt-gobject-connection.h | 19 ++++
libvirt-gobject/libvirt-gobject.sym | 3 +
3 files changed, 158 insertions(+)
diff --git a/libvirt-gobject/libvirt-gobject-connection.c b/libvirt-gobject/libvirt-gobject-connection.c
index 3a99034..2302328 100644
--- a/libvirt-gobject/libvirt-gobject-connection.c
+++ b/libvirt-gobject/libvirt-gobject-connection.c
@@ -57,6 +57,7 @@ enum {
VIR_CONNECTION_CLOSED,
VIR_DOMAIN_ADDED,
VIR_DOMAIN_REMOVED,
+ VIR_DOMAIN_RESTORED,
LAST_SIGNAL
};
@@ -228,6 +229,15 @@ static void gvir_connection_class_init(GVirConnectionClass *klass)
1,
GVIR_TYPE_DOMAIN);
+ signals[VIR_DOMAIN_RESTORED] = g_signal_new("domain-restored",
+ G_OBJECT_CLASS_TYPE(object_class),
+ G_SIGNAL_RUN_FIRST,
+ G_STRUCT_OFFSET(GVirConnectionClass, domain_restored),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__OBJECT,
+ G_TYPE_NONE,
+ 0);
+
g_type_class_add_private(klass, sizeof(GVirConnectionPrivate));
}
@@ -1605,3 +1615,129 @@ gvir_connection_get_capabilities_finish(GVirConnection *conn,
return g_object_ref(caps);
}
+
+/*
+ * gvir_connection_domain_restore
+ */
+gboolean gvir_connection_domain_restore(GVirConnection *conn,
+ gchar *filename,
+ GVirConfigDomain *conf,
+ guint flags,
+ GError **err)
+{
+ GVirConnectionPrivate *priv;
+ gchar *custom_xml;
+ int ret;
+
+ g_return_val_if_fail(GVIR_IS_CONNECTION(conn), FALSE);
+ g_return_val_if_fail(GVIR_CONFIG_IS_DOMAIN (conf), FALSE);
+ g_return_val_if_fail((err == NULL) || (*err == NULL), FALSE);
+
+ priv = conn->priv;
+ custom_xml = gvir_config_object_to_xml(GVIR_CONFIG_OBJECT(conf));
+
+ g_return_val_if_fail(custom_xml != NULL, FALSE);
+
+ if(flags || custom_xml) {
+ ret = virDomainRestoreFlags(priv->conn, filename, custom_xml, flags);
+ g_free (custom_xml);
+ }
+ else {
+ ret = virDomainRestore(priv->conn, filename);
+ g_free (custom_xml);
+ }
+
+ if(ret < 0) {
+ gvir_set_error_literal(err, GVIR_CONNECTION_ERROR,
+ 0,
+ "Unable to restore domain");
+
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+typedef struct {
+ gchar *filename;
+ gchar *custom_xml;
+ guint flags;
+} DomainRestoreFromFileData;
+
+static void domain_restore_from_file_data_free(DomainRestoreFromFileData *data)
+{
+ g_slice_free(DomainRestoreFromFileData, data);
+}
+
+static void
+gvir_connection_domain_restore_helper(GSimpleAsyncResult *res,
+ GObject *object,
+ GCancellable *cancellable G_GNUC_UNUSED)
+{
+ GVirConnection *conn = GVIR_CONNECTION(object);
+ DomainRestoreFromFileData *data;
+ GVirConfigDomain *conf;
+ GError *err = NULL;
+
+ data = g_simple_async_result_get_op_res_gpointer(res);
+ conf = gvir_config_domain_new_from_xml(data->custom_xml, &err);
+
+ if(!gvir_connection_domain_restore(conn, data->filename, conf, data->flags, &err))
+ g_simple_async_result_take_error(res, err);
+}
+
+/*
+ * Async function of gvir_connection_domain_restore
+ */
+void gvir_connection_domain_restore_async(GVirConnection *conn,
+ gchar *filename,
+ GVirConfigDomain *conf,
+ guint flags,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data)
+{
+ GSimpleAsyncResult *res;
+ DomainRestoreFromFileData *data;
+ gchar *custom_xml;
+
+ g_return_if_fail(GVIR_IS_CONNECTION(conn));
+ g_return_if_fail(GVIR_CONFIG_IS_DOMAIN (conf));
+ g_return_if_fail((cancellable == NULL) || G_IS_CANCELLABLE(cancellable));
+
+ custom_xml = gvir_config_object_to_xml(GVIR_CONFIG_OBJECT(conf));
+
+ data = g_slice_new0(DomainRestoreFromFileData);
+ data->filename = filename;
+ data->custom_xml = custom_xml;
+ data->flags = flags;
+
+ res = g_simple_async_result_new(G_OBJECT(conn),
+ callback,
+ user_data,
+ gvir_connection_domain_restore_async);
+ g_simple_async_result_set_op_res_gpointer(res, data,
+ (GDestroyNotify)domain_restore_from_file_data_free);
+
+ g_simple_async_result_run_in_thread(res,
+ gvir_connection_domain_restore_helper,
+ G_PRIORITY_DEFAULT,
+ cancellable);
+
+ g_object_unref(res);
+}
+
+gboolean gvir_connection_domain_restore_finish(GVirConnection *conn,
+ GAsyncResult *result,
+ GError **err)
+{
+ g_return_val_if_fail(GVIR_IS_CONNECTION(conn), FALSE);
+ g_return_val_if_fail(g_simple_async_result_is_valid(result, G_OBJECT(conn),
+ gvir_connection_domain_restore_async),
+ FALSE);
+
+ if (g_simple_async_result_propagate_error(G_SIMPLE_ASYNC_RESULT(result), err))
+ return FALSE;
+
+ return TRUE;
+}
diff --git a/libvirt-gobject/libvirt-gobject-connection.h b/libvirt-gobject/libvirt-gobject-connection.h
index c80eecf..01d5d0b 100644
--- a/libvirt-gobject/libvirt-gobject-connection.h
+++ b/libvirt-gobject/libvirt-gobject-connection.h
@@ -75,6 +75,8 @@ struct _GVirConnectionClass
void (*domain_added)(GVirConnection *conn, GVirDomain *dom);
void (*domain_removed)(GVirConnection *conn, GVirDomain *dom);
+ void (*domain_restored)(GVirConnection *conn);
+
GVirStream *(*stream_new)(GVirConnection *conn, gpointer handle);
gpointer padding[20];
@@ -202,6 +204,23 @@ gvir_connection_get_capabilities_finish(GVirConnection *conn,
GAsyncResult *result,
GError **err);
+gboolean gvir_connection_domain_restore(GVirConnection *conn,
+ gchar *filename,
+ GVirConfigDomain *conf,
+ guint flags,
+ GError **err);
+
+void gvir_connection_domain_restore_async(GVirConnection *conn,
+ gchar *filename,
+ GVirConfigDomain *conf,
+ guint flags,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+
+gboolean gvir_connection_domain_restore_finish(GVirConnection *conn,
+ GAsyncResult *result,
+ GError **err);
G_END_DECLS
#endif /* __LIBVIRT_GOBJECT_CONNECTION_H__ */
diff --git a/libvirt-gobject/libvirt-gobject.sym b/libvirt-gobject/libvirt-gobject.sym
index 8ff9e24..0aaefa2 100644
--- a/libvirt-gobject/libvirt-gobject.sym
+++ b/libvirt-gobject/libvirt-gobject.sym
@@ -31,6 +31,9 @@ LIBVIRT_GOBJECT_0.0.8 {
gvir_connection_create_storage_pool;
gvir_connection_start_domain;
gvir_connection_get_node_info;
+ gvir_connection_domain_restore;
+ gvir_connection_domain_restore_async;
+ gvir_connection_domain_restore_finish;
gvir_domain_device_get_type;
gvir_domain_device_get_domain;
--
1.7.10.4
12 years, 5 months