[libvirt] [PATCH 00/13] New API: virDominDestroyWithFlags
by Michal Privoznik
This series creates new API which adds flags to
virDomainDestroy. As mentioned here many times, it is
a bad luck all APIs don't have flags parameter.
Parameter for this might be needed to select different
ways of destroying a domain. For example, qemu has 'quit'
command, which force it to flush internal caches a thus
preventing from data loss. Or vice versa - in cases
where we are doing hypervisor assisted destroy we might
want to send signals, because hypervisor is not responding.
Currently, no new functionality is implemented, but
this paves the way for creating multiple ways of domain
destroying. Therefore, calling this new API is the same
as calling its predecessor.
Michal Privoznik (13):
destroy: Define new public API virDomainDestroyWithFlags
destroy: Wire up the remote protocol
destroy: Implement internal API for qemu driver
destroy: Implement internal API for ESX driver
destroy: Implement internal API for libxl driver
destroy: Implement internal API for lxc driver
destroy: Implement internal API for openvz driver
destroy: Implement internal API for phyp driver
destroy: Implement internal API for uml driver
destroy: Implement internal API for vbox driver
destroy: Implement internal API for vmware driver
destroy: Implement internal API for xen driver
destroy: Implement internal API for xenapi driver
include/libvirt/libvirt.h.in | 7 +++++
src/driver.h | 4 +++
src/esx/esx_driver.c | 12 +++++++++-
src/libvirt.c | 52 ++++++++++++++++++++++++++++++++++++++++++
src/libvirt_public.syms | 1 +
src/libxl/libxl_driver.c | 12 +++++++++-
src/lxc/lxc_driver.c | 23 +++++++++++++++++-
src/openvz/openvz_driver.c | 13 +++++++++-
src/phyp/phyp_driver.c | 12 +++++++++-
src/qemu/qemu_driver.c | 13 +++++++++-
src/remote/remote_driver.c | 1 +
src/remote/remote_protocol.x | 8 +++++-
src/remote_protocol-structs | 5 ++++
src/uml/uml_driver.c | 14 ++++++++++-
src/vbox/vbox_tmpl.c | 14 ++++++++++-
src/vmware/vmware_driver.c | 12 +++++++++-
src/xen/xen_driver.c | 28 ++++++++++++++++++++++
src/xen/xen_driver.h | 1 +
src/xen/xen_hypervisor.c | 24 +++++++++++++++++-
src/xen/xen_hypervisor.h | 3 ++
src/xen/xen_inotify.c | 1 +
src/xen/xend_internal.c | 24 +++++++++++++++++-
src/xen/xm_internal.c | 1 +
src/xen/xs_internal.c | 1 +
src/xenapi/xenapi_driver.c | 22 ++++++++++++++++-
25 files changed, 291 insertions(+), 17 deletions(-)
--
1.7.5.rc3
13 years, 4 months
[libvirt] [PATCH] error: preserve errno when saving last error
by Eric Blake
It is common to see the sequence:
virErrorPtr save_err = virSaveLastError();
// do cleanup
virSetError(save_err);
virFreeError(save_err);
on cleanup paths. But for functions where it is desirable to
return the errno that caused failure, this sequence can clobber
that errno. virFreeError was already safe; this makes the other
two functions in the sequence safe as well, assuming all goes
well (on OOM, errno will be clobbered, but then again, save_err
won't reflect the real error that happened, so you are no longer
preserving the real situation - that's life with OOM).
* src/util/virterror.c (virSaveLastError, virSetError): Preserve
errno.
---
Fixes an errno-clobbering situation pointed out here:
https://www.redhat.com/archives/libvir-list/2011-July/msg01382.html
src/util/virterror.c | 17 +++++++++++++----
1 files changed, 13 insertions(+), 4 deletions(-)
diff --git a/src/util/virterror.c b/src/util/virterror.c
index 0c7698a..07f8b45 100644
--- a/src/util/virterror.c
+++ b/src/util/virterror.c
@@ -295,18 +295,24 @@ virGetLastError(void)
* Can be used to re-set an old error, which may have been squashed by
* other functions (like cleanup routines).
*
- * Returns 0 on success, 1 on failure
+ * Returns 0 on success, -1 on failure. Leaves errno unchanged.
*/
int
virSetError(virErrorPtr newerr)
{
virErrorPtr err;
+ int saved_errno = errno;
+ int ret = -1;
+
err = virLastErrorObject();
if (!err)
- return -1;
+ goto cleanup;
virResetError(err);
- return virCopyError(newerr, err);
+ ret = virCopyError(newerr, err);
+cleanup:
+ errno = saved_errno;
+ return ret;
}
/**
@@ -339,7 +345,8 @@ virCopyLastError(virErrorPtr to)
/**
* virSaveLastError:
*
- * Save the last error into a new error object.
+ * Save the last error into a new error object. On success, errno is
+ * unchanged; on failure, errno is ENOMEM.
*
* Returns a pointer to the copied error or NULL if allocation failed.
* It is the caller's responsibility to free the error with
@@ -349,11 +356,13 @@ virErrorPtr
virSaveLastError(void)
{
virErrorPtr to;
+ int saved_errno = errno;
if (VIR_ALLOC(to) < 0)
return NULL;
virCopyLastError(to);
+ errno = saved_errno;
return to;
}
--
1.7.4.4
13 years, 4 months
[libvirt] [PATCH] python: Fix makefile rule for code generation
by Matthias Bolte
Commit 8665f85523f0451c changed generated.stamp to $(GENERATE).stamp,
but missed one instance in the CLEANFILES list. This can break the
build in case the generated code is deleted but the .stamp file stays
around and therefore the code isn't regenerated.
---
python/Makefile.am | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/python/Makefile.am b/python/Makefile.am
index a4c9a6b..51f005d 100644
--- a/python/Makefile.am
+++ b/python/Makefile.am
@@ -71,7 +71,7 @@ install-data-local:
uninstall-local:
rm -f $(DESTDIR)$(pyexecdir)/libvirt.py
-CLEANFILES= $(GENERATED) generated.stamp
+CLEANFILES= $(GENERATED) $(GENERATE).stamp
else
all:
--
1.7.4.1
13 years, 4 months
[libvirt] [PATCH v2 0/7] Add support for setting QoS
by Michal Privoznik
This patch series add support for setting traffic shaping and policing
on both domain's interface and network's virtual bridge. Basically,
this is done via 'tc' from iproute2 package. For shaping is HTB used,
for policing we need u32 match selector. Both should be available in
RHEL-6 kernel.
How this works:
On an virtual interface which has limits defined a root qdisc are replaced.
Ingress root for outbound traffic shaping and egress for inbound.
Basically, in inbound traffic policing is applied, on outbound shaping.
New qdiscs are set to limit the traffic to rate set in XML. For shaping
it is possible to set the size of buffer. Accepted values for rate, peak
and burst have same format as 'tc' command and are documented.
Supported devices are VIR_DOMAIN_NET_TYPE_NETWORK, VIR_DOMAIN_NET_TYPE_BRIDGE
and VIR_DOMAIN_NET_TYPE_DIRECT.
diff to v1:
-rebase to current HEAD
-add support for macvtap devices
Michal Privoznik (7):
bandwidth: Define schema and create documentation
bandwidth: Declare internal structures
bandwidth: Add format parsing functions
bandwidth: Create format functions
bandwitdh: Implement functions to enable and disable QoS
bandwidth: Add test cases for network
bandwidth: Add domain schema test suite
configure.ac | 4 +
docs/formatdomain.html.in | 32 ++
docs/formatnetwork.html.in | 30 ++
docs/schemas/domain.rng | 50 +++
docs/schemas/network.rng | 50 +++
src/conf/domain_conf.c | 6 +
src/conf/domain_conf.h | 1 +
src/conf/network_conf.c | 8 +
src/conf/network_conf.h | 1 +
src/libvirt_private.syms | 6 +
src/network/bridge_driver.c | 12 +
src/qemu/qemu_command.c | 10 +-
src/util/macvtap.c | 12 +-
src/util/macvtap.h | 5 +-
src/util/network.c | 517 +++++++++++++++++++++++++
src/util/network.h | 28 ++
tests/domainschemadata/domain-bandwidth.xml | 72 ++++
tests/networkxml2xmlin/bandwidth-network.xml | 16 +
tests/networkxml2xmlout/bandwidth-network.xml | 16 +
tests/networkxml2xmltest.c | 1 +
20 files changed, 873 insertions(+), 4 deletions(-)
create mode 100644 tests/domainschemadata/domain-bandwidth.xml
create mode 100644 tests/networkxml2xmlin/bandwidth-network.xml
create mode 100644 tests/networkxml2xmlout/bandwidth-network.xml
--
1.7.5.rc3
13 years, 4 months
[libvirt] [PATCH 0/7] Add support for setting QoS
by Michal Privoznik
This patch series add support for setting traffic shaping and policing
on both domain's interface and network's virtual bridge. Basically,
this is done via 'tc' from iproute2 package. For shaping is HTB used,
for policing we need u32 match selector. Both should be available in
RHEL-6 kernel.
How this works:
On an virtual interface which has limits defined a root qdisc are replaced.
Ingress root for outbound traffic shaping and egress for inbound.
Basically, in inbound traffic policing is applied, on outbound shaping.
New qdiscs are set to limit the traffic to rate set in XML. For shaping
it is possible to set the size of buffer. Accepted values for rate, peak
and burst are integer numbers. Units are kilobytes per second for rate
or kilobytes for size.
Supported devices are VIR_DOMAIN_NET_TYPE_NETWORK, VIR_DOMAIN_NET_TYPE_BRIDGE
and VIR_DOMAIN_NET_TYPE_DIRECT.
diff to v2:
-Jirka's review included
diff to v1:
-rebase to current HEAD
-add support for macvtap devices
Michal Privoznik (7):
bandwidth: Define schema and create documentation
bandwidth: Declare internal structures
bandwidth: Add parsing functions
bandwidth: Create format functions
bandwitdh: Implement functions to enable and disable QoS
bandwidth: Add test cases for network
bandwidth: Add domain schema test suite
configure.ac | 4 +
docs/formatdomain.html.in | 33 +++
docs/formatnetwork.html.in | 30 +++
docs/schemas/bandwidth.rng | 52 ++++
docs/schemas/domain.rng | 4 +
docs/schemas/network.rng | 4 +
src/conf/domain_conf.c | 6 +
src/conf/domain_conf.h | 1 +
src/conf/network_conf.c | 8 +
src/conf/network_conf.h | 1 +
src/libvirt_private.syms | 4 +
src/network/bridge_driver.c | 12 +
src/qemu/qemu_command.c | 10 +-
src/util/macvtap.c | 12 +-
src/util/macvtap.h | 5 +-
src/util/network.c | 345 +++++++++++++++++++++++++
src/util/network.h | 23 ++
tests/domainschemadata/domain-bandwidth.xml | 72 +++++
tests/networkxml2xmlin/bandwidth-network.xml | 16 ++
tests/networkxml2xmlout/bandwidth-network.xml | 16 ++
tests/networkxml2xmltest.c | 1 +
21 files changed, 655 insertions(+), 4 deletions(-)
create mode 100644 docs/schemas/bandwidth.rng
create mode 100644 tests/domainschemadata/domain-bandwidth.xml
create mode 100644 tests/networkxml2xmlin/bandwidth-network.xml
create mode 100644 tests/networkxml2xmlout/bandwidth-network.xml
--
1.7.5.rc3
13 years, 4 months
[libvirt] Schedule for release of 0.9.4
by Daniel Veillard
I should have posted this beginning of this week...
Basically I would like to freeze for 0.9.4 next Monday, which means
we need to finish ACK'ing and pushing the number of patch sets which
are well advanced already. Then try to get a final 0.9.4 release
on Aug 1 or 2.
So let's make sure we have updated patches on the list and let's
review the patches and apply them ! This includes:
- virtual switch support
- support for cpu bandwith (Wen can you provide a patchset including
latest feedback ?)
- New virDomainBlockPull API (Adam can you provide a new patchset too ?)
- and various other patch(set)s floating around
And if you sent a patch which got no feedback, please raise it again,
thanks everybody !
Daniel
--
Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/
daniel(a)veillard.com | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library http://libvirt.org/
13 years, 4 months
[libvirt] [PATCH] maint: fix typos on guaranteed
by Eric Blake
* src/conf/domain_event.c (virDomainEventDispatch): Fix typo.
* src/internal.h (ATTRIBUTE_FMT_PRINTF): Likewise.
* src/libvirt.c (virStreamEventUpdateCallback): Likewise.
* src/remote/remote_driver.c (doRemoteOpen): Likewise.
* src/storage/storage_backend_fs.c (virStorageBackendProbeTarget):
Likewise.
* src/util/virterror.c (virConnCopyLastError, virCopyLastError):
Likewise.
* src/xen/xend_internal.h (xend_wait_for_devices): Likewise.
---
Pushing under the trivial rule.
src/conf/domain_event.c | 2 +-
src/internal.h | 2 +-
src/libvirt.c | 2 +-
src/remote/remote_driver.c | 2 +-
src/storage/storage_backend_fs.c | 2 +-
src/util/virterror.c | 4 ++--
src/xen/xend_internal.h | 2 +-
7 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/src/conf/domain_event.c b/src/conf/domain_event.c
index c435484..d43331f 100644
--- a/src/conf/domain_event.c
+++ b/src/conf/domain_event.c
@@ -1069,7 +1069,7 @@ void virDomainEventDispatch(virDomainEventPtr event,
{
int i;
/* Cache this now, since we may be dropping the lock,
- and have more callbacks added. We're guarenteed not
+ and have more callbacks added. We're guaranteed not
to have any removed */
int cbCount = callbacks->count;
diff --git a/src/internal.h b/src/internal.h
index 5747a90..1997031 100644
--- a/src/internal.h
+++ b/src/internal.h
@@ -140,7 +140,7 @@
* Macro used to check printf like functions, if compiling
* with gcc.
*
- * We use gnulib which guarentees we always have GNU style
+ * We use gnulib which guarantees we always have GNU style
* printf format specifiers even on broken Win32 platforms
* hence we have to force 'gnu_printf' for new GCC
*/
diff --git a/src/libvirt.c b/src/libvirt.c
index 2f5241a..16a9a02 100644
--- a/src/libvirt.c
+++ b/src/libvirt.c
@@ -13390,7 +13390,7 @@ error:
* Changes the set of events to monitor for a stream. This allows
* for event notification to be changed without having to
* unregister & register the callback completely. This method
- * is guarenteed to succeed if a callback is already registered
+ * is guaranteed to succeed if a callback is already registered
*
* Returns 0 on success, -1 if no callback is registered
*/
diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c
index 6ba58ed..82b938c 100644
--- a/src/remote/remote_driver.c
+++ b/src/remote/remote_driver.c
@@ -584,7 +584,7 @@ doRemoteOpen (virConnectPtr conn,
if (!(priv->client = virNetClientNewExternal(cmd_argv)))
goto failed;
- /* Do not set 'is_secure' flag since we can't guarentee
+ /* Do not set 'is_secure' flag since we can't guarantee
* an external program is secure, and this flag must be
* pessimistic */
} break;
diff --git a/src/storage/storage_backend_fs.c b/src/storage/storage_backend_fs.c
index 8d6f76d..1656215 100644
--- a/src/storage/storage_backend_fs.c
+++ b/src/storage/storage_backend_fs.c
@@ -143,7 +143,7 @@ virStorageBackendProbeTarget(virStorageVolTargetPtr target,
}
/* XXX ideally we'd fill in secret UUID here
- * but we cannot guarentee 'conn' is non-NULL
+ * but we cannot guarantee 'conn' is non-NULL
* at this point in time :-( So we only fill
* in secrets when someone first queries a vol
*/
diff --git a/src/util/virterror.c b/src/util/virterror.c
index 75058f3..0c7698a 100644
--- a/src/util/virterror.c
+++ b/src/util/virterror.c
@@ -327,7 +327,7 @@ int
virCopyLastError(virErrorPtr to)
{
virErrorPtr err = virLastErrorObject();
- /* We can't guarentee caller has initialized it to zero */
+ /* We can't guarantee caller has initialized it to zero */
memset(to, 0, sizeof(*to));
if (err)
virCopyError(err, to);
@@ -464,7 +464,7 @@ virConnGetLastError(virConnectPtr conn)
int
virConnCopyLastError(virConnectPtr conn, virErrorPtr to)
{
- /* We can't guarentee caller has initialized it to zero */
+ /* We can't guarantee caller has initialized it to zero */
memset(to, 0, sizeof(*to));
if (conn == NULL)
diff --git a/src/xen/xend_internal.h b/src/xen/xend_internal.h
index c4ed9ba..4a0cd69 100644
--- a/src/xen/xend_internal.h
+++ b/src/xen/xend_internal.h
@@ -36,7 +36,7 @@ xenDaemonOpen_unix(virConnectPtr conn, const char *path);
* \return 0 for success; -1 (with errno) on error
*
* xen_create() returns after a domain has been allocated including
- * its memory. This does not guarentee, though, that the devices
+ * its memory. This does not guarantee, though, that the devices
* have come up properly. For instance, if you create a VBD with an
* invalid filename, the error won't occur until after this function
* returns.
--
1.7.4.4
13 years, 4 months
[libvirt] [PATCH] rpc: Pass through DISPLAY so ssh can launch askpass
by Cole Robinson
Though we prefer users to have SSH keys setup, virt-manager users still
depend on remote SSH connections to launch a password dialog. This fixes
launch ssh-askpass
Fix suggested by danpb
---
src/rpc/virnetsocket.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/src/rpc/virnetsocket.c b/src/rpc/virnetsocket.c
index 4403fc4..6605aa3 100644
--- a/src/rpc/virnetsocket.c
+++ b/src/rpc/virnetsocket.c
@@ -604,6 +604,7 @@ int virNetSocketNewConnectSSH(const char *nodename,
virCommandAddEnvPassCommon(cmd);
virCommandAddEnvPass(cmd, "SSH_AUTH_SOCK");
virCommandAddEnvPass(cmd, "SSH_ASKPASS");
+ virCommandAddEnvPass(cmd, "DISPLAY");
virCommandClearCaps(cmd);
if (service)
--
1.7.4.4
13 years, 4 months
[libvirt] remote driver RPC API usage breaks launching ssh askpass
by Cole Robinson
This commit broke launching SSH askpass from virt-manager:
http://libvirt.org/git/?p=libvirt.git;a=commit;h=c1b226447781ba8367606f76...
Using upstream virt-manager, running
python src/virt-manager.py
and trying to connect to a remote SSH connection without SSH keys causes
a segfault:
#0 virNetSocketRead (sock=0xc, buf=0x7f746c006458 "", len=4)
at rpc/virnetsocket.c:969
#1 0x00007f7477ea7374 in virNetClientIOReadMessage (client=0x7f746c006400)
at rpc/virnetclient.c:712
#2 virNetClientIOHandleInput (client=0x7f746c006400) at
rpc/virnetclient.c:731
#3 0x00007f7477ea7ae0 in virNetClientIncomingEvent (sock=0x7f746c002040,
events=<value optimized out>, opaque=0x7f746c006400)
at rpc/virnetclient.c:1120
#4 0x00007f74782332ce in libvirt_virEventInvokeHandleCallback (
self=<value optimized out>, args=<value optimized out>)
at libvirt-override.c:2997
#5 0x0000003075ee965b in call_function (f=<value optimized out>,
throwflag=<value optimized out>)
at /usr/src/debug/Python-2.7/Python/ceval.c:4071
#6 PyEval_EvalFrameEx (f=<value optimized out>,
throwflag=<value optimized out>)
at /usr/src/debug/Python-2.7/Python/ceval.c:2721
...
If you apply the following patch to virt-manager:
$ cat a
diff --git a/src/virt-manager.py.in b/src/virt-manager.py.in
index cf0a20e..4d3f1c6 100755
--- a/src/virt-manager.py.in
+++ b/src/virt-manager.py.in
@@ -357,8 +357,8 @@ def main():
"disabling DBus service")
# Hook libvirt events into glib main loop
- import virtManager.libvirtglib
- virtManager.libvirtglib.register_event_impl()
+ #import virtManager.libvirtglib
+ #virtManager.libvirtglib.register_event_impl()
# At this point we're either starting a brand new controlling instance,
# or the dbus comms to existing instance has failed
rerun make, and reproduce the error, libvirt raises an exception from
virConnectOpenAuth:
libvirtError: Cannot recv data: Permission denied, please try again.
Permission denied, please try again.
Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password). :
Connection reset by peer
I haven't poked at it yet, putting it here incase anyone else has ideas.
- Cole
13 years, 4 months
[libvirt] [PATCH] udev: Don't try to dump DMI on non-intel archs
by Michal Privoznik
DMI is Intel & Intel-compatible specific. Don't try to dump information
on non-compatible architectures, which results only in error message in
logs.
---
NB: libsmbios is exclusively for x86_64 ia64 %{ix86}
src/node_device/node_device_udev.c | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/src/node_device/node_device_udev.c b/src/node_device/node_device_udev.c
index a6b5b2e..2c5d016 100644
--- a/src/node_device/node_device_udev.c
+++ b/src/node_device/node_device_udev.c
@@ -1477,6 +1477,8 @@ out:
}
+/* DMI is intel-compatible specific */
+#if defined(__x86_64__) || defined(__i386__) || defined(__amd64__)
static void
udevGetDMIData(union _virNodeDevCapData *data)
{
@@ -1549,6 +1551,7 @@ out:
}
return;
}
+#endif
static int udevSetupSystemDev(void)
@@ -1573,7 +1576,9 @@ static int udevSetupSystemDev(void)
goto out;
}
+#if defined(__x86_64__) || defined(__i386__) || defined(__amd64__)
udevGetDMIData(&def->caps->data);
+#endif
dev = virNodeDeviceAssignDef(&driverState->devs, def);
if (dev == NULL) {
--
1.7.5.rc3
13 years, 4 months