[libvirt] [Libvirt roadmap] external snapshots
by Guillaume COEUGNET
Hello,
I passed yesturday on the #virt IRC channel to ask there my question but without receiving any answer. So I write you here to know if it is planned, on the libvirt roadmap, to support external snapshot for revert/delete ?
I know there is a workaround in the meantime, but in this roadmap : http://wiki.libvirt.org/page/Todo I don't see any reference to external snapshot so I wondering if and when approximatly it would be available for libvirt users.
Thanks for any answer. Best regards,
Guillaume C,
KVM user.
9 years, 4 months
[libvirt] [PATCH] Escape left brace as new perl suggests
by Martin Kletzander
After upgrade to perl-5.22.0, it started complaining about one of our
scripts. The thing is that even though it works, it wants all curly
brackets escaped properly. The change is not functional, it merely gets
rid of the following error:
Unescaped left brace in regex is deprecated, passed through in regex;
marked by <-- HERE in m/^enum { <-- HERE / at -e line 3.
There is one more error like this that I'm getting, but it is because of
GNU automake bug #21001:
https://debbugs.gnu.org/cgi/bugreport.cgi?bug=21001
Signed-off-by: Martin Kletzander <mkletzan(a)redhat.com>
---
src/Makefile.am | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/Makefile.am b/src/Makefile.am
index be63e26abe2f..7338ab95c6ee 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -451,7 +451,7 @@ PDWTAGS = \
$(PERL) -0777 -n \
-e 'foreach my $$p (split m!\n*(?:$(r1)|$(r2))\n!) {' \
-e ' if ($$p =~ /^(struct|enum) $(struct_prefix)/ ||' \
- -e ' $$p =~ /^enum {/) {' \
+ -e ' $$p =~ /^enum \{/) {' \
-e ' $$p =~ s!\t*/\*.*?\*/!!sg;' \
-e ' $$p =~ s!\s+\n!\n!sg;' \
-e ' $$p =~ s!\s+$$!!;' \
--
2.4.5
9 years, 4 months
[libvirt] [PATCH] viraccessperm.h: Fix some typos
by Michal Privoznik
Like s/authoriation/authorization/ and s/requries/requires/
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
Pushed under trivial rule.
src/access/viraccessperm.h | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/access/viraccessperm.h b/src/access/viraccessperm.h
index 0acd156..1817da7 100644
--- a/src/access/viraccessperm.h
+++ b/src/access/viraccessperm.h
@@ -206,7 +206,7 @@ typedef enum {
/**
* @desc: Use domain power management
- * @message: Using domain power management requires authoriation
+ * @message: Using domain power management requires authorization
*/
VIR_ACCESS_PERM_DOMAIN_PM_CONTROL, /* S3/S5 suspend/wakeup */
@@ -220,7 +220,7 @@ typedef enum {
/**
* @desc: Inject domain NMI
- * @message: Injecting interrupt requries authoriation
+ * @message: Injecting interrupt requires authorization
*/
VIR_ACCESS_PERM_DOMAIN_INJECT_NMI, /* Trigger interrupts */
@@ -376,7 +376,7 @@ typedef enum {
/**
* @desc: Write network
- * @message: Writing network configuration requries authorization
+ * @message: Writing network configuration requires authorization
*/
VIR_ACCESS_PERM_NETWORK_WRITE,
--
2.4.5
9 years, 4 months
[libvirt] [libvirt-glib 1/3] Add LibvirtGConfigDomainChardevSourceUnix
by T A Mahadevan
This is needed to be able to add UNIX channels
---
libvirt-gconfig/Makefile.am | 2 +
.../libvirt-gconfig-domain-chardev-source-unix.c | 84 ++++++++++++++++++++++
.../libvirt-gconfig-domain-chardev-source-unix.h | 68 ++++++++++++++++++
libvirt-gconfig/libvirt-gconfig.h | 1 +
libvirt-gconfig/libvirt-gconfig.sym | 7 ++
libvirt-gconfig/tests/test-domain-create.c | 14 ++++
tests/test-gconfig.c | 11 +++
tests/xml/gconfig-domain-device-channel.xml | 3 +
8 files changed, 190 insertions(+)
create mode 100644 libvirt-gconfig/libvirt-gconfig-domain-chardev-source-unix.c
create mode 100644 libvirt-gconfig/libvirt-gconfig-domain-chardev-source-unix.h
diff --git a/libvirt-gconfig/Makefile.am b/libvirt-gconfig/Makefile.am
index a9a6591..77b2032 100644
--- a/libvirt-gconfig/Makefile.am
+++ b/libvirt-gconfig/Makefile.am
@@ -32,6 +32,7 @@ GCONFIG_HEADER_FILES = \
libvirt-gconfig-domain-chardev-source-pty.h \
libvirt-gconfig-domain-chardev-source-spiceport.h \
libvirt-gconfig-domain-chardev-source-spicevmc.h \
+ libvirt-gconfig-domain-chardev-source-unix.h \
libvirt-gconfig-domain-clock.h \
libvirt-gconfig-domain-console.h \
libvirt-gconfig-domain-controller.h \
@@ -122,6 +123,7 @@ GCONFIG_SOURCE_FILES = \
libvirt-gconfig-domain-chardev-source-pty.c \
libvirt-gconfig-domain-chardev-source-spiceport.c \
libvirt-gconfig-domain-chardev-source-spicevmc.c \
+ libvirt-gconfig-domain-chardev-source-unix.c \
libvirt-gconfig-domain-clock.c \
libvirt-gconfig-domain-console.c \
libvirt-gconfig-domain-controller.c \
diff --git a/libvirt-gconfig/libvirt-gconfig-domain-chardev-source-unix.c b/libvirt-gconfig/libvirt-gconfig-domain-chardev-source-unix.c
new file mode 100644
index 0000000..162b788
--- /dev/null
+++ b/libvirt-gconfig/libvirt-gconfig-domain-chardev-source-unix.c
@@ -0,0 +1,84 @@
+/*
+ * libvirt-gconfig-domain-chardev-source-unix.c: libvirt domain chardev unix configuration
+ *
+ * Copyright (C) 2012 Red Hat, Inc.
+ * Copyright (C) 2015 T A Mahadevan
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ * Author: T A Mahadevan <ta.mahadevan(a)gmail.com>
+ */
+
+#include <config.h>
+
+#include "libvirt-gconfig/libvirt-gconfig.h"
+#include "libvirt-gconfig/libvirt-gconfig-private.h"
+
+#define GVIR_CONFIG_DOMAIN_CHARDEV_SOURCE_UNIX_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE((obj), GVIR_CONFIG_TYPE_DOMAIN_CHARDEV_SOURCE_UNIX, GVirConfigDomainChardevSourceUnixPrivate))
+
+struct _GVirConfigDomainChardevSourceUnixPrivate
+{
+ gboolean unused;
+};
+
+G_DEFINE_TYPE(GVirConfigDomainChardevSourceUnix, gvir_config_domain_chardev_source_unix, GVIR_CONFIG_TYPE_DOMAIN_CHARDEV_SOURCE);
+
+
+static void gvir_config_domain_chardev_source_unix_class_init(GVirConfigDomainChardevSourceUnixClass *klass)
+{
+ g_type_class_add_private(klass, sizeof(GVirConfigDomainChardevSourceUnixPrivate));
+}
+
+
+static void gvir_config_domain_chardev_source_unix_init(GVirConfigDomainChardevSourceUnix *source)
+{
+ g_debug("Init GVirConfigDomainChardevSourceUnix=%p", source);
+
+ source->priv = GVIR_CONFIG_DOMAIN_CHARDEV_SOURCE_UNIX_GET_PRIVATE(source);
+}
+
+
+GVirConfigDomainChardevSourceUnix *gvir_config_domain_chardev_source_unix_new(void)
+{
+ GVirConfigObject *object;
+
+ /* the name of the root node is just a placeholder, it will be
+ * overwritten when the GVirConfigDomainChardevSourceUnix is attached to a
+ * GVirConfigDomainChardev
+ */
+ object = gvir_config_object_new(GVIR_CONFIG_TYPE_DOMAIN_CHARDEV_SOURCE_UNIX, "dummy", NULL);
+ gvir_config_object_set_attribute(object, "type", "unix", NULL);
+ return GVIR_CONFIG_DOMAIN_CHARDEV_SOURCE_UNIX(object);
+}
+
+
+GVirConfigDomainChardevSourceUnix *gvir_config_domain_chardev_source_unix_new_from_xml(const gchar *xml,
+ GError **error)
+{
+ GVirConfigObject *object;
+
+ /* the name of the root node is just a placeholder, it will be
+ * overwritten when the GVirConfigDomainChardevSourceUnix is attached to a
+ * GVirConfigDomainChardev
+ */
+ object = gvir_config_object_new_from_xml(GVIR_CONFIG_TYPE_DOMAIN_CHARDEV_SOURCE_UNIX,
+ "dummy", NULL, xml, error);
+ if (g_strcmp0(gvir_config_object_get_attribute(object, NULL, "type"), "unix") != 0) {
+ g_object_unref(G_OBJECT(object));
+ g_return_val_if_reached(NULL);
+ }
+ return GVIR_CONFIG_DOMAIN_CHARDEV_SOURCE_UNIX(object);
+}
diff --git a/libvirt-gconfig/libvirt-gconfig-domain-chardev-source-unix.h b/libvirt-gconfig/libvirt-gconfig-domain-chardev-source-unix.h
new file mode 100644
index 0000000..42891ea
--- /dev/null
+++ b/libvirt-gconfig/libvirt-gconfig-domain-chardev-source-unix.h
@@ -0,0 +1,68 @@
+/*
+ * libvirt-gconfig-domain-chardev-source-unix.h: libvirt domain chardev unix configuration
+ *
+ * Copyright (C) 2012 Red Hat, Inc.
+ * Copyright (C) 2015 T A Mahadevan.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ * Author: T A Mahadevan <ta.mahadevan(a)gmail.com>
+ */
+
+#if !defined(__LIBVIRT_GCONFIG_H__) && !defined(LIBVIRT_GCONFIG_BUILD)
+#error "Only <libvirt-gconfig/libvirt-gconfig.h> can be included directly."
+#endif
+
+#ifndef __LIBVIRT_GCONFIG_DOMAIN_CHARDEV_SOURCE_UNIX_H__
+#define __LIBVIRT_GCONFIG_DOMAIN_CHARDEV_SOURCE_UNIX_H__
+
+G_BEGIN_DECLS
+
+#define GVIR_CONFIG_TYPE_DOMAIN_CHARDEV_SOURCE_UNIX (gvir_config_domain_chardev_source_unix_get_type ())
+#define GVIR_CONFIG_DOMAIN_CHARDEV_SOURCE_UNIX(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GVIR_CONFIG_TYPE_DOMAIN_CHARDEV_SOURCE_UNIX, GVirConfigDomainChardevSourceUnix))
+#define GVIR_CONFIG_DOMAIN_CHARDEV_SOURCE_UNIX_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GVIR_CONFIG_TYPE_DOMAIN_CHARDEV_SOURCE_UNIX, GVirConfigDomainChardevSourceUnixClass))
+#define GVIR_CONFIG_IS_DOMAIN_CHARDEV_SOURCE_UNIX(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GVIR_CONFIG_TYPE_DOMAIN_CHARDEV_SOURCE_UNIX))
+#define GVIR_CONFIG_IS_DOMAIN_CHARDEV_SOURCE_UNIX_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GVIR_CONFIG_TYPE_DOMAIN_CHARDEV_SOURCE_UNIX))
+#define GVIR_CONFIG_DOMAIN_CHARDEV_SOURCE_UNIX_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GVIR_CONFIG_TYPE_DOMAIN_CHARDEV_SOURCE_UNIX, GVirConfigDomainChardevSourceUnixClass))
+
+typedef struct _GVirConfigDomainChardevSourceUnix GVirConfigDomainChardevSourceUnix;
+typedef struct _GVirConfigDomainChardevSourceUnixPrivate GVirConfigDomainChardevSourceUnixPrivate;
+typedef struct _GVirConfigDomainChardevSourceUnixClass GVirConfigDomainChardevSourceUnixClass;
+
+struct _GVirConfigDomainChardevSourceUnix
+{
+ GVirConfigDomainChardevSource parent;
+
+ GVirConfigDomainChardevSourceUnixPrivate *priv;
+
+ /* Do not add fields to this struct */
+};
+
+struct _GVirConfigDomainChardevSourceUnixClass
+{
+ GVirConfigDomainChardevSourceClass parent_class;
+
+ gpointer padding[20];
+};
+
+
+GType gvir_config_domain_chardev_source_unix_get_type(void);
+
+GVirConfigDomainChardevSourceUnix *gvir_config_domain_chardev_source_unix_new(void);
+GVirConfigDomainChardevSourceUnix *gvir_config_domain_chardev_source_unix_new_from_xml(const gchar *xml,
+ GError **error);
+G_END_DECLS
+
+#endif /* __LIBVIRT_GCONFIG_DOMAIN_CHARDEV_SOURCE_UNIX_H__ */
diff --git a/libvirt-gconfig/libvirt-gconfig.h b/libvirt-gconfig/libvirt-gconfig.h
index afb9b7b..4624003 100644
--- a/libvirt-gconfig/libvirt-gconfig.h
+++ b/libvirt-gconfig/libvirt-gconfig.h
@@ -48,6 +48,7 @@
#include <libvirt-gconfig/libvirt-gconfig-domain-chardev-source-pty.h>
#include <libvirt-gconfig/libvirt-gconfig-domain-chardev-source-spiceport.h>
#include <libvirt-gconfig/libvirt-gconfig-domain-chardev-source-spicevmc.h>
+#include <libvirt-gconfig/libvirt-gconfig-domain-chardev-source-unix.h>
#include <libvirt-gconfig/libvirt-gconfig-domain-channel.h>
#include <libvirt-gconfig/libvirt-gconfig-domain-clock.h>
#include <libvirt-gconfig/libvirt-gconfig-domain-console.h>
diff --git a/libvirt-gconfig/libvirt-gconfig.sym b/libvirt-gconfig/libvirt-gconfig.sym
index 6ce1511..6267197 100644
--- a/libvirt-gconfig/libvirt-gconfig.sym
+++ b/libvirt-gconfig/libvirt-gconfig.sym
@@ -724,4 +724,11 @@ global:
gvir_config_domain_filesys_set_driver_format;
} LIBVIRT_GCONFIG_0.2.0;
+LIBVIRT_GCONFIG_0.2.2 {
+global:
+ gvir_config_domain_chardev_source_unix_get_type;
+ gvir_config_domain_chardev_source_unix_new;
+ gvir_config_domain_chardev_source_unix_new_from_xml;
+} LIBVIRT_GCONFIG_0.2.1;
+
# .... define new API here using predicted next version number ....
diff --git a/libvirt-gconfig/tests/test-domain-create.c b/libvirt-gconfig/tests/test-domain-create.c
index 1a512de..79c242f 100644
--- a/libvirt-gconfig/tests/test-domain-create.c
+++ b/libvirt-gconfig/tests/test-domain-create.c
@@ -401,6 +401,20 @@ int main(int argc, char **argv)
redirdev = create_redirdev(0, 5);
devices = g_list_append(devices, GVIR_CONFIG_DOMAIN_DEVICE(redirdev));
+ /* unix channel */
+ GVirConfigDomainChardevSourceUnix *unix_source;
+
+ channel = gvir_config_domain_channel_new();
+ gvir_config_domain_channel_set_target_type(channel,
+ GVIR_CONFIG_DOMAIN_CHANNEL_TARGET_VIRTIO);
+ gvir_config_domain_channel_set_target_name(channel, "org.qemu.guest_agent.0");
+ unix_source = gvir_config_domain_chardev_source_unix_new();
+ gvir_config_domain_chardev_set_source(GVIR_CONFIG_DOMAIN_CHARDEV(channel),
+ GVIR_CONFIG_DOMAIN_CHARDEV_SOURCE(unix_source));
+ g_object_unref(G_OBJECT(unix_source));
+ devices = g_list_append(devices, GVIR_CONFIG_DOMAIN_DEVICE(channel));
+
+
gvir_config_domain_set_devices(domain, devices);
g_list_foreach(devices, (GFunc)g_object_unref, NULL);
g_list_free(devices);
diff --git a/tests/test-gconfig.c b/tests/test-gconfig.c
index bd2daa6..606c7ef 100644
--- a/tests/test-gconfig.c
+++ b/tests/test-gconfig.c
@@ -546,6 +546,7 @@ static void test_domain_device_channel(void)
GVirConfigDomainChannel *channel;
GVirConfigDomainChardevSourceSpiceVmc *spicevmc;
GVirConfigDomainChardevSourceSpicePort *spiceport;
+ GVirConfigDomainChardevSourceUnix *unix_source;
channel = gvir_config_domain_channel_new();
gvir_config_domain_channel_set_target_type(channel,
@@ -570,6 +571,16 @@ static void test_domain_device_channel(void)
gvir_config_domain_add_device(domain, GVIR_CONFIG_DOMAIN_DEVICE(channel));
g_object_unref(G_OBJECT(channel));
+ channel = gvir_config_domain_channel_new();
+ gvir_config_domain_channel_set_target_type(channel,
+ GVIR_CONFIG_DOMAIN_CHANNEL_TARGET_VIRTIO);
+ gvir_config_domain_channel_set_target_name(channel, "org.qemu.guest_agent.0");
+ unix_source = gvir_config_domain_chardev_source_unix_new();
+ gvir_config_domain_chardev_set_source(GVIR_CONFIG_DOMAIN_CHARDEV(channel),
+ GVIR_CONFIG_DOMAIN_CHARDEV_SOURCE(unix_source));
+ g_object_unref(G_OBJECT(unix_source));
+ gvir_config_domain_add_device(domain, GVIR_CONFIG_DOMAIN_DEVICE(channel));
+ g_object_unref(G_OBJECT(channel));
check_xml(domain, "gconfig-domain-device-channel.xml");
g_object_unref(G_OBJECT(domain));
diff --git a/tests/xml/gconfig-domain-device-channel.xml b/tests/xml/gconfig-domain-device-channel.xml
index 27dd28a..583d8be 100644
--- a/tests/xml/gconfig-domain-device-channel.xml
+++ b/tests/xml/gconfig-domain-device-channel.xml
@@ -7,5 +7,8 @@
<target type="virtio" name="org.spice-space.webdav.0"/>
<source channel="org.spice-space.webdav.0"/>
</channel>
+ <channel type="unix">
+ <target type="virtio" name="org.qemu.guest_agent.0"/>
+ </channel>
</devices>
</domain>
--
1.9.1
9 years, 4 months
[libvirt] [PATCH 0/6] storage: fs: tweak dir perms handling on build
by Cole Robinson
Consider the following issue
- Using virt-manager with qemu:///session
- User adds a storage pool pointing at /tmp. No explicit permissions are
requested in the XML
- virt-manager calls PoolDefine, then PoolBuild
- libvirt tries to unconditionally chmod 755 /tmp. This fails because my
user doesn't own root. Pool build fails, virt-manager reports failure
Yes there's a couple ways we could avoid this specific case in
virt-manager, but I think it makes more sense to have pool.build on
a directory be a no-op in this case. The following patches address this.
- Patch 1 is an error reporting tweak
- Patch 2 is a feature, but implementing it simplifies later patches
- Patch 3 makes pool.build not even attempt mkdir if the dir already exists.
- Patch 4 makes pool.build skip dir chown'ing unless user explicitly
requested uid or gid via the XML
- Patch 5-6 make pool.build skip dir chmod unless the user explicitly
requested <mode> via the XML. If a mode is required for mkdir, continue
to use the previous default.
Cole Robinson (6):
storage: fs: Don't overwrite virDirCreate error
storage: fs: Fill in permissions on pool refresh
storage: fs: Don't attempt directory creation if it already exists
storage: fs: Don't try to chown directory unless user requested
storage: conf: Don't set any default <mode> in the XML
storage: fs: Only force directory permissions if required
docs/schemas/storagecommon.rng | 5 +-
src/conf/storage_conf.c | 42 +++++------
src/storage/storage_backend.c | 20 ++++--
src/storage/storage_backend.h | 3 +
src/storage/storage_backend_fs.c | 81 ++++++++++++++++------
src/storage/storage_backend_logical.c | 4 +-
src/util/virfile.c | 47 ++++++++-----
tests/storagepoolxml2xmlin/pool-dir.xml | 2 +-
tests/storagepoolxml2xmlout/pool-dir.xml | 2 +-
tests/storagepoolxml2xmlout/pool-netfs-gluster.xml | 2 +-
tests/storagevolxml2xmlin/vol-file.xml | 6 +-
tests/storagevolxml2xmlout/vol-file.xml | 6 +-
tests/storagevolxml2xmlout/vol-gluster-dir.xml | 2 +-
tests/storagevolxml2xmlout/vol-sheepdog.xml | 2 +-
14 files changed, 147 insertions(+), 77 deletions(-)
--
2.3.6
9 years, 4 months
[libvirt] [PATCH] docs: Document how libvirt handles companion controllers
by Martin Kletzander
The information on companion controllers we give in our documentation is
rather sparse. For example, it looks like any controller can be used as
a companion one. Also, when using ich9-uhci2, for example, we are able
to set some sensible defaults, but it might get confusing for the user
as we don't do that for all controller models.
https://bugzilla.redhat.com/show_bug.cgi?id=1069590
Signed-off-by: Martin Kletzander <mkletzan(a)redhat.com>
---
docs/formatdomain.html.in | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index 8cd8d09d204c..d0c174105081 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -3005,6 +3005,11 @@
relationship of the companion to its master controller.
A companion controller is on the same bus as its master, so
the companion <code>index</code> value should be equal.
+ Not all controller models can be used as companion controllers
+ and libvirt might provide some sensible defaults (settings
+ of <code>master startport</code> and <code>function</code> of an
+ address) for some particular models.
+ Preferred companion controllers are <code>ich-uhci[123]</code>.
</p>
<pre>
--
2.4.5
9 years, 4 months
[libvirt] [PATCH] rbd: Use RBD format 2 by default when creating images.
by Wido den Hollander
We used to look at the librbd code version and depending on that
we would invoke rbd_create3() or rbd_create().
Since librbd version 0.67.9 we can however tell RBD that it should
create rbd format 2 images even if we invoke rbd_create().
The less options we pass to librbd, the more we can lean on the sane
defaults it uses.
For rbd_create3() we had things like the stripe count and unit hardcoded
in libvirt and that might cause problems down the road.
Signed-off-by: Wido den Hollander <wido(a)widodh.nl>
---
src/storage/storage_backend_rbd.c | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/src/storage/storage_backend_rbd.c b/src/storage/storage_backend_rbd.c
index 8e8d7a7..936ad18 100644
--- a/src/storage/storage_backend_rbd.c
+++ b/src/storage/storage_backend_rbd.c
@@ -66,6 +66,7 @@ static int virStorageBackendRBDOpenRADOSConn(virStorageBackendRBDStatePtr ptr,
const char *client_mount_timeout = "30";
const char *mon_op_timeout = "30";
const char *osd_op_timeout = "30";
+ const char *rbd_default_format = "2";
if (authdef) {
VIR_DEBUG("Using cephx authorization, username: %s", authdef->username);
@@ -211,6 +212,14 @@ static int virStorageBackendRBDOpenRADOSConn(virStorageBackendRBDStatePtr ptr,
VIR_DEBUG("Setting RADOS option rados_osd_op_timeout to %s", osd_op_timeout);
rados_conf_set(ptr->cluster, "rados_osd_op_timeout", osd_op_timeout);
+ /*
+ * Librbd supports creating RBD format 2 images. We no longer have to invoke
+ * rbd_create3(), we can tell librbd to default to format 2.
+ * This leaves us to simply use rbd_create() and use the default behavior of librbd
+ */
+ VIR_DEBUG("Setting RADOS option rbd_default_format to %s", rbd_default_format);
+ rados_conf_set(ptr->cluster, "rbd_default_format", rbd_default_format);
+
ptr->starttime = time(0);
r = rados_connect(ptr->cluster);
if (r < 0) {
@@ -475,16 +484,7 @@ static int virStorageBackendRBDCreateImage(rados_ioctx_t io,
char *name, long capacity)
{
int order = 0;
-#if LIBRBD_VERSION_CODE > 260
- uint64_t features = 3;
- uint64_t stripe_count = 1;
- uint64_t stripe_unit = 4194304;
-
- if (rbd_create3(io, name, capacity, features, &order,
- stripe_unit, stripe_count) < 0) {
-#else
if (rbd_create(io, name, capacity, &order) < 0) {
-#endif
return -1;
}
--
1.9.1
9 years, 4 months
[libvirt] [libvirt-python][PATCH v2] examples: Introduce nodestats example
by Michal Privoznik
So, this is an exercise to show libvirt capabilities. Firstly, for
each host NUMA nodes some statistics are printed out, i.e. total
memory and free memory. Then, for each running domain, that has memory
strictly bound to certain host nodes, a small statistics of how much
memory it takes is printed out too. For instance:
# ./examples/nodestats.py
NUMA stats
NUMA nodes: 0 1 2 3
MemTotal: 3950 3967 3937 3943
MemFree: 66 56 42 41
Domain 'fedora':
Overall memory: 1536 MiB nodes
Domain 'fedora22':
Overall memory: 2048 MiB nodes
Domain 'fedora21':
Overall memory: 1024 MiB nodes 0-1
Node 0: 1024 MiB nodes 0-1
Domain 'gentoo':
Overall memory: 4096 MiB nodes 0-3
Node 0: 1024 MiB nodes 0
Node 1: 1024 MiB nodes 1
Node 2: 1024 MiB nodes 2
Node 3: 1024 MiB nodes 3
We can see 4 host NUMA nodes, all of them having roughly 4GB of RAM.
Yeah, all of them has nearly all the memory consumed. Then, there are
four domains running. For instance, domain 'fedora' has 1.5GB memory
which is not pinned onto any specific host NUMA node. Domain 'gentoo' on
the other hand has 4GB memory and has 4 NUMA nodes which are pinned 1:1
to host nodes.
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
diff to v1:
- Martin review suggestions worked in
- Changed the format of printing per-domain stats
examples/nodestats.py | 80 +++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 80 insertions(+)
create mode 100755 examples/nodestats.py
diff --git a/examples/nodestats.py b/examples/nodestats.py
new file mode 100755
index 0000000..4a58268
--- /dev/null
+++ b/examples/nodestats.py
@@ -0,0 +1,80 @@
+#!/usr/bin/env python
+# Print some host NUMA node statistics
+#
+# Authors:
+# Michal Privoznik <mprivozn(a)redhat.com>
+
+import libvirt
+import sys
+from xml.dom import minidom
+import libxml2
+
+def xpath_eval(ctxt, path):
+ res = ctxt.xpathEval(path)
+ if res is None or len(res) == 0:
+ value = None
+ else:
+ value = res[0].content
+ return value
+
+try:
+ conn = libvirt.openReadOnly(None)
+except libvirt.libvirtError:
+ print("Failed to connect to the hypervisor")
+ sys.exit(1)
+
+try:
+ capsXML = conn.getCapabilities()
+except libvirt.libvirtError:
+ print("Failed to request capabilities")
+ sys.exit(1)
+
+caps = minidom.parseString(capsXML)
+cells = caps.getElementsByTagName("cells")[0]
+
+nodesIDs = [ int(proc.getAttribute("id"))
+ for proc in cells.getElementsByTagName("cell") ]
+
+nodesMem = [ conn.getMemoryStats(int(proc))
+ for proc in nodesIDs]
+
+doms = conn.listAllDomains(libvirt.VIR_CONNECT_LIST_DOMAINS_ACTIVE)
+
+domsStrict = [ proc
+ for proc in doms
+ if proc.numaParameters()["numa_mode"] == libvirt.VIR_DOMAIN_NUMATUNE_MEM_STRICT ]
+
+domsStrictCfg = {}
+for dom in domsStrict:
+ xmlStr = dom.XMLDesc()
+ doc = libxml2.parseDoc(xmlStr)
+ ctxt = doc.xpathNewContext()
+
+ domsStrictCfg[dom] = {}
+
+ pin = ctxt.xpathEval("string(/domain/numatune/memory/@nodeset)")
+ memsize = ctxt.xpathEval("string(/domain/memory)")
+ domsStrictCfg[dom]["memory"] = {"size": int(memsize), "pin": pin}
+
+ for memnode in ctxt.xpathEval("/domain/numatune/memnode"):
+ ctxt.setContextNode(memnode)
+ cellid = xpath_eval(ctxt, "@cellid")
+ nodeset = xpath_eval(ctxt, "@nodeset")
+
+ nodesize = xpath_eval(ctxt, "/domain/cpu/numa/cell[@id='%s']/@memory" % cellid)
+ domsStrictCfg[dom][cellid] = {"size": int(nodesize), "pin": nodeset}
+
+
+print("NUMA stats")
+print("NUMA nodes:\t" + "\t".join(str(node) for node in nodesIDs))
+print("MemTotal:\t" + "\t".join(str(i.get("total") // 1024) for i in nodesMem))
+print("MemFree:\t" + "\t".join(str(i.get("free") // 1024) for i in nodesMem))
+
+for dom, v in domsStrictCfg.items():
+ print("Domain '%s':\t" % dom.name())
+ print("\tOverall memory: %d MiB nodes %s" % (v["memory"]["size"] // 1024, v["memory"]["pin"]))
+
+ for k, node in sorted(v.items()):
+ if k is "memory":
+ continue
+ print("\tNode %s:\t%d MiB nodes %s" % (k, node["size"] // 1024, node["pin"]))
--
2.3.6
9 years, 4 months
[libvirt] [PATCH v2] virsh: Don't output node frequency if unknown
by Martin Kletzander
Commit ed8155eafbff5c5ca0bdfe84a8388f58b718c2f9 documented that mhz
field in virNodeInfo might be 0 if the frequency is unknown. Modify
virsh to know about that.
Signed-off-by: Martin Kletzander <mkletzan(a)redhat.com>
---
v2:
- added info into manual and reworded that a bit
tools/virsh-host.c | 3 ++-
tools/virsh.pod | 3 ++-
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/tools/virsh-host.c b/tools/virsh-host.c
index 04ca1e504731..a3ffe0143f11 100644
--- a/tools/virsh-host.c
+++ b/tools/virsh-host.c
@@ -637,7 +637,8 @@ cmdNodeinfo(vshControl *ctl, const vshCmd *cmd ATTRIBUTE_UNUSED)
}
vshPrint(ctl, "%-20s %s\n", _("CPU model:"), info.model);
vshPrint(ctl, "%-20s %d\n", _("CPU(s):"), info.cpus);
- vshPrint(ctl, "%-20s %d MHz\n", _("CPU frequency:"), info.mhz);
+ if (info.mhz)
+ vshPrint(ctl, "%-20s %d MHz\n", _("CPU frequency:"), info.mhz);
vshPrint(ctl, "%-20s %d\n", _("CPU socket(s):"), info.sockets);
vshPrint(ctl, "%-20s %d\n", _("Core(s) per socket:"), info.cores);
vshPrint(ctl, "%-20s %d\n", _("Thread(s) per core:"), info.threads);
diff --git a/tools/virsh.pod b/tools/virsh.pod
index bcfa165ada15..5ee9a966ef02 100644
--- a/tools/virsh.pod
+++ b/tools/virsh.pod
@@ -295,7 +295,8 @@ Print the XML representation of the hypervisor sysinfo, if available.
Returns basic information about the node, like number and type of CPU,
and size of the physical memory. The output corresponds to virNodeInfo
structure. Specifically, the "CPU socket(s)" field means number of CPU
-sockets per NUMA cell.
+sockets per NUMA cell. The information libvirt displays is dependent
+upon what each architecture may provide.
=item B<nodecpumap> [I<--pretty>]
--
2.4.5
9 years, 4 months