[libvirt] [PATCH v4 00/11] Add runnability info to query-cpu-definitions
by Eduardo Habkost
This series extends query-cpu-definitions to include an extra
field: "unavailable-features". The new field can be used to find
out reasons that prevent the CPU model from running in the
current host.
This will return information based on the current machine and
accelerator only. In the future we may extend these mechanisms to
allow querying other machines and other accelerators without
restarting QEMU, but it will require some reorganization of
QEMU's main code.
To be able to implement this more cleanly, the series rework some
of the feature/property name code.
This series can be seen in the git branch at:
https://github.com/ehabkost/qemu-hacks.git work/query-cpu-definitions-runnable-info
The series is based on my x86-next branch:
https://github.com/ehabkost/qemu.git x86-next
Changes v3 -> v4:
* Removed patch "Define CPUID filtering functions before x86_cpu_list"
* New patch: "tests: Add test case for x86 feature parsing compatibility"
* New patch: "target-i386: Disable VME by default with TCG"
* Disable VME by default on TCG to avoid returning bogus
results for all CPU models in TCG mode
* New patch: "target-i386: Make plus_features/minus_features QOM-based"
* New patch: "target-i386: Remove underscores from property names"
* New patch: "target-i386: Register properties for feature aliases manually"
* New patch: "target-i386: xsave: Add FP and SSE bits to x86_ext_save_areas"
* New patch: "target-i386: x86_cpu_load_features() function"
* On patch: "target-i386: Return runnability information on query-cpu-definitions"
* Added code to handle unsupported XSAVE components cleanly
* Use x86_cpu_load_features() function
Changes v2 -> v3:
* Small documentation reword
* Suggested-by: Markus Armbruster <armbru(a)redhat.com>
* Create a x86_cpu_feature_name() function, to
isolate the code that returns the property name
Changes v1 -> v2:
* Fixed documentation to say "(since 2.7)"
* Removed @runnable field, improved documentation
Example command output:
{ "return": [
{
"unavailable-features": [],
"static": false,
"name": "host"
},
{
"unavailable-features": [],
"static": false,
"name": "qemu64"
},
{
"unavailable-features": [],
"static": false,
"name": "qemu32"
},
{
"unavailable-features": ["npt", "sse4a", "3dnow", "3dnowext", "fxsr-opt", "mmxext"],
"static": false,
"name": "phenom"
},
{
"unavailable-features": [],
"static": false,
"name": "pentium3"
},
{
"unavailable-features": [],
"static": false,
"name": "pentium2"
},
{
"unavailable-features": [],
"static": false,
"name": "pentium"
},
{
"unavailable-features": [],
"static": false,
"name": "n270"
},
{
"unavailable-features": [],
"static": false,
"name": "kvm64"
},
{
"unavailable-features": [],
"static": false,
"name": "kvm32"
},
{
"unavailable-features": [],
"static": false,
"name": "coreduo"
},
{
"unavailable-features": [],
"static": false,
"name": "core2duo"
},
{
"unavailable-features": ["3dnow", "3dnowext", "mmxext"],
"static": false,
"name": "athlon"
},
{
"unavailable-features": [],
"static": false,
"name": "Westmere"
},
{
"unavailable-features": ["xgetbv1", "xsavec", "3dnowprefetch", "smap", "adx", "rdseed", "mpx", "rtm", "hle"],
"static": false,
"name": "Skylake-Client"
},
{
"unavailable-features": [],
"static": false,
"name": "SandyBridge"
},
{
"unavailable-features": [],
"static": false,
"name": "Penryn"
},
{
"unavailable-features": ["tbm", "fma4", "xop", "3dnowprefetch", "misalignsse", "sse4a"],
"static": false,
"name": "Opteron_G5"
},
{
"unavailable-features": ["fma4", "xop", "3dnowprefetch", "misalignsse", "sse4a"],
"static": false,
"name": "Opteron_G4"
},
{
"unavailable-features": ["misalignsse", "sse4a"],
"static": false,
"name": "Opteron_G3"
},
{
"unavailable-features": [],
"static": false,
"name": "Opteron_G2"
},
{
"unavailable-features": [],
"static": false,
"name": "Opteron_G1"
},
{
"unavailable-features": [],
"static": false,
"name": "Nehalem"
},
{
"unavailable-features": [],
"static": false,
"name": "IvyBridge"
},
{
"unavailable-features": ["rtm", "hle"],
"static": false,
"name": "Haswell"
},
{
"unavailable-features": [],
"static": false,
"name": "Haswell-noTSX"
},
{
"unavailable-features": [],
"static": false,
"name": "Conroe"
},
{
"unavailable-features": ["3dnowprefetch", "smap", "adx", "rdseed", "rtm", "hle"],
"static": false,
"name": "Broadwell"
},
{
"unavailable-features": ["3dnowprefetch", "smap", "adx", "rdseed"],
"static": false,
"name": "Broadwell-noTSX"
},
{
"unavailable-features": [],
"static": false,
"name": "486"
}
]}
Cc: David Hildenbrand <dahi(a)linux.vnet.ibm.com>
Cc: Michael Mueller <mimu(a)linux.vnet.ibm.com>
Cc: Christian Borntraeger <borntraeger(a)de.ibm.com>
Cc: Cornelia Huck <cornelia.huck(a)de.ibm.com>
Cc: Jiri Denemark <jdenemar(a)redhat.com>
Cc: libvir-list(a)redhat.com
Eduardo Habkost (11):
tests: Add test case for x86 feature parsing compatibility
target-i386: List CPU models using subclass list
target-i386: Disable VME by default with TCG
target-i386: Make plus_features/minus_features QOM-based
target-i386: Remove underscores from property names
target-i386: Register properties for feature aliases manually
target-i386: xsave: Add FP and SSE bits to x86_ext_save_areas
target-i386: Move warning code outside x86_cpu_filter_features()
target-i386: x86_cpu_load_features() function
qmp: Add runnability information to query-cpu-definitions
target-i386: Return runnability information on query-cpu-definitions
qapi-schema.json | 23 +-
target-i386/cpu-qom.h | 4 +
target-i386/cpu.c | 489 +++++++++++++++++++++++++-----------------
tests/test-x86-cpuid-compat.c | 39 ++++
4 files changed, 362 insertions(+), 193 deletions(-)
--
2.7.4
8 years, 1 month
[libvirt] Malicious guests and entropy pool access risks
by bancfc@openmailbox.org
Hello. While I've been enabling virtio-rng since it became available I
recently understood that without restrictions a malicious guest can
potentially starve other VMs' entropy by overusing /dev/random so I set
the rate limit.
Another question comes to mind. Does the way virtio-rng works pose a
security risk? - does it allow the guest to spy on the host's entropy
pool? (If so I'll have to disable it for untrusted VMs immediately)
8 years, 1 month
[libvirt] [PATCH 0/5] Combine various query-block json call paths
by John Ferlan
Based off a recent review and discussion regarding adding a new field
to qemuDomainDiskInfo:
http://www.redhat.com/archives/libvir-list/2016-September/msg00193.html
I decided to take the plunge and rework the query-block code in order
to combine the various ways callers return the data and well hopefully
allow for an easier "future mechanism" to call the query-block returning
just the required/requested data for any caller (with a little bit of
code wrangling).
John Ferlan (5):
qemu: Create common code for JSON "query-block" call
qemu: Split out filling of JSONGetBlockInfo data
qemu: Split out filling of JSONBlockStats data
qemu: Split out filling of JSONDiskNameLookup data
qemu: Combine the various ways to call query-block
src/qemu/qemu_monitor_json.c | 345 ++++++++++++++++++++++++-------------------
1 file changed, 193 insertions(+), 152 deletions(-)
--
2.7.4
8 years, 1 month
[libvirt] [PATCH v5 0/2] qemu/gluster: add option for tuning debug logging level
by Prasanna Kumar Kalever
This series run basic sanity and other tests:
1. make syntax-check
2. make check
3. VIR_TEST_VERBOSE=1 ./tests/qemuargv2xmltest
4. VIR_TEST_VERBOSE=1 ./tests/qemuxml2argvtest
5. VIR_TEST_VERBOSE=1 ./tests/qemucapabilitiestest
v5:
Avoild copying variable glusterDebugLevel to disk->src (virStorageSourcePtri),
instead get debug_level from cfg as per Jiri Denemark review on v4
Thanks Jirka
v4:
Address comments by peter on v3
Mostly betterments in naming variables and grouping patterns in Caps by 5
Thanks to Peter
v3:
Add patch 2/2 which address capability checks
Changed 'glusterfs_debug_level' to 'gluster_debug_level' agreeing to Peter
Made changes in libvirtd_qemu.aug
Thanks to Peter & Daniel
v2:
Modify test cases and syntax check changes as suggested by Peter in v1.
Rename qemu_gfapi_debuglevel to glusterfs_debug_level as per Daniel comments.
Fix to make debug_level changes effects on URI along with JSON.
TODO:
* changes in libvirtd_qemu.aug
Which I don't understand for now
* comment on debug_level variable in storage source
Not sure what is the right place
* Capablities check
v1:
Initial post
Prasanna Kumar Kalever (2):
qemu/gluster: add option for tuning debug logging level
qemu_capabilities: Introduce gluster specific debug capability
src/qemu/libvirtd_qemu.aug | 3 +++
src/qemu/qemu.conf | 20 ++++++++++++++++++++
src/qemu/qemu_capabilities.c | 5 +++++
src/qemu/qemu_capabilities.h | 1 +
src/qemu/qemu_command.c | 19 +++++++++++++++----
src/qemu/qemu_command.h | 1 +
src/qemu/qemu_conf.c | 3 +++
src/qemu/qemu_conf.h | 1 +
src/qemu/qemu_hotplug.c | 6 +++---
.../qemuargv2xml-disk-drive-network-gluster.args | 7 ++++---
.../qemuxml2argv-disk-drive-network-gluster.args | 12 ++++++------
tests/qemuxml2argvtest.c | 3 ++-
12 files changed, 64 insertions(+), 17 deletions(-)
--
2.7.4
8 years, 1 month
[libvirt] ruby-libvirt latest release doesn't work with fog-libvirt
by Darragh Bailey
A number of months ago it was requested whether a new ruby-libvirt release
could be made to include some new functionality that fog-libvirt wished to
make use of, see
https://www.redhat.com/archives/libvir-list/2016-March/msg00241.html.
Any update on this?
Currently any attempt to use vagrant-libvirt with fog-libvirt newer than
0.0.3 with the current release of ruby-libvirt will result in the following
error:
/home/baileybd/.vagrant.d/gems/gems/fog-libvirt-0.0.4/lib/fog/libvirt/requests/compute/dhcp_leases.rb:8:in
`dhcp_leases': NULL pointer given (ArgumentError)
from
/home/baileybd/.vagrant.d/gems/gems/fog-libvirt-0.0.4/lib/fog/libvirt/requests/compute/dhcp_leases.rb:8:in
`dhcp_leases'
from
/home/baileybd/.vagrant.d/gems/gems/fog-libvirt-0.0.4/lib/fog/libvirt/models/compute/network.rb:20:in
`dhcp_leases'
from
/home/baileybd/.vagrant.d/gems/gems/fog-libvirt-0.0.4/lib/fog/libvirt/models/compute/server.rb:272:in
`block in addresses'
from
/home/baileybd/.vagrant.d/gems/gems/fog-core-1.42.0/lib/fog/core/collection.rb:19:in
`each'
from
/home/baileybd/.vagrant.d/gems/gems/fog-core-1.42.0/lib/fog/core/collection.rb:19:in
`each'
from
/home/baileybd/.vagrant.d/gems/gems/fog-libvirt-0.0.4/lib/fog/libvirt/models/compute/server.rb:270:in
`addresses'
from
/home/baileybd/.vagrant.d/gems/gems/vagrant-libvirt-0.0.32.hp.2/lib/vagrant-libvirt/action/wait_till_up.rb:44:in
`block (3 levels) in call'
from
/home/baileybd/.vagrant.d/gems/gems/fog-core-1.42.0/lib/fog/core/model.rb:72:in
`instance_eval'
from
/home/baileybd/.vagrant.d/gems/gems/fog-core-1.42.0/lib/fog/core/model.rb:72:in
`block in wait_for'
from
/home/baileybd/.vagrant.d/gems/gems/fog-core-1.42.0/lib/fog/core/wait_for.rb:7:in
`block in wait_for'
from
/home/baileybd/.vagrant.d/gems/gems/fog-core-1.42.0/lib/fog/core/wait_for.rb:6:in
`loop'
from
/home/baileybd/.vagrant.d/gems/gems/fog-core-1.42.0/lib/fog/core/wait_for.rb:6:in
`wait_for'
from
/home/baileybd/.vagrant.d/gems/gems/fog-core-1.42.0/lib/fog/core/model.rb:69:in
`wait_for'
It appears the patch required to resolve was landed in January:
http://libvirt.org/git/?p=ruby-libvirt.git;a=commit;h=c2d4192ebf28b8030b7...
--
Darragh Bailey
"Nothing is foolproof to a sufficiently talented fool"
8 years, 1 month
[libvirt] [PATCH] Don't drop expired lease while reading custom leases file
by Nehal J Wani
Libvirt, on its own, shouldn't decide whether an expired lease should
stay in the custom leases database or not. It should rather rely on
the 'DEL' event from dnsmasq.
---
src/util/virlease.c | 8 --------
1 file changed, 8 deletions(-)
diff --git a/src/util/virlease.c b/src/util/virlease.c
index 920ebaf..b49105d 100644
--- a/src/util/virlease.c
+++ b/src/util/virlease.c
@@ -57,7 +57,6 @@ virLeaseReadCustomLeaseFile(virJSONValuePtr leases_array_new,
{
char *lease_entries = NULL;
virJSONValuePtr leases_array = NULL;
- long long currtime = 0;
long long expirytime;
int custom_lease_file_len = 0;
virJSONValuePtr lease_tmp = NULL;
@@ -66,8 +65,6 @@ virLeaseReadCustomLeaseFile(virJSONValuePtr leases_array_new,
size_t i;
int ret = -1;
- currtime = (long long) time(NULL);
-
/* Read entire contents */
if ((custom_lease_file_len = virFileReadAll(custom_lease_file,
VIR_NETWORK_DHCP_LEASE_FILE_SIZE_MAX,
@@ -109,11 +106,6 @@ virLeaseReadCustomLeaseFile(virJSONValuePtr leases_array_new,
_("failed to parse json"));
goto cleanup;
}
- /* Check whether lease has expired or not */
- if (expirytime < currtime) {
- i++;
- continue;
- }
/* Check whether lease has to be included or not */
if (ip_to_delete && STREQ(ip_tmp, ip_to_delete)) {
--
2.7.4
8 years, 1 month
[libvirt] [PATCH] NSS: Add explicit check to not report expired lease
by Nehal J Wani
The NSS module shouldn't rely on custom leases database to not have
entries for leases which have expired.
---
tools/nss/libvirt_nss.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/tools/nss/libvirt_nss.c b/tools/nss/libvirt_nss.c
index 54c4a2a..57ba473 100644
--- a/tools/nss/libvirt_nss.c
+++ b/tools/nss/libvirt_nss.c
@@ -42,6 +42,7 @@
#include "virlease.h"
#include "viralloc.h"
#include "virfile.h"
+#include "virtime.h"
#include "virerror.h"
#include "virstring.h"
#include "virsocketaddr.h"
@@ -114,6 +115,8 @@ findLease(const char *name,
ssize_t i, nleases;
leaseAddress *tmpAddress = NULL;
size_t ntmpAddress = 0;
+ long long currtime = 0;
+ long long expirytime = -1;
*address = NULL;
*naddress = 0;
@@ -161,6 +164,8 @@ findLease(const char *name,
nleases = virJSONValueArraySize(leases_array);
DEBUG("Read %zd leases", nleases);
+ currtime = (long long) time(NULL);
+
for (i = 0; i < nleases; i++) {
virJSONValuePtr lease;
const char *lease_name;
@@ -181,6 +186,16 @@ findLease(const char *name,
if (STRNEQ_NULLABLE(name, lease_name))
continue;
+ if (virJSONValueObjectGetNumberLong(lease, "expiry-time", &expirytime) < 0) {
+ /* A lease cannot be present without expiry-time */
+ ERROR("expiry-time field missing for %s", name);
+ goto cleanup;
+ }
+
+ /* Do not report expired lease */
+ if (expirytime < currtime)
+ continue;
+
DEBUG("Found record for %s", lease_name);
*found = true;
--
2.7.4
8 years, 1 month
[libvirt] [PATCH v2]Pre-assign memory modules slot number and assign alias.
by Nitesh Konkar
Find the smallest missing slot number and
pre-assign slot numbers and assign aliases
of memory modules. This keeps the slot number
consistent with the alias.
Signed-off-by: Nitesh Konkar <nitkon12(a)linux.vnet.ibm.com>
---
src/qemu/qemu_alias.c | 54 +++++++++++++++++++++++++++++++++++++++----------
src/qemu/qemu_command.c | 5 ++++-
2 files changed, 47 insertions(+), 12 deletions(-)
diff --git a/src/qemu/qemu_alias.c b/src/qemu/qemu_alias.c
index cc83fec..cdca69a 100644
--- a/src/qemu/qemu_alias.c
+++ b/src/qemu/qemu_alias.c
@@ -331,23 +331,49 @@ qemuAssignDeviceRNGAlias(virDomainDefPtr def,
return 0;
}
+static int
+qemuGetSmallestSlotIdx(virDomainDefPtr def)
+{
+ size_t i;
+ int idx = 0;
+ int minidx = 0;
+ bool check[100] = {false};
+
+ /* Find the missing slot */
+ for (i = 0; i < def->nmems; i++) {
+ idx = qemuDomainDeviceAliasIndex(&def->mems[i]->info, "dimm");
+ check[idx] = true;
+ }
+
+ for (i = 0; i < def->nmems; i++) {
+ if (!check[i]) {
+ minidx = i;
+ break;
+ }
+ }
+
+ if (i >= def->nmems)
+ minidx = i;
+
+ return minidx;
+}
int
qemuAssignDeviceMemoryAlias(virDomainDefPtr def,
virDomainMemoryDefPtr mem)
{
- size_t i;
- int maxidx = 0;
- int idx;
+ int minidx;
- for (i = 0; i < def->nmems; i++) {
- if ((idx = qemuDomainDeviceAliasIndex(&def->mems[i]->info, "dimm")) >= maxidx)
- maxidx = idx + 1;
- }
+ if (mem->info.addr.dimm.base)
+ minidx = mem->info.addr.dimm.slot;
+ else
+ minidx = qemuGetSmallestSlotIdx(def);
- if (virAsprintf(&mem->info.alias, "dimm%d", maxidx) < 0)
+ if (virAsprintf(&mem->info.alias, "dimm%d", minidx) < 0)
return -1;
+ mem->info.addr.dimm.slot = minidx;
+
return 0;
}
@@ -381,7 +407,6 @@ qemuAssignDeviceShmemAlias(virDomainDefPtr def,
return 0;
}
-
int
qemuAssignDeviceAliases(virDomainDefPtr def, virQEMUCapsPtr qemuCaps)
{
@@ -475,8 +500,15 @@ qemuAssignDeviceAliases(virDomainDefPtr def, virQEMUCapsPtr qemuCaps)
return -1;
}
for (i = 0; i < def->nmems; i++) {
- if (virAsprintf(&def->mems[i]->info.alias, "dimm%zu", i) < 0)
- return -1;
+ def->mems[i]->info.type = VIR_DOMAIN_DEVICE_ADDRESS_TYPE_DIMM;
+ if (def->mems[i]->info.addr.dimm.base) {
+ if (virAsprintf(&def->mems[i]->info.alias, "dimm%d", def->mems[i]->info.addr.dimm.slot) < 0)
+ return -1;
+ } else {
+ def->mems[i]->info.addr.dimm.slot = i;
+ if (virAsprintf(&def->mems[i]->info.alias, "dimm%zu", i) < 0)
+ return -1;
+ }
}
return 0;
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index f24a98b..e236918 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -3469,8 +3469,11 @@ qemuBuildMemoryDeviceStr(virDomainMemoryDefPtr mem)
mem->info.alias, mem->info.alias);
if (mem->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_DIMM) {
+ if (mem->info.addr.dimm.base)
+ virBufferAsprintf(&buf, ",addr=%llu", mem->info.addr.dimm.base);
+
virBufferAsprintf(&buf, ",slot=%d", mem->info.addr.dimm.slot);
- virBufferAsprintf(&buf, ",addr=%llu", mem->info.addr.dimm.base);
+
}
break;
--
1.9.3
8 years, 1 month
[libvirt] [PATCH] Fix Typo.
by Nitesh Konkar
Signed-off-by: Nitesh Konkar <nitkon12(a)linux.vnet.ibm.com>
---
src/libvirt-nodedev.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/libvirt-nodedev.c b/src/libvirt-nodedev.c
index 6ea14b3..bba9768 100644
--- a/src/libvirt-nodedev.c
+++ b/src/libvirt-nodedev.c
@@ -488,7 +488,7 @@ virNodeDeviceRef(virNodeDevicePtr dev)
* virNodeDeviceDettach:
* @dev: pointer to the node device
*
- * Dettach the node device from the node itself so that it may be
+ * Detach the node device from the node itself so that it may be
* assigned to a guest domain.
*
* Depending on the hypervisor, this may involve operations such
--
2.1.0
8 years, 1 month
[libvirt] [PATCH 0/7] qemu: vcpu coldplug and ordering fixes
by Peter Krempa
Few fixes for various isues connected to coldplug and vcpu order.
Peter Krempa (7):
qemu: process: Fix off-by-one in vcpu order duplicate error message
qemu: process: Don't use shifted indexes for vcpu order verification
qemu: process: Enforce 'vcpu' order range to <1,maxvcpus>
qemu: Fix coldplug of vcpus
qemu: vcpu: Clear vcpu order information rather than making it invalid
lib: Introduce VIR_DOMAIN_VCPU_HOTPLUGGABLE for virDomainSetVcpusFlags
qemu: Allow making vcpus hotpluggable with virDomainSetVcpusFlags
docs/formatdomain.html.in | 3 +-
include/libvirt/libvirt-domain.h | 1 +
src/conf/domain_conf.c | 10 ++++++
src/conf/domain_conf.h | 1 +
src/libvirt_private.syms | 1 +
src/qemu/qemu_driver.c | 76 +++++++++++++++++++++++++++++++++++++---
src/qemu/qemu_process.c | 14 +++++---
tools/virsh-domain.c | 7 ++++
tools/virsh.pod | 7 +++-
9 files changed, 108 insertions(+), 12 deletions(-)
--
2.10.0
8 years, 1 month