[libvirt] Sparse image volDownload
by Michal Privoznik
Dear list,
I'd like to hear your opinion on the following bug:
https://bugzilla.redhat.com/show_bug.cgi?id=1282859
Long story short, Imagine the following scenario:
1. Create 4GB file full of zeroes
2. virsh vol-download it
What happens is that all those 4GB are transferred byte after byte
through our RPC system. Not only this puts needles pressure on our event
loop, it's suboptimal for network and other resources too.
I'd like to explore our options here keeping in mind that the original
volume might have been sparse and we ought to keep it sparse on the
destination too.
In the bug the reporter (Matthew Booth) suggests introducing new type of
RPC message that will let us keep our APIs unchanged. The source will
scan the file for windows of zeroes bigger than some value. When found
the new type of message is passed to client without need to copy those
zeroes. Yes, this is very similar to RLE.
If we are going that way, should we enable users to put a compression
program in between read()/write() and our RPC? Well, should we let users
to choose what compression program we will put there? Because there are
better compression algorithms than RLE.
Michal
8 years, 11 months
[libvirt] [PATCH] rpm: explicitly enable & start virtlogd on install
by Daniel P. Berrange
When installing the libvirt-daemon RPM, we have a %post rule to
enable the libvirtd.service, virtlockd.socket and virtlogd.socket
files. This is only done, however, when the RPM is first installed,
not when upgrading RPMs. So virtlogd will not get activated on
upgrading, which is a problem as libvirt qemu driver will expect
it to be available by default.
This adds a trigger that is run when uninstalling libvirt-daemon
older than 1.3.0 that will enable & start virtlogd.socket if
libvirtd is enabled and/or started. Using the trigger rather
than %post ensures that it only runs once, allowing admins to
disable it explicitly thereafter without future upgrades
re-enabling it.
Signed-off-by: Daniel P. Berrange <berrange(a)redhat.com>
---
libvirt.spec.in | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/libvirt.spec.in b/libvirt.spec.in
index 1f76f24..ff25881 100644
--- a/libvirt.spec.in
+++ b/libvirt.spec.in
@@ -1779,6 +1779,25 @@ if [ "$1" -ge "1" ]; then
fi
%endif
+# In upgrade scenario we must explicitly enable virtlockd/virtlogd
+# sockets, if libvirtd is already enabled and start them if
+# libvirtd is running, otherwise you'll get failures to start
+# guests
+%triggerpostun daemon -- libvirt-daemon < 1.3.0
+if [ $1 -ge 1 ] ; then
+ %if %{with_systemd}
+ /bin/systemctl is-enabled libvirtd.service 1>/dev/null 2>&1 &&
+ /bin/systemctl enable virtlogd.socket || :
+ /bin/systemctl is-active libvirtd.service 1>/dev/null 2>&1 &&
+ /bin/systemctl start virtlogd.socket || :
+ %else
+ /sbin/chkconfig libvirtd 1>/dev/null 2>&1 &&
+ /bin/chkconfig virtlogd on || :
+ /sbin/service libvirtd status 1>/dev/null 2>&1 &&
+ /bin/service virtlogd start || :
+ %endif
+fi
+
%if %{with_network}
%post daemon-config-network
if test $1 -eq 1 && test ! -f %{_sysconfdir}/libvirt/qemu/networks/default.xml ; then
--
2.5.0
8 years, 11 months
[libvirt] libvirt-php 0.5.1 uneeded files
by Remi Collet
Installing the new 0.5.1 version:
libvirt-php.la
libvirt-php.so -> libvirt-php.so.0.0.0
libvirt-php.so.0 -> libvirt-php.so.0.0.0
libvirt-php.so.0.0.0
This is not a versioned library but a PHP extension so having those
have no sense.
Only libvirt-php.so is needed.
Notice: I think it will be simpler to switch to the standard PHP
extension build system (phpize; configure; make)
Especially, this will allow to use the --with-php-config option (an
thus, build for not standard PHP, e.g. TS build or SCL build)
Remi.
8 years, 11 months
[libvirt] [PATCH] libvirtd: enable virtlockd/virtlogd socket activation on install
by Daniel P. Berrange
When someone does 'systemctl enable libvirtd.service' we should
also enable virtlockd.socket/virtlogd.socket, so that they can
be auto-activated if libvirtd tries to access the sockets.
Without this, people have to manually enable the units themselves
via 'systemctl enable virtdlogd.socket'.
This also ensures that if distros uses 'systemctl preset' for
enabling 'libvirtd.service', then the virtdlogd.socket gets
enabled without having to wait for the distro to update their
presets file.
Signed-off-by: Daniel P. Berrange <berrange(a)redhat.com>
---
daemon/libvirtd.service.in | 2 ++
1 file changed, 2 insertions(+)
diff --git a/daemon/libvirtd.service.in b/daemon/libvirtd.service.in
index 9e67e43..608221c 100644
--- a/daemon/libvirtd.service.in
+++ b/daemon/libvirtd.service.in
@@ -22,3 +22,5 @@ Restart=on-failure
[Install]
WantedBy=multi-user.target
+Also=virtlockd.socket
+Also=virtlogd.socket
--
2.5.0
8 years, 11 months
[libvirt] [libvirt-glib][PATCH] Drop unused finalize function
by Michal Privoznik
After 1225a160ac3b4 where I'm dropping some unused variables, the
functions I was touching became sort of redundant too.
Specifically, gvir_domain_disk_finalize() and
gvir_domain_interface_finalize().
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
libvirt-gobject/libvirt-gobject-domain-disk.c | 8 --------
libvirt-gobject/libvirt-gobject-domain-interface.c | 8 --------
2 files changed, 16 deletions(-)
diff --git a/libvirt-gobject/libvirt-gobject-domain-disk.c b/libvirt-gobject/libvirt-gobject-domain-disk.c
index 7f34ebd..bb2a682 100644
--- a/libvirt-gobject/libvirt-gobject-domain-disk.c
+++ b/libvirt-gobject/libvirt-gobject-domain-disk.c
@@ -49,16 +49,8 @@ gvir_domain_disk_error_quark(void)
return g_quark_from_static_string("gvir-domain-disk");
}
-static void gvir_domain_disk_finalize(GObject *object)
-{
- G_OBJECT_CLASS(gvir_domain_disk_parent_class)->finalize(object);
-}
-
static void gvir_domain_disk_class_init(GVirDomainDiskClass *klass)
{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
-
- object_class->finalize = gvir_domain_disk_finalize;
g_type_class_add_private(klass, sizeof(GVirDomainDiskPrivate));
}
diff --git a/libvirt-gobject/libvirt-gobject-domain-interface.c b/libvirt-gobject/libvirt-gobject-domain-interface.c
index 443a2b6..beae11e 100644
--- a/libvirt-gobject/libvirt-gobject-domain-interface.c
+++ b/libvirt-gobject/libvirt-gobject-domain-interface.c
@@ -49,16 +49,8 @@ gvir_domain_interface_error_quark(void)
return g_quark_from_static_string("gvir-domain-interface");
}
-static void gvir_domain_interface_finalize(GObject *object)
-{
- G_OBJECT_CLASS(gvir_domain_interface_parent_class)->finalize(object);
-}
-
static void gvir_domain_interface_class_init(GVirDomainInterfaceClass *klass)
{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
-
- object_class->finalize = gvir_domain_interface_finalize;
g_type_class_add_private(klass, sizeof(GVirDomainInterfacePrivate));
}
--
2.4.10
8 years, 11 months
[libvirt] [libvirt-glib][PATCH] gobject: Drop some unused variables
by Michal Privoznik
After abe983ddf8a569 there are some variables, that are unused:
CC libvirt_gobject_1_0_la-libvirt-gobject-domain-disk.lo
CC libvirt_gobject_1_0_la-libvirt-gobject-domain-interface.lo
CC libvirt_gobject_1_0_la-libvirt-gobject-domain.lo
CC libvirt_gobject_1_0_la-libvirt-gobject-interface.lo
../../libvirt-gobject/libvirt-gobject-domain-interface.c: In function 'gvir_domain_interface_finalize':
../../libvirt-gobject/libvirt-gobject-domain-interface.c:54:26: error: unused variable 'self' [-Werror=unused-variable]
GVirDomainInterface *self = GVIR_DOMAIN_INTERFACE(object);
^
cc1: all warnings being treated as errors
Makefile:724: recipe for target 'libvirt_gobject_1_0_la-libvirt-gobject-domain-interface.lo' failed
make[3]: *** [libvirt_gobject_1_0_la-libvirt-gobject-domain-interface.lo] Error 1
make[3]: *** Waiting for unfinished jobs....
../../libvirt-gobject/libvirt-gobject-domain-disk.c: In function 'gvir_domain_disk_finalize':
../../libvirt-gobject/libvirt-gobject-domain-disk.c:54:21: error: unused variable 'self' [-Werror=unused-variable]
GVirDomainDisk *self = GVIR_DOMAIN_DISK(object);
^
cc1: all warnings being treated as errors
Makefile:717: recipe for target 'libvirt_gobject_1_0_la-libvirt-gobject-domain-disk.lo' failed
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
Pushed under trivial rule.
libvirt-gobject/libvirt-gobject-domain-disk.c | 2 --
libvirt-gobject/libvirt-gobject-domain-interface.c | 2 --
2 files changed, 4 deletions(-)
diff --git a/libvirt-gobject/libvirt-gobject-domain-disk.c b/libvirt-gobject/libvirt-gobject-domain-disk.c
index 770acff..7f34ebd 100644
--- a/libvirt-gobject/libvirt-gobject-domain-disk.c
+++ b/libvirt-gobject/libvirt-gobject-domain-disk.c
@@ -51,8 +51,6 @@ gvir_domain_disk_error_quark(void)
static void gvir_domain_disk_finalize(GObject *object)
{
- GVirDomainDisk *self = GVIR_DOMAIN_DISK(object);
-
G_OBJECT_CLASS(gvir_domain_disk_parent_class)->finalize(object);
}
diff --git a/libvirt-gobject/libvirt-gobject-domain-interface.c b/libvirt-gobject/libvirt-gobject-domain-interface.c
index 57896fd..443a2b6 100644
--- a/libvirt-gobject/libvirt-gobject-domain-interface.c
+++ b/libvirt-gobject/libvirt-gobject-domain-interface.c
@@ -51,8 +51,6 @@ gvir_domain_interface_error_quark(void)
static void gvir_domain_interface_finalize(GObject *object)
{
- GVirDomainInterface *self = GVIR_DOMAIN_INTERFACE(object);
-
G_OBJECT_CLASS(gvir_domain_interface_parent_class)->finalize(object);
}
--
2.4.10
8 years, 11 months
[libvirt] [PATCH v2] libxl: free ifname on libxlDomainMigrationPrepareDef
by Joao Martins
Commit d2e5538b1 changes virDomainDef to include ifnames
that autogenerated by libxl, and that are also cleared
on domain cleanup. One place that's missing is on
migration, when domain xml is sent to dst libvirtd and
would contain ifnames from the source libvirtd. This
would lead to erronous behaviour (as seen in osstest CI)
such as failing to migrate when a vif with the same name
existed (belonging to another domain) on destination.
This patch adds a helper libxlDomainFreeIfaceNames for
clearing ifnames on both migration prepare phase and domain
cleanup. It is done on prepare phase so that we don't affect
source domain (specially in cases when the migration fails),
while still allowing interface stats to be consulted during
the migration.
Signed-off-by: Joao Martins <joao.m.martins(a)oracle.com>
---
Changes since v1:
- Commit message is changed
- Clear ifnames on prepare phase as opposed to begin phase.
---
src/libxl/libxl_domain.c | 32 ++++++++++++++++++++++----------
src/libxl/libxl_domain.h | 3 +++
src/libxl/libxl_migration.c | 2 ++
3 files changed, 27 insertions(+), 10 deletions(-)
diff --git a/src/libxl/libxl_domain.c b/src/libxl/libxl_domain.c
index ef92974..487589d 100644
--- a/src/libxl/libxl_domain.c
+++ b/src/libxl/libxl_domain.c
@@ -728,16 +728,7 @@ libxlDomainCleanup(libxlDriverPrivatePtr driver,
}
}
- if ((vm->def->nnets)) {
- size_t i;
-
- for (i = 0; i < vm->def->nnets; i++) {
- virDomainNetDefPtr net = vm->def->nets[i];
-
- if (STRPREFIX(net->ifname, "vif"))
- VIR_FREE(net->ifname);
- }
- }
+ libxlDomainFreeIfaceNames(vm->def);
if (virAsprintf(&file, "%s/%s.xml", cfg->stateDir, vm->def->name) > 0) {
if (unlink(file) < 0 && errno != ENOENT && errno != ENOTDIR)
@@ -923,6 +914,27 @@ libxlDomainCreateIfaceNames(virDomainDefPtr def, libxl_domain_config *d_config)
}
}
+/*
+ * Removes autogenerated interface names for the network devices in
+ * parameter def. User-provided interface names are skipped.
+ */
+void
+libxlDomainFreeIfaceNames(virDomainDefPtr def)
+{
+ size_t i;
+
+ for (i = 0; i < def->nnets; i++) {
+ virDomainNetDefPtr net = def->nets[i];
+
+ if (!net->ifname)
+ continue;
+
+ if (STRPREFIX(net->ifname, "vif"))
+ VIR_FREE(net->ifname);
+ }
+}
+
+
/*
* Start a domain through libxenlight.
diff --git a/src/libxl/libxl_domain.h b/src/libxl/libxl_domain.h
index 44b3e0b..70c139c 100644
--- a/src/libxl/libxl_domain.h
+++ b/src/libxl/libxl_domain.h
@@ -135,6 +135,9 @@ int
libxlDomainSetVcpuAffinities(libxlDriverPrivatePtr driver,
virDomainObjPtr vm);
+void
+libxlDomainFreeIfaceNames(virDomainDefPtr def);
+
int
libxlDomainStart(libxlDriverPrivatePtr driver,
virDomainObjPtr vm,
diff --git a/src/libxl/libxl_migration.c b/src/libxl/libxl_migration.c
index 0d23e5f..1ca31ab 100644
--- a/src/libxl/libxl_migration.c
+++ b/src/libxl/libxl_migration.c
@@ -288,6 +288,8 @@ libxlDomainMigrationPrepareDef(libxlDriverPrivatePtr driver,
VIR_DOMAIN_DEF_PARSE_INACTIVE)))
goto cleanup;
+ libxlDomainFreeIfaceNames(def);
+
if (dname) {
name = def->name;
if (VIR_STRDUP(def->name, dname) < 0) {
--
2.1.4
8 years, 11 months
[libvirt] [PATCH RFC 0/3] Add a "flags" element to storage pool source
by John Ferlan
https://bugzilla.redhat.com/show_bug.cgi?id=1265694
Posting as an RFC mainly to get buyin/feedback over the concept of using
a <flags> field in the <pool> <source> as a way to allow or direct the
pool/storage backend code to use specific algorithms.
The issue is described in the bz, but the shorter version is the disk
backend needs a way to tell libvirt_parthelper to format output for
dm-multipath volumes in a slight different manner. In order to do that
I chose a new flag to call libvirt_parthelper to indicate the way to
output, but I needed a way to have the disk backend determine whether
to add the flag or not. Could have read /etc/multipath.conf - not a
good option... Don't want to read their config file. If there was an
API to get that data, it would have been nice, but then we'd have to
rely on a specific version of multipath that had the API (a dependency
that we don't want). So I chose to roll our own.
I figure there could be other uses of such kind of flags - for example
currently logical volume pools use a model of thin volume support that
is "older". A newer model is there, but IIRC the "format" of the lvs
output wouldn't mesh. So if there was a way to say, use this format of
support in preference, then we could easily add that support with the
caveat that one couldn't expect an "old" thin pool to work. IOW, use
the much improved algorithm knowing that it's a "new" pool rather than
having to mess with "conversions"... Perhaps other pools may find uses,
but this one came to mind since I have a long dormant set of changes
that uses the new thin pool options...
John Ferlan (3):
conf: Add flags to the storage pool source
storage: Add new flag for libvirt_parthelper
conf: Parse/use a flags argument in the storage pool xml
docs/formatstorage.html.in | 33 ++++++++++++++++++++
docs/schemas/storagepool.rng | 9 ++++++
src/conf/storage_conf.c | 41 +++++++++++++++++++++++++
src/conf/storage_conf.h | 11 +++++++
src/storage/parthelper.c | 15 +++++++--
src/storage/storage_backend_disk.c | 7 +++++
tests/storagepoolxml2xmlin/pool-disk-flags.xml | 15 +++++++++
tests/storagepoolxml2xmlout/pool-disk-flags.xml | 15 +++++++++
tests/storagepoolxml2xmltest.c | 1 +
9 files changed, 144 insertions(+), 3 deletions(-)
create mode 100644 tests/storagepoolxml2xmlin/pool-disk-flags.xml
create mode 100644 tests/storagepoolxml2xmlout/pool-disk-flags.xml
--
2.5.0
8 years, 11 months
[libvirt] [PATCH] doc: extend virDomainSetMemory semantics
by Nikolay Shirokovskiy
virDomainSetMemory is documented to change only runtime configuration of
running domain. This can't be implemented for vz driver as it always change
persistent state too. Let's extend semantics of this function for changes to be
hyperviror specific. As a result 'virsh setmem' without parameters (which ends
up in virDomainSetMemory call) would be possible for a vz domain. By the way,
virsh documentation for this case states that behaviour is hypervisor specific
already.
Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy(a)virtuozzo.com>
---
src/libvirt-domain.c | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/libvirt-domain.c b/src/libvirt-domain.c
index de7eb04..56ab907 100644
--- a/src/libvirt-domain.c
+++ b/src/libvirt-domain.c
@@ -1882,8 +1882,9 @@ virDomainSetMaxMemory(virDomainPtr domain, unsigned long memory)
* to Domain0 i.e. the domain where the application runs.
* This function may require privileged access to the hypervisor.
*
- * This command only changes the runtime configuration of the domain,
- * so can only be called on an active domain.
+ * This command is hypervisor-specific for whether active, persistent,
+ * or both configurations are changed; for more control, use
+ * virDomainSetMemoryFlags().
*
* Returns 0 in case of success and -1 in case of failure.
*/
--
1.7.1
8 years, 11 months