[libvirt] [PATCH 0/4] syntax-check: Minor cleanups
by Andrea Bolognani
Ran into something confusing while working on something
unrelated, ended up making a few tiny cleanups.
Cheers.
Andrea Bolognani (4):
util: Fix 'exempt from syntax-check' comment
cfg.mk: Remove spurious whitespace
cfg.mk: Use single quotes wherever possible
cfg.mk: Always enclose syntax-check error messages in quotes
cfg.mk | 36 ++++++++++++++++++------------------
src/util/virutil.c | 4 ++--
2 files changed, 20 insertions(+), 20 deletions(-)
--
2.5.5
8 years, 8 months
[libvirt] [PATCH] qemu: Remove redundant DomainObjIsActive check
by Cole Robinson
We perform the same check several lines earlier
---
src/qemu/qemu_driver.c | 6 ------
1 file changed, 6 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index e795062..ced808a 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -18403,32 +18403,26 @@ qemuDomainQemuAgentCommand(virDomainPtr domain,
if (!virDomainObjIsActive(vm)) {
virReportError(VIR_ERR_OPERATION_INVALID,
"%s", _("domain is not running"));
goto cleanup;
}
if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_MODIFY) < 0)
goto cleanup;
if (!qemuDomainAgentAvailable(vm, true))
goto endjob;
- if (!virDomainObjIsActive(vm)) {
- virReportError(VIR_ERR_OPERATION_INVALID,
- "%s", _("domain is not running"));
- goto endjob;
- }
-
qemuDomainObjEnterAgent(vm);
ret = qemuAgentArbitraryCommand(priv->agent, cmd, &result, timeout);
qemuDomainObjExitAgent(vm);
if (ret < 0)
VIR_FREE(result);
endjob:
qemuDomainObjEndJob(driver, vm);
cleanup:
virDomainObjEndAPI(&vm);
return result;
}
--
2.7.3
8 years, 8 months
[libvirt] [PATCH] Return error when --start <number> in cpu-stats is invalid.
by Nitesh Konkar
Signed-off-by: Nitesh Konkar <nitkon12(a)linux.vnet.ibm.com>
---
# virsh cpu-stats --domain 40 --start 159
CPU159:
cpu_time 0.000000000 seconds
vcpu_time 0.000000000 seconds
# virsh cpu-stats --domain 40 --start 160
Start cpu 160 larger than maximum of 159.
tools/virsh-domain.c | 6 ++++++
1 files changed, 6 insertions(+)
diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index 800829e..3d6b626 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -7357,6 +7357,12 @@ cmdCPUStats(vshControl *ctl, const vshCmd *cmd)
/* get number of cpus on the node */
if ((max_id = virDomainGetCPUStats(dom, NULL, 0, 0, 0, 0)) < 0)
goto failed_stats;
+
+ if (cpu >= max_id) {
+ vshPrint(ctl, "Start cpu %d larger than maximum of %d.", cpu, max_id - 1);
+ goto cleanup;
+ }
+
if (show_count < 0 || show_count > max_id) {
if (show_count > max_id)
vshPrint(ctl, _("Only %d CPUs available to show\n"), max_id);
--
1.8.3.1
8 years, 8 months
[libvirt] RFC: spec file cleanup ideas
by Cole Robinson
Hi all,
I wanted to float some ideas about cleaning up the RPM spec file. None of it
is urgent but I'll end up scratching the itch eventually and I want to make
sure people are on board
Old distro bits:
* Drop support for building on rhel5... this was ACKd previously by eblake:
http://www.redhat.com/archives/libvir-list/2015-November/msg00175.html
* Drop support for end-of-life Fedora. There's lots of Fedora conditionals
going back to Fedora 13. I don't think it's really interesting to try to
support building an RPM on a distribution that is no longer receiving updates.
But we could be a bit conservative and give a couple release window, dropping
support for less than Fedora 20 for example (which went EOL in June 2015)
Configuration variables: some of these could still feasibly be 'useful' even
if they aren't programmatically set by any distro conditional, but I think
unless someone actively uses them we should seek to have as few conditionals
as possible, rather than conditionalize everything by default which seems more
common. Some ideas:
* Drop with_* conditionals that are only used by old Fedora or RHEL5. I didn't
audit all of them but the obvious ones are straight forward like:
with_systemd_macros, with_polkit, with_capng, with_netcf, with_yajl,
with_capng, with_avahi, with_hal/all HAL support
* Drop client_only/server_drivers/with_libvirtd ... do these serve any good
purpose? (once the rhel5 bits are gone)
* Drop with_driver_modules: it's unconditionally enabled and has been since it
was introduced
Old spec bits cleanup:
* drop defattr(), it's long since not needed
* drop manual removal of the buildroot, it's long since not needed
* use %global consistently instead of %define
* consider using %{with/without X} pattern instead of defining variables as with_X
* The top of the spec has this block:
# If neither fedora nor rhel was defined, try to guess them from dist
%if !0%{?rhel} && !0%{?fedora}
%{expand:%(echo "%{?dist}" | \
sed -ne 's/^\.el\([0-9]\+\).*/%%define rhel \1/p')}
%{expand:%(echo "%{?dist}" | \
sed -ne 's/^\.fc\?\([0-9]\+\).*/%%define fedora \1/p')}
%endif
Is it actually still relevant? It was added 5 years ago... I don't know in
what case rhel or fedora macros won't be defined
8 years, 8 months
[libvirt] [PATCH] spec: Only pull in API docs with -devel package
by Cole Robinson
Move some API specific documentation out of -docs package and into
-devel, and some end user docs out of -devel and into -docs, then
drop the -devel dep on -docs. This is more in line with the suggested
Fedora guidelines.
https://bugzilla.redhat.com/show_bug.cgi?id=1310155
---
libvirt.spec.in | 19 +++++++++----------
1 file changed, 9 insertions(+), 10 deletions(-)
diff --git a/libvirt.spec.in b/libvirt.spec.in
index 8036fa3..500cde9 100644
--- a/libvirt.spec.in
+++ b/libvirt.spec.in
@@ -1197,7 +1197,6 @@ namespaces.
Summary: Libraries, includes, etc. to compile with the libvirt library
Group: Development/Libraries
Requires: %{name}-client = %{version}-%{release}
-Requires: %{name}-docs = %{version}-%{release}
Requires: pkgconfig
%description devel
@@ -1949,14 +1948,10 @@ exit 0
%files docs
%defattr(-, root, root)
-%doc AUTHORS ChangeLog.gz NEWS README TODO libvirt-docs/*
+%doc AUTHORS ChangeLog.gz NEWS README TODO
+%doc libvirt-docs/*
+%doc docs/*.html docs/html docs/*.gif
-# API docs
-%dir %{_datadir}/gtk-doc/html/libvirt/
-%doc %{_datadir}/gtk-doc/html/libvirt/*.devhelp
-%doc %{_datadir}/gtk-doc/html/libvirt/*.html
-%doc %{_datadir}/gtk-doc/html/libvirt/*.png
-%doc %{_datadir}/gtk-doc/html/libvirt/*.css
%if %{with_libvirtd}
%files daemon
@@ -2387,8 +2382,12 @@ exit 0
%{_datadir}/libvirt/api/libvirt-qemu-api.xml
%{_datadir}/libvirt/api/libvirt-lxc-api.xml
-
-%doc docs/*.html docs/html docs/*.gif
+# API docs
+%dir %{_datadir}/gtk-doc/html/libvirt/
+%doc %{_datadir}/gtk-doc/html/libvirt/*.devhelp
+%doc %{_datadir}/gtk-doc/html/libvirt/*.html
+%doc %{_datadir}/gtk-doc/html/libvirt/*.png
+%doc %{_datadir}/gtk-doc/html/libvirt/*.css
%doc docs/libvirt-api.xml
%doc examples/hellolibvirt
%doc examples/object-events
--
2.7.3
8 years, 8 months
[libvirt] [PATCH] qemu: migration: Drop dead VNC cookie handling
by Cole Robinson
The only caller of this code is:
for (i = 0; i < dom->def->ngraphics; i++) {
if (dom->def->graphics[i]->type == VIR_DOMAIN_GRAPHICS_TYPE_SPICE) {
if (!(mig->graphics =
qemuMigrationCookieGraphicsAlloc(driver, dom->def->graphics[i])))
return -1;
mig->flags |= QEMU_MIGRATION_COOKIE_GRAPHICS;
break;
}
}
So this is never triggered for VNC, and in fact VNC has no support for
seamless migration anyways so that seems correct. Drop the dead VNC
handling.
---
src/qemu/qemu_migration.c | 34 +++++++++++-----------------------
1 file changed, 11 insertions(+), 23 deletions(-)
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index 8d2ca3b..ca3619d 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -320,33 +320,21 @@ qemuMigrationCookieGraphicsAlloc(virQEMUDriverPtr driver,
goto error;
mig->type = def->type;
- if (mig->type == VIR_DOMAIN_GRAPHICS_TYPE_VNC) {
- mig->port = def->data.vnc.port;
- listenAddr = virDomainGraphicsListenGetAddress(def, 0);
- if (!listenAddr)
- listenAddr = cfg->vncListen;
+ mig->port = def->data.spice.port;
+ if (cfg->spiceTLS)
+ mig->tlsPort = def->data.spice.tlsPort;
+ else
+ mig->tlsPort = -1;
+ listenAddr = virDomainGraphicsListenGetAddress(def, 0);
+ if (!listenAddr)
+ listenAddr = cfg->spiceListen;
#ifdef WITH_GNUTLS
- if (cfg->vncTLS &&
- !(mig->tlsSubject = qemuDomainExtractTLSSubject(cfg->vncTLSx509certdir)))
- goto error;
+ if (cfg->spiceTLS &&
+ !(mig->tlsSubject = qemuDomainExtractTLSSubject(cfg->spiceTLSx509certdir)))
+ goto error;
#endif
- } else {
- mig->port = def->data.spice.port;
- if (cfg->spiceTLS)
- mig->tlsPort = def->data.spice.tlsPort;
- else
- mig->tlsPort = -1;
- listenAddr = virDomainGraphicsListenGetAddress(def, 0);
- if (!listenAddr)
- listenAddr = cfg->spiceListen;
-#ifdef WITH_GNUTLS
- if (cfg->spiceTLS &&
- !(mig->tlsSubject = qemuDomainExtractTLSSubject(cfg->spiceTLSx509certdir)))
- goto error;
-#endif
- }
if (VIR_STRDUP(mig->listen, listenAddr) < 0)
goto error;
--
2.7.3
8 years, 8 months
[libvirt] [PATCH 0/8] qemu: Fix current ballooned size after memory hot(un)plug
by Peter Krempa
Clean up some of the memory balloon code and fix the calculation of size after
hotplug.
Peter Krempa (8):
qemu: command: Assume QEMU_CAPS_DEVICE when building memballoon args
qemu: caps: Deprecate QEMU_CAPS_BALLOON
qemu: command: Drop obsolete comment
qemu: command: Refactor memballoon command line formatting
qemu: domain: Add helper to determine presence of memory baloon
qemu: driver: Reuse qemuDomainGetMonitor in qemuDomainMemoryStats
qemu: process: Simplify condition in qemuProcessRefreshBalloonState
qemu: hotplug: Properly recalculate/reload balloon size after
hot(un)plug
src/qemu/qemu_capabilities.c | 3 -
src/qemu/qemu_capabilities.h | 2 +-
src/qemu/qemu_command.c | 83 +++++++++------------------
src/qemu/qemu_command.h | 4 --
src/qemu/qemu_domain.c | 11 +++-
src/qemu/qemu_domain.h | 1 +
src/qemu/qemu_driver.c | 16 ++----
src/qemu/qemu_hotplug.c | 15 ++---
src/qemu/qemu_process.c | 16 ++----
src/qemu/qemu_process.h | 4 ++
tests/qemucapabilitiesdata/caps_1.2.2-1.caps | 1 -
tests/qemucapabilitiesdata/caps_1.3.1-1.caps | 1 -
tests/qemucapabilitiesdata/caps_1.4.2-1.caps | 1 -
tests/qemucapabilitiesdata/caps_1.5.3-1.caps | 1 -
tests/qemucapabilitiesdata/caps_1.6.0-1.caps | 1 -
tests/qemucapabilitiesdata/caps_1.6.50-1.caps | 1 -
tests/qemucapabilitiesdata/caps_2.1.1-1.caps | 1 -
tests/qemucapabilitiesdata/caps_2.4.0-1.caps | 1 -
tests/qemucapabilitiesdata/caps_2.5.0-1.caps | 1 -
tests/qemucapabilitiesdata/caps_2.6.0-1.caps | 1 -
tests/qemuhelptest.c | 8 ---
21 files changed, 59 insertions(+), 114 deletions(-)
--
2.8.0
8 years, 8 months
[libvirt] [libvirt-php PATCH] Use zend_long instead of zend_ulong64
by Neal Gompa
In PHP 7.0, the zend_(u)long64 definition was removed in favor
of zend_(u)long changing depending on whether PHP was compiled on
a 64-bit architecture or not.
The patch set that originally ported libvirt-php to PHP7+ did not
use zend_ulong64. However, it was altered to use it during the review,
which broke PHP 7.0 support. This fixes that by using zend_long and
checking for if the value is invalid and returning false when that happens.
---
src/libvirt-php.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/libvirt-php.c b/src/libvirt-php.c
index 7dcead8..435bf97 100644
--- a/src/libvirt-php.c
+++ b/src/libvirt-php.c
@@ -6666,11 +6666,12 @@ PHP_FUNCTION(libvirt_domain_memory_peek)
zval *zdomain;
int retval;
zend_long flags=0;
- zend_ulong64 start;
+ zend_long start;
zend_long size;
char *buff;
GET_DOMAIN_FROM_ARGS("rlll",&zdomain,&start,&size,&flags);
+ if (start < 0) RETURN_FALSE;
buff=(char *)emalloc(size);
retval=virDomainMemoryPeek(domain->domain,start,size,buff,flags);
if (retval != 0) RETURN_FALSE;
--
2.5.5
8 years, 8 months
[libvirt] [libvirt-php PATCH] Add missing zend_ulong64 definition for PHP7+
by Neal Gompa
In PHP 7.0, the zend_ulong64 definition was removed in favor
of zend_ulong changing depending on whether PHP was compiled on
a 64-bit architecture or not. However, we need 64-bit wide unsigned
numbers, so the definition has been added for when it is compiled
against PHP 7.0 or newer.
The patch set that originally ported libvirt-php to PHP7+ did not
use zend_ulong64. However, it was altered to use it during the review,
which broke PHP 7.0 support. This fixes that.
---
src/libvirt-php.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/libvirt-php.c b/src/libvirt-php.c
index 7dcead8..91bb1c5 100644
--- a/src/libvirt-php.c
+++ b/src/libvirt-php.c
@@ -57,7 +57,7 @@ const char *features_binaries[] = { NULL };
#if PHP_MAJOR_VERSION >= 7
typedef size_t strsize_t;
-
+typedef uint64_t zend_ulong64;
#define VIRT_FETCH_RESOURCE(_state, _type, _zval, _name, _le) \
if ((_state = (_type)zend_fetch_resource(Z_RES_P(*_zval), _name, _le)) == NULL) { \
--
2.5.5
8 years, 8 months