[libvirt] [PATCH 0/5] qemu: report actual vcpu state in virVcpuInfo
by Viktor Mihajlovski
Currently, the virVcpuInfo returned by virDomainGetVcpus() will always
report a state of VIR_VCPU_RUNNING for each defined domain vcpu even if
the vcpu is currently in the halted state.
As the monitor interface is in fact reporting the accurate state, it is
rather easy to transport this information with the existing API.
This is done by
- adding a new state of VIR_VCPU_HALTED
- adding a monitor function to pass back the halted state for the vcpus
- adding a new field to the private domain vcpu object reflecting the
halted state for the vcpu
- modifying the driver code to report the vcpu state based on the halted
indicator
- extending virsh vcpuinfo to also display the halted state
The vcpu state is however not recorded in the internal XML format, since
the state can change asynchronously (without notification).
Viktor Mihajlovski (5):
domain: Add new VCPU state "halted"
qemu: Add monitor APIs for the detection of halted VCPUs
tests: Add testcase for qemuMonitorJSONGetCPUState
qemu: Add domain support for VCPU halted state
qemu: Ensure reported VCPU state is current in driver API
include/libvirt/libvirt-domain.h | 1 +
src/qemu/qemu_domain.c | 82 ++++++++++++++++++++++++++++++
src/qemu/qemu_domain.h | 4 ++
src/qemu/qemu_driver.c | 23 ++++++++-
src/qemu/qemu_monitor.c | 22 ++++++++
src/qemu/qemu_monitor.h | 2 +
src/qemu/qemu_monitor_json.c | 52 +++++++++++++++++--
src/qemu/qemu_monitor_json.h | 2 +
src/qemu/qemu_monitor_text.c | 54 ++++++++++++++++----
src/qemu/qemu_monitor_text.h | 2 +
tests/qemumonitorjsontest.c | 106 ++++++++++++++++++++++++---------------
tools/virsh-domain.c | 3 +-
12 files changed, 295 insertions(+), 58 deletions(-)
--
1.9.1
8 years, 3 months
[libvirt] [PATCH 00/13] Move functions from qemu_domain_address.c to domain_addr.c
by Tomasz Flendrich
This series depends on another one:
https://www.redhat.com/archives/libvir-list/2016-July/msg00696.html
Because the address sets are no longer cached, it's possible to move
functions that don't depend on qemu anymore from qemu_domain_address.c
to domain_addr.c. I did that with virtioSerial and PCI.
To make some functions not dependent on qemuCaps, their parameters
were changed to booleans. These changes are in [PATCH 02/13].
If you are satisfied with this approach, I can do the same with
the rest of the functions or just some of them.
Tomasz Flendrich (13):
Move and rename qemuDomainAssignVirtioSerialAddresses
make pci address handling functions qemu-agnostic
Move and rename qemuDomainCollectPCIAddress
Move and rename qemuDomainMachineIsQ35 et al
Move and rename qemuDomainValidateDevicePCISlotsPIIX3
Move and rename qemuDomainValidateDevicePCISlotsQ35
Move and rename qemuDomainValidateDevicePCISlotsChipsets
Move and rename qemuDomainAddressFindNewBusNr et al
Move and rename qemuDomainMachineIsVirt
Move and rename qemuDomainSupportsPCI
Move and rename qemuDomainPCIAddrSetCreateFromDomain
Move and rename qemuDomainAssignPCIAddresses et al
Make functions in qemu_domain_address static
src/conf/domain_addr.c | 1315 ++++++++++++++++++++++++++++++++++++++++
src/conf/domain_addr.h | 28 +
src/libvirt_private.syms | 6 +
src/qemu/qemu_alias.c | 2 +-
src/qemu/qemu_capabilities.c | 6 +-
src/qemu/qemu_command.c | 20 +-
src/qemu/qemu_domain.c | 55 +-
src/qemu/qemu_domain.h | 3 -
src/qemu/qemu_domain_address.c | 1284 +--------------------------------------
src/qemu/qemu_domain_address.h | 4 -
src/qemu/qemu_hotplug.c | 33 +-
11 files changed, 1406 insertions(+), 1350 deletions(-)
--
2.7.4 (Apple Git-66)
8 years, 3 months
[libvirt] [gconfig v2 0/2] Add host setters
by Visarion Alexandru
From: Visarion Alexandru <viorel.visarion(a)gmail.com>
These new patches are a bit different than the last ones.
I first delete the <listen address=""> child node and
then I modify the <listen> attribute.
Visarion Alexandru (2):
config: Add vnc host setter
config: Add spice host setter
libvirt-gconfig/libvirt-gconfig-domain-graphics-spice.c | 10 ++++++++++
libvirt-gconfig/libvirt-gconfig-domain-graphics-spice.h | 3 +++
libvirt-gconfig/libvirt-gconfig-domain-graphics-vnc.c | 9 +++++++++
libvirt-gconfig/libvirt-gconfig-domain-graphics-vnc.h | 3 +++
libvirt-gconfig/libvirt-gconfig.sym | 2 ++
5 files changed, 27 insertions(+)
--
2.7.4
8 years, 3 months
[libvirt] [PATCH] conf: Catch invalid memory model earlier
by Michal Privoznik
Consider the following XML snippet:
<memory model=''>
<target>
<size unit='KiB'>523264</size>
<node>0</node>
</target>
</memory>
Whats wrong you ask? The @model attribute. This should result in
an error thrown into users faces during virDomainDefine phase.
Except it doesn't. The XML validation catches this error, but if
users chose to ignore that, they will end up with invalid XML.
Well, they won't be able to start the machine - that's when error
is produced currently. But it would be nice if we could catch the
error like this earlier.
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
src/conf/domain_conf.c | 2 +-
src/qemu/qemu_command.c | 2 --
src/qemu/qemu_domain.c | 2 --
3 files changed, 1 insertion(+), 5 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index c1ddb5a..a56e0f5 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -13215,7 +13215,7 @@ virDomainMemoryDefParseXML(xmlNodePtr memdevNode,
goto error;
}
- if ((def->model = virDomainMemoryModelTypeFromString(tmp)) < 0) {
+ if ((def->model = virDomainMemoryModelTypeFromString(tmp)) <= 0) {
virReportError(VIR_ERR_XML_ERROR,
_("invalid memory model '%s'"), tmp);
goto error;
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index c4da8b5..5325f48 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -3397,8 +3397,6 @@ qemuBuildMemoryDeviceStr(virDomainMemoryDefPtr mem)
case VIR_DOMAIN_MEMORY_MODEL_NONE:
case VIR_DOMAIN_MEMORY_MODEL_LAST:
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("invalid memory device type"));
break;
}
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index b3ca993..9b439df 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -5183,8 +5183,6 @@ qemuDomainDefValidateMemoryHotplugDevice(const virDomainMemoryDef *mem,
case VIR_DOMAIN_MEMORY_MODEL_NONE:
case VIR_DOMAIN_MEMORY_MODEL_LAST:
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("invalid memory device type"));
return -1;
}
--
2.8.4
8 years, 3 months
[libvirt] [PATCH python] allow pkg-config binary to be set by env
by Cole Robinson
From: Markus Rothe <markusr815(a)gmail.com>
https://bugzilla.redhat.com/show_bug.cgi?id=1350523
---
setup.py | 2 ++
1 file changed, 2 insertions(+)
diff --git a/setup.py b/setup.py
index 099b1e0..a4cfb88 100755
--- a/setup.py
+++ b/setup.py
@@ -28,6 +28,8 @@ _pkgcfg = -1
def get_pkgcfg(do_fail=True):
global _pkgcfg
if _pkgcfg == -1:
+ _pkgcfg = os.getenv('PKG_CONFIG')
+ if _pkgcfg is None:
_pkgcfg = distutils.spawn.find_executable("pkg-config")
if _pkgcfg is None and do_fail:
raise Exception("pkg-config binary is required to compile libvirt-python")
--
2.7.4
8 years, 3 months
[libvirt] [gconfig v2] config: Add spice host setter
by Visarion Alexandru
From: Visarion Alexandru <viorel.visarion(a)gmail.com>
Learn to set the address that spice is listening on.
Visarion Alexandru (1):
config: Add spice host setter
libvirt-gconfig/libvirt-gconfig-domain-graphics-spice.c | 10 ++++++++++
libvirt-gconfig/libvirt-gconfig-domain-graphics-spice.h | 3 +++
libvirt-gconfig/libvirt-gconfig.sym | 1 +
3 files changed, 14 insertions(+)
--
2.7.4
8 years, 3 months
[libvirt] [PATCH] qemu: Need to free fileprops in error path
by John Ferlan
The virJSONValueObjectCreate only consumes the object on success, so on
failure we must free - from commit id 'f4441017' (found by Coverity).
Signed-off-by: John Ferlan <jferlan(a)redhat.com>
---
Coverity is also grumpy about the consumption of the object on the
success path - probably because of the va_args manner in which the
object gets consumed and later free'd.
src/qemu/qemu_command.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 0094665..c4da8b5 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -1038,8 +1038,10 @@ qemuGetDriveSourceProps(virStorageSourcePtr src,
}
if (fileprops &&
- virJSONValueObjectCreate(props, "a:file", fileprops, NULL) < 0)
+ virJSONValueObjectCreate(props, "a:file", fileprops, NULL) < 0) {
+ virJSONValueFree(fileprops);
return -1;
+ }
return 0;
}
--
2.5.5
8 years, 3 months
[libvirt] [PATCH glib] Fix check for libvirt optional functions
by Daniel P. Berrange
The checks for virDomainOpenGraphicsFD and
virNetworkGetDHCPLeases in configure are simply trying
to compile and link a test program. This was assuming
that libvirt was installed in /usr/lib & /usr/include,
which is not always the case. Using a pkg-config version
check avoids needing to compile and thus avoids the
bad assumptions about install locations.
Signed-off-by: Daniel P. Berrange <berrange(a)redhat.com>
---
Pushed as a broken build fix
configure.ac | 18 ++++++++++++------
1 file changed, 12 insertions(+), 6 deletions(-)
diff --git a/configure.ac b/configure.ac
index f71e5cf..b2848f2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -92,13 +92,19 @@ LIBVIRT_GLIB_COMPILE_WARNINGS
PKG_CHECK_MODULES(LIBVIRT, libvirt >= $LIBVIRT_REQUIRED)
# virDomainOpenGraphicsFD was introduced in libvirt 1.2.8
-AC_CHECK_LIB([virt],
- [virDomainOpenGraphicsFD],
- [AC_DEFINE([HAVE_VIR_DOMAIN_OPEN_GRAPHICS_FD], 1, [Have virDomainOpenGraphicsFD?])])
+AC_MSG_CHECKING([for virDomainOpenGraphicsFD])
+PKG_CHECK_EXISTS(libvirt >= 21.2.8,
+ [
+ AC_DEFINE([HAVE_VIR_DOMAIN_OPEN_GRAPHICS_FD], 1, [Have virDomainOpenGraphicsFD?])
+ AC_MSG_RESULT([yes])
+ ],[AC_MSG_RESULT([no])])
# virNetworkGetDHCPLeases was introduced in libvirt 1.2.6
-AC_CHECK_LIB([virt],
- [virNetworkGetDHCPLeases],
- [AC_DEFINE([HAVE_VIR_NETWORK_GET_DHCP_LEASES], 1, [Have virNetworkGetDHCPLeases?])])
+AC_MSG_CHECKING([for virNetworkGetDHCPLeases])
+PKG_CHECK_EXISTS(libvirt >= 21.2.6,
+ [
+ AC_DEFINE([HAVE_VIR_NETWORK_GET_DHCP_LEASES], 1, [Have virNetworkGetDHCPLeases?])
+ AC_MSG_RESULT([yes])
+ ],[AC_MSG_RESULT([no])])
enable_tests=no
PKG_CHECK_MODULES(GLIB2, glib-2.0 >= $GLIB2_TEST_REQUIRED,
[enable_tests=yes],
--
2.7.4
8 years, 3 months
[libvirt] [PATCH glib] Avoid unused variable in DHCP lease finalize method
by Daniel P. Berrange
If the network DHCP lease support is not detected, the build
will generate a warning / error:
libvirt-gobject-network-dhcp-lease.c: In function 'gvir_network_dhcp_lease_finalize':
libvirt-gobject-network-dhcp-lease.c:99:27: error: unused variable 'lease' [-Werror=unused-variable]
GVirNetworkDHCPLease *lease = GVIR_NETWORK_DHCP_LEASE(object);
^~~~~
cc1: all warnings being treated as errors
Signed-off-by: Daniel P. Berrange <berrange(a)redhat.com>
---
Pushed as a broken build fix
libvirt-gobject/libvirt-gobject-network-dhcp-lease.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/libvirt-gobject/libvirt-gobject-network-dhcp-lease.c b/libvirt-gobject/libvirt-gobject-network-dhcp-lease.c
index 7d1c979..200778d 100644
--- a/libvirt-gobject/libvirt-gobject-network-dhcp-lease.c
+++ b/libvirt-gobject/libvirt-gobject-network-dhcp-lease.c
@@ -96,12 +96,10 @@ static void gvir_network_dhcp_lease_set_property(GObject *object,
static void gvir_network_dhcp_lease_finalize(GObject *object)
{
- GVirNetworkDHCPLease *lease = GVIR_NETWORK_DHCP_LEASE(object);
#ifdef HAVE_VIR_NETWORK_GET_DHCP_LEASES
+ GVirNetworkDHCPLease *lease = GVIR_NETWORK_DHCP_LEASE(object);
GVirNetworkDHCPLeasePrivate *priv = lease->priv;
-#endif /* HAVE_VIR_NETWORK_GET_DHCP_LEASES */
-#ifdef HAVE_VIR_NETWORK_GET_DHCP_LEASES
virNetworkDHCPLeaseFree(priv->handle);
#endif /* HAVE_VIR_NETWORK_GET_DHCP_LEASES */
--
2.7.4
8 years, 3 months
[libvirt] [PATCH] wireshark: Adapt to dissector function header change
by Michal Privoznik
In wireshark commit bbdd89b9 (contained in 2.1.0 release) they
have changed prototype of dissector function. Now it returns
number of bytes consumed by the dissector, and can get a pointer
to user specified data (which we don't use).
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
tools/wireshark/src/packet-libvirt.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/tools/wireshark/src/packet-libvirt.c b/tools/wireshark/src/packet-libvirt.c
index aa1c323..569a0a1 100644
--- a/tools/wireshark/src/packet-libvirt.c
+++ b/tools/wireshark/src/packet-libvirt.c
@@ -442,8 +442,14 @@ get_message_len(packet_info *pinfo ATTRIBUTE_UNUSED, tvbuff_t *tvb, int offset)
return tvb_get_ntohl(tvb, offset);
}
+#if WIRESHARK_VERSION >= 2000001
+static int
+dissect_libvirt(tvbuff_t *tvb, packet_info *pinfo,
+ proto_tree *tree, void *data ATTRIBUTE_UNUSED)
+#else
static void
dissect_libvirt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+#endif
{
/* Another magic const - 4; simply, how much bytes
* is needed to tell the length of libvirt packet. */
@@ -454,6 +460,10 @@ dissect_libvirt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
tcp_dissect_pdus(tvb, pinfo, tree, TRUE, 4,
get_message_len, dissect_libvirt_message, NULL);
#endif
+
+#if WIRESHARK_VERSION >= 2000001
+ return tvb_captured_length(tvb);
+#endif
}
void
--
2.8.4
8 years, 3 months