[libvirt] problems with current libvirt and qemu-kvm
by Gene Czarcinski
When I rebased my DHCPv6, etc. patches, I did that not only on to of
Laine Stump's dnsmasq-capabiliotes/bind-dynamic updates but I also
rebased to "current" git master.
Well, the problem with the large number/frequent RTR-ADVERT syslog
messages from dnsmasq that I had previously seen were fixed ... they
stopped and dnsmasq produced expected results. But, starting
virt-manager hung and there were new error messages in syslog about
"internal error cannot find suitable emulator for X86_64.
So I downgraded to a previous version that I knew worked and it did but
my RTR-ADVERT messages are back. The "good" version uses a tarball
created from git on November 19th and the "bad" version has a tarball
created from git on November 29th.
OK, before I start shuffling through the patches applied between those
two date, does anyone have an idea what patches might be "guilty" ...
for both issues ... fixing the RTR-ADVERT problem and giving
libvirtd/qemu-kvm indigestion?
I am not griping. When you run on the "leading edge", you expect a few
arrows in your back.
Any suggesting on testing will also be appreciated.
Gene
11 years, 12 months
[libvirt] Next release planning
by Daniel Veillard
Reminder, we are shooting for 1.0.1 release by mid December.
I will be away next week and probably out of reach, and it looks
unlikely i will have the bandwidth to start the freeze before Monday
10 possibly Tuesday 11. So there is a bit more than a week to push
API and features for 1.0.1. Then 1.0.2 will occur at the end of January.
Daniel
--
Daniel Veillard | Open Source and Standards, Red Hat
veillard(a)redhat.com | libxml Gnome XML XSLT toolkit http://xmlsoft.org/
http://veillard.com/ | virtualization library http://libvirt.org/
11 years, 12 months
[libvirt] [PATCH 0/2] Last two coverity patches
by Ján Tomko
tools/virsh-pool.c: CHECKED_RETURN
src/nwfilter/nwfilter_driver.c: UNREACHABLE
Ján Tomko (2):
virsh: check the return value of virStoragePoolGetAutostart
nwfilter: fix error handling
src/nwfilter/nwfilter_driver.c | 11 +++++------
tools/virsh-pool.c | 5 +----
2 files changed, 6 insertions(+), 10 deletions(-)
--
1.7.8.6
11 years, 12 months
[libvirt] [PATCH] Move reboot/shutdown flags combination check into QEMU driver
by Daniel P. Berrange
From: "Daniel P. Berrange" <berrange(a)redhat.com>
The fact that only the guest agent, or ACPI flag can be used
when requesting reboot/shutdown is merely a limitation of the
QEMU driver impl at this time. Thus it should not be in
libvirt.c code
Signed-off-by: Daniel P. Berrange <berrange(a)redhat.com>
---
src/libvirt.c | 16 ----------------
src/qemu/qemu_driver.c | 16 ++++++++++++++++
2 files changed, 16 insertions(+), 16 deletions(-)
diff --git a/src/libvirt.c b/src/libvirt.c
index 757bfa8..d5310ed 100644
--- a/src/libvirt.c
+++ b/src/libvirt.c
@@ -3260,14 +3260,6 @@ virDomainShutdownFlags(virDomainPtr domain, unsigned int flags)
goto error;
}
- /* At most one of these two flags should be set. */
- if ((flags & VIR_DOMAIN_SHUTDOWN_ACPI_POWER_BTN) &&
- (flags & VIR_DOMAIN_SHUTDOWN_GUEST_AGENT)) {
- virReportInvalidArg(flags, "%s",
- _("flags for acpi power button and guest agent are mutually exclusive"));
- goto error;
- }
-
conn = domain->conn;
if (conn->driver->domainShutdownFlags) {
@@ -3322,14 +3314,6 @@ virDomainReboot(virDomainPtr domain, unsigned int flags)
goto error;
}
- /* At most one of these two flags should be set. */
- if ((flags & VIR_DOMAIN_REBOOT_ACPI_POWER_BTN) &&
- (flags & VIR_DOMAIN_REBOOT_GUEST_AGENT)) {
- virReportInvalidArg(flags, "%s",
- _("flags for acpi power button and guest agent are mutually exclusive"));
- goto error;
- }
-
conn = domain->conn;
if (conn->driver->domainReboot) {
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index c37bdb9..6a8a333 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -1814,6 +1814,14 @@ static int qemuDomainShutdownFlags(virDomainPtr dom, unsigned int flags) {
virCheckFlags(VIR_DOMAIN_SHUTDOWN_ACPI_POWER_BTN |
VIR_DOMAIN_SHUTDOWN_GUEST_AGENT, -1);
+ /* At most one of these two flags should be set. */
+ if ((flags & VIR_DOMAIN_SHUTDOWN_ACPI_POWER_BTN) &&
+ (flags & VIR_DOMAIN_SHUTDOWN_GUEST_AGENT)) {
+ virReportInvalidArg(flags, "%s",
+ _("flags for acpi power button and guest agent are mutually exclusive"));
+ return -1;
+ }
+
qemuDriverLock(driver);
vm = virDomainFindByUUID(&driver->domains, dom->uuid);
qemuDriverUnlock(driver);
@@ -1896,6 +1904,14 @@ qemuDomainReboot(virDomainPtr dom, unsigned int flags)
virCheckFlags(VIR_DOMAIN_REBOOT_ACPI_POWER_BTN |
VIR_DOMAIN_REBOOT_GUEST_AGENT , -1);
+ /* At most one of these two flags should be set. */
+ if ((flags & VIR_DOMAIN_REBOOT_ACPI_POWER_BTN) &&
+ (flags & VIR_DOMAIN_REBOOT_GUEST_AGENT)) {
+ virReportInvalidArg(flags, "%s",
+ _("flags for acpi power button and guest agent are mutually exclusive"));
+ return -1;
+ }
+
qemuDriverLock(driver);
vm = virDomainFindByUUID(&driver->domains, dom->uuid);
qemuDriverUnlock(driver);
--
1.7.11.7
11 years, 12 months
[libvirt] [test-API][PATCH v4] Add test case of set vcpus with flags
by Wayne Sun
v2: break down the case to small cases with separate flags
* Use setVcpusFlags API to set domain vcpus with flags
* 3 cases added, each only deal with one set flag value as in
config, live or maximum
* cases are independent on domain states, API will report error
if not suitable for certain states
* the sample conf is only one scenario of hotplug domain vcpus
v3: merge config and maximum case to config
* maximum flag can only work when domain is shutoff, merge it
to config case to simplify code
v4: make both vcpu and maxvcpu as optional param in config case
* depend on the given params to select flags and setting
Signed-off-by: Wayne Sun <gsun(a)redhat.com>
---
cases/set_vcpus_flags.conf | 67 ++++++++++++++++++++++++
repos/setVcpus/set_vcpus_config.py | 99 ++++++++++++++++++++++++++++++++++++
repos/setVcpus/set_vcpus_live.py | 96 ++++++++++++++++++++++++++++++++++
3 files changed, 262 insertions(+), 0 deletions(-)
create mode 100644 cases/set_vcpus_flags.conf
create mode 100644 repos/setVcpus/__init__.py
create mode 100644 repos/setVcpus/set_vcpus_config.py
create mode 100644 repos/setVcpus/set_vcpus_live.py
diff --git a/cases/set_vcpus_flags.conf b/cases/set_vcpus_flags.conf
new file mode 100644
index 0000000..6cf595f
--- /dev/null
+++ b/cases/set_vcpus_flags.conf
@@ -0,0 +1,67 @@
+domain:install_linux_cdrom
+ guestname
+ $defaultname
+ guestos
+ $defaultos
+ guestarch
+ $defaultarch
+ vcpu
+ $defaultvcpu
+ memory
+ $defaultmem
+ hddriver
+ $defaulthd
+ nicdriver
+ $defaultnic
+ imageformat
+ qcow2
+
+domain:destroy
+ guestname
+ $defaultname
+
+setVcpus:set_vcpus_config
+ guestname
+ $defaultname
+ vcpu
+ 1
+ maxvcpu
+ 8
+
+domain:start
+ guestname
+ $defaultname
+
+setVcpus:set_vcpus_live
+ guestname
+ $defaultname
+ vcpu
+ 3
+ username
+ $username
+ password
+ $password
+
+setVcpus:set_vcpus_config
+ guestname
+ $defaultname
+ vcpu
+ 5
+
+domain:destroy
+ guestname
+ $defaultname
+
+domain:start
+ guestname
+ $defaultname
+
+domain:destroy
+ guestname
+ $defaultname
+
+domain:undefine
+ guestname
+ $defaultname
+
+options cleanup=enable
diff --git a/repos/setVcpus/__init__.py b/repos/setVcpus/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/repos/setVcpus/set_vcpus_config.py b/repos/setVcpus/set_vcpus_config.py
new file mode 100644
index 0000000..289dad1
--- /dev/null
+++ b/repos/setVcpus/set_vcpus_config.py
@@ -0,0 +1,99 @@
+#!/usr/bin/env python
+# Test set domain vcpu with flag VIR_DOMAIN_AFFECT_CONFIG or
+# VIR_DOMAIN_VCPU_MAXIMUM, depend on which optional param is
+# given.
+
+from xml.dom import minidom
+
+import libvirt
+from libvirt import libvirtError
+
+from src import sharedmod
+
+required_params = ('guestname', )
+optional_params = {'vcpu': 1,
+ 'maxvcpu': 8,
+ }
+
+def get_vcpu_number(domobj):
+ """dump domain config xml description to get vcpu number, return
+ current vcpu and maximum vcpu number
+ """
+ try:
+ guestxml = domobj.XMLDesc(2)
+ logger.debug("domain %s xml is :\n%s" %(domobj.name(), guestxml))
+ xml = minidom.parseString(guestxml)
+ vcpu = xml.getElementsByTagName('vcpu')[0]
+ maxvcpu = int(vcpu.childNodes[0].data)
+ logger.info("domain max vcpu number is: %s" % maxvcpu)
+
+ if vcpu.hasAttribute('current'):
+ attr = vcpu.getAttributeNode('current')
+ current = int(attr.nodeValue)
+ else:
+ logger.info("no 'current' atrribute for element vcpu")
+ current = int(vcpu.childNodes[0].data)
+
+ logger.info("domain current vcpu number is: %s" % current)
+
+ except libvirtError, e:
+ logger.error("libvirt call failed: " + str(e))
+ return False
+
+ return current, maxvcpu
+
+def set_vcpus_config(params):
+ """set domain vcpu with config flag and check, also set and check
+ max vcpu with maximum flag if optional param maxvcpu is given
+ """
+ global logger
+ logger = params['logger']
+ params.pop('logger')
+ guestname = params['guestname']
+ vcpu = params.get('vcpu', None)
+ maxvcpu = params.get('maxvcpu', None)
+
+ logger.info("the name of virtual machine is %s" % guestname)
+ if vcpu == None and maxvcpu == None:
+ logger.error("at least one of vcpu or maxvcpu should be provided")
+ return 1
+
+ conn = sharedmod.libvirtobj['conn']
+
+ try:
+ domobj = conn.lookupByName(guestname)
+ if vcpu:
+ logger.info("the given vcpu number is %s" % vcpu)
+ logger.info("set domain vcpu as %s with flag: %s" %
+ (vcpu, libvirt.VIR_DOMAIN_AFFECT_CONFIG))
+ domobj.setVcpusFlags(int(vcpu), libvirt.VIR_DOMAIN_AFFECT_CONFIG)
+ logger.info("set domain vcpu succeed")
+
+ if maxvcpu:
+ logger.info("the given max vcpu number is %s" % maxvcpu)
+ logger.info("set domain maximum vcpu as %s with flag: %s" %
+ (maxvcpu, libvirt.VIR_DOMAIN_VCPU_MAXIMUM))
+ domobj.setVcpusFlags(int(maxvcpu), libvirt.VIR_DOMAIN_VCPU_MAXIMUM)
+ logger.info("set domain vcpu succeed")
+
+ except libvirtError, e:
+ logger.error("libvirt call failed: " + str(e))
+ return 1
+
+ logger.info("check domain config xml to get vcpu number")
+ ret = get_vcpu_number(domobj)
+ if vcpu:
+ if ret[0] == int(vcpu):
+ logger.info("domain current vcpu is equal as set")
+ else:
+ logger.error("domain current vcpu is not equal as set")
+ return 1
+
+ if maxvcpu:
+ if ret[1] == int(maxvcpu):
+ logger.info("domain max vcpu is equal as set")
+ else:
+ logger.error("domain max vcpu is not equal as set")
+ return 1
+
+ return 0
diff --git a/repos/setVcpus/set_vcpus_live.py b/repos/setVcpus/set_vcpus_live.py
new file mode 100644
index 0000000..35a2976
--- /dev/null
+++ b/repos/setVcpus/set_vcpus_live.py
@@ -0,0 +1,96 @@
+#!/usr/bin/env python
+# Test set domain vcpu with flag VIR_DOMAIN_VCPU_LIVE. Check
+# domain xml and inside domain to get current vcpu number. The
+# live flag only work on running domain, so test on shutoff
+# domain will fail.
+
+from xml.dom import minidom
+
+import libvirt
+from libvirt import libvirtError
+
+from src import sharedmod
+from utils import utils
+
+required_params = ('guestname', 'vcpu', 'username', 'password', )
+optional_params = {}
+
+def get_current_vcpu(domobj, username, password):
+ """dump domain live xml description to get current vcpu number
+ and check in domain to confirm
+ """
+ try:
+ guestxml = domobj.XMLDesc(1)
+ guestname = domobj.name()
+ logger.debug("domain %s xml is :\n%s" %(guestname, guestxml))
+ xml = minidom.parseString(guestxml)
+ vcpu = xml.getElementsByTagName('vcpu')[0]
+
+ if vcpu.hasAttribute('current'):
+ attr = vcpu.getAttributeNode('current')
+ current = int(attr.nodeValue)
+ else:
+ logger.info("no 'current' atrribute for element vcpu")
+ current = int(vcpu.childNodes[0].data)
+
+ logger.info("domain current vcpu number in live xml is: %s" % current)
+
+ except libvirtError, e:
+ logger.error("libvirt call failed: " + str(e))
+ return False
+
+ logger.debug("get the mac address of vm %s" % guestname)
+ mac = utils.get_dom_mac_addr(guestname)
+ logger.debug("the mac address of vm %s is %s" % (guestname, mac))
+
+ logger.info("check cpu number in domain")
+ ip = utils.mac_to_ip(mac, 180)
+
+ cmd = "cat /proc/cpuinfo | grep processor | wc -l"
+ ret, output = utils.remote_exec_pexpect(ip, username, password, cmd)
+ if not ret:
+ logger.info("cpu number in domain is %s" % output)
+ if int(output) == current:
+ logger.info("cpu in domain is equal to current vcpu value")
+ else:
+ logger.error("current vcpu is not equal as check in domain")
+ return False
+ else:
+ logger.error("check in domain fail")
+ return False
+
+ return current
+
+def set_vcpus_live(params):
+ """set domain vcpu with live flag and check
+ """
+ global logger
+ logger = params['logger']
+ params.pop('logger')
+ guestname = params['guestname']
+ vcpu = int(params['vcpu'])
+ username = params['username']
+ password = params['password']
+
+ logger.info("the name of virtual machine is %s" % guestname)
+ logger.info("the given vcpu number is %s" % vcpu)
+
+ conn = sharedmod.libvirtobj['conn']
+
+ try:
+ domobj = conn.lookupByName(guestname)
+ logger.info("set domain vcpu as %s with flag: %s" %
+ (vcpu, libvirt.VIR_DOMAIN_VCPU_LIVE))
+ domobj.setVcpusFlags(vcpu, libvirt.VIR_DOMAIN_VCPU_LIVE)
+ except libvirtError, e:
+ logger.error("libvirt call failed: " + str(e))
+ return 1
+
+ logger.info("check domain vcpu")
+ ret = get_current_vcpu(domobj, username, password)
+ if ret == vcpu:
+ logger.info("domain vcpu is equal as set")
+ return 0
+ else:
+ logger.error("domain vcpu is not equal as set")
+ return 1
--
1.7.1
11 years, 12 months
[libvirt] [PATCH 0/2] Clean up qemu driver configuration parser.
by Peter Krempa
Done while hacking on other series (that is not yet ready).
Peter Krempa (2):
qemu: Refactor config parameter retrieval
qemu: Refactor error reporting in qemu driver configuration parser
src/qemu/qemu_conf.c | 479 +++++++++++++++------------------------------------
1 file changed, 142 insertions(+), 337 deletions(-)
--
1.8.0
11 years, 12 months
[libvirt] [PATCHv3 0/3] network: resolve CVE 2012-3411
by Laine Stump
(This obsoletes the V2 patches I sent yesterday:
https://www.redhat.com/archives/libvir-list/2012-November/msg01216.html )
This patch series resolves the libvirt part of CVE 2012-3411:
https://bugzilla.redhat.com/show_bug.cgi?id=833033
Further details are in PATCH 3/3.
The changes from V1 to V3: (resulting from Doug Goldstein's review,
and a comment in the BZ record from the CVE reporter, David Woodhouse)
1) rework dnsmasqCapsRefresh() to create a new caps object if it's
given a NULL object (function now gets dnsmasqCapsPtr* instead of
dnsmasCapsPtr). This makes it possible to recover properly if dnsmasq
is installed after libvirtd has already been started.
2) Add the following before each run of dnsmasq:
virCommandAddEnvPassCommon(cmd);
virCommandClearCaps(cmd);
3) Fixed a missing space after comma :-)
4) remove empty if () { } around initial call to
dnsmasqCapsNewFromBinary() in bridge_driver.c
5) include FEC0::/10 as a "local" range when checking for private
addresses to allow in the absence of an updated dnsmasq.
11 years, 12 months
[libvirt] [PATCH 0/3] IPv6 enhancements; put dnsmasq parameters in conf-file
by Gene Czarcinski
These three patch files are packaged together because they serially
depend on each other. These files have been rebased to "v3" of
the dnsmasq capabilities and bind-dynamic patches.
The DHCPv6 support checks dnsmasq's version and requires a minimum of 2.64.
Also, using dnsmasq for providing the RA service is checked against the
dnsmasq version and is currently 2.64.
As with IPv4, IPv6 DHCP is only one subnetwork on an interface. Additionally,
if other IPv6 addresses are defined, a warning message is issued since
the Router Advertisement service will support only state-full (DHCP) or
state-less (SLAAC) addressing on a network interface (not both). Thus, the
additional subnetworks will need to be manually configured to properly function.
If dnsmasq provides the RA service, it also points to itself as a RDNSS
(Recursive DNS Server) as part of the information is supplies.
If IPv6 DHCP is not being run, then SLAAC addressing is supported for
any IPv6 addresses specified.
Gene Czarcinski (3):
v1: allow guest to guest IPv6 without gateway definition
v8.1 add support for DHCPv6
v7.9: put dnsmasq parameters into conf-file
docs/formatnetwork.html.in | 126 ++++-
docs/schemas/network.rng | 12 +-
src/conf/network_conf.c | 100 ++--
src/network/bridge_driver.c | 590 ++++++++++++++-------
src/network/bridge_driver.h | 7 +-
src/util/dnsmasq.c | 9 +-
tests/networkxml2argvdata/dhcp6-nat-network.argv | 14 +
tests/networkxml2argvdata/dhcp6-nat-network.xml | 24 +
tests/networkxml2argvdata/dhcp6-network.argv | 14 +
tests/networkxml2argvdata/dhcp6-network.xml | 14 +
.../dhcp6host-routed-network.argv | 12 +
.../dhcp6host-routed-network.xml | 19 +
tests/networkxml2argvdata/isolated-network.argv | 25 +-
.../networkxml2argvdata/nat-network-dns-hosts.argv | 14 +-
.../nat-network-dns-srv-record-minimal.argv | 34 +-
.../nat-network-dns-srv-record.argv | 24 +-
.../nat-network-dns-txt-record.argv | 22 +-
tests/networkxml2argvdata/nat-network.argv | 22 +-
tests/networkxml2argvdata/netboot-network.argv | 28 +-
.../networkxml2argvdata/netboot-proxy-network.argv | 26 +-
tests/networkxml2argvdata/routed-network.argv | 11 +-
tests/networkxml2argvtest.c | 47 +-
22 files changed, 838 insertions(+), 356 deletions(-)
create mode 100644 tests/networkxml2argvdata/dhcp6-nat-network.argv
create mode 100644 tests/networkxml2argvdata/dhcp6-nat-network.xml
create mode 100644 tests/networkxml2argvdata/dhcp6-network.argv
create mode 100644 tests/networkxml2argvdata/dhcp6-network.xml
create mode 100644 tests/networkxml2argvdata/dhcp6host-routed-network.argv
create mode 100644 tests/networkxml2argvdata/dhcp6host-routed-network.xml
--
1.7.11.7
11 years, 12 months
[libvirt] [PATCH 0/6] More coverity issues
by Ján Tomko
REVERSE_INULL, SIZEOF_MISMATCH and some uninitialized variables.
Ján Tomko (6):
conf: fix NULL check in virNetDevBandwidthParse
util: fix virBitmap allocation in virProcessInfoGetAffinity
virsh: use correct sizeof when allocating cpumap
virsh: do timing even for unusable connections
rpc: don't destroy xdr before creating it in
virNetMessageEncodeHeader
conf: fix uninitialized variable in virDomainListSnapshots
src/conf/netdev_bandwidth_conf.c | 4 +++-
src/conf/snapshot_conf.c | 2 +-
src/rpc/virnetmessage.c | 2 +-
src/util/processinfo.c | 2 +-
tools/virsh-domain.c | 4 ++--
tools/virsh.c | 12 ++++++------
6 files changed, 14 insertions(+), 12 deletions(-)
--
1.7.8.6
11 years, 12 months