[libvirt] [PATCH] ruby-libvirt: Don't crash in leases_wrap() by passing NULLs to rb_str_new2()
by Dan Williams
Not all lease values are mandatory, and when they aren't supplied
by the libvirt driver they get set to NULL. That makes
rb_str_new2() bail out.
Signed-off-by: Dan Williams <dcbw(a)redhat.com>
---
For example using the qemu driver we don't get 'iaid', and that
makes ruby unhappy:
[{"iface"=>"virbr1", "expirytime"=>1452189569, "type"=>0, "mac"=>"52:54:00:05:2b:6f",
"ipaddr"=>"192.168.121.49", "prefix"=>24, "hostname"=>"openshiftdev",
"clientid"=>"ff:00:05:2b:6f:00:01:00:01:1e:21:55:ed:52:54:00:05:2b:6f"}]
ext/libvirt/network.c | 18 ++++++++++++------
1 file changed, 12 insertions(+), 6 deletions(-)
diff --git a/ext/libvirt/network.c b/ext/libvirt/network.c
index 7c77d73..c250d7d 100644
--- a/ext/libvirt/network.c
+++ b/ext/libvirt/network.c
@@ -269,14 +269,20 @@ static VALUE leases_wrap(VALUE arg)
rb_hash_aset(hash, rb_str_new2("expirytime"),
LL2NUM(lease->expirytime));
rb_hash_aset(hash, rb_str_new2("type"), INT2NUM(lease->type));
- rb_hash_aset(hash, rb_str_new2("mac"), rb_str_new2(lease->mac));
- rb_hash_aset(hash, rb_str_new2("iaid"), rb_str_new2(lease->iaid));
+ if (lease->mac)
+ rb_hash_aset(hash, rb_str_new2("mac"), rb_str_new2(lease->mac));
+ if (lease->iaid)
+ rb_hash_aset(hash, rb_str_new2("iaid"), rb_str_new2(lease->iaid));
rb_hash_aset(hash, rb_str_new2("ipaddr"), rb_str_new2(lease->ipaddr));
rb_hash_aset(hash, rb_str_new2("prefix"), UINT2NUM(lease->prefix));
- rb_hash_aset(hash, rb_str_new2("hostname"),
- rb_str_new2(lease->hostname));
- rb_hash_aset(hash, rb_str_new2("clientid"),
- rb_str_new2(lease->clientid));
+ if (lease->hostname) {
+ rb_hash_aset(hash, rb_str_new2("hostname"),
+ rb_str_new2(lease->hostname));
+ }
+ if (lease->clientid) {
+ rb_hash_aset(hash, rb_str_new2("clientid"),
+ rb_str_new2(lease->clientid));
+ }
rb_ary_store(result, i, hash);
}
--
2.4.3
8 years, 9 months
[libvirt] [PATCH] Fix minor typos in messages
by Yuri Chornoivan
Hi,
Attached is a patch to fix minor typos in libvirt messages. Thanks for
fixing them in the repo.
By the way, libvirt template has not been updated for almost 1 year on
Zanata. Are the translation moved into some new location?
Thanks in advance for your answers.
Best regards,
Yuri
8 years, 9 months
[libvirt] [PATCH v2 0/7] Fix and enhance statistics of a completed job
by Jiri Denemark
Jiri Denemark (7):
qemu: Store completed stats at the very end of migration
qemu: Properly update completed migration stats
qemu: Don't explicitly stop CPUs after migration
qemu: Fix a race when computing migration downtime
qemu: Do not report completed stats until the job finishes
Introduce job completed event
qemu: Add support for job completed event
daemon/remote.c | 38 ++++++++++++++++++
include/libvirt/libvirt-domain.h | 24 ++++++++++++
src/conf/domain_event.c | 85 +++++++++++++++++++++++++++++++++++++++-
src/conf/domain_event.h | 10 +++++
src/libvirt-domain.c | 4 +-
src/libvirt_private.syms | 2 +
src/qemu/qemu_domain.c | 24 ++++++++++++
src/qemu/qemu_domain.h | 4 ++
src/qemu/qemu_driver.c | 4 +-
src/qemu/qemu_migration.c | 74 ++++++++++++++++++++++------------
src/qemu/qemu_process.c | 20 +++++++---
src/remote/remote_driver.c | 42 ++++++++++++++++++++
src/remote/remote_protocol.x | 14 ++++++-
src/remote_protocol-structs | 9 +++++
tools/virsh-domain.c | 25 ++++++++++++
15 files changed, 344 insertions(+), 35 deletions(-)
--
2.7.2
8 years, 9 months
[libvirt] "opertaions" typo on wiki.
by Dennis
Hi,
I tried to edit http://wiki.libvirt.org/page/Main_Page to fix a typo of
the word 'operations,' (see email subject) but could not figure out how to
create an account.
I read on the contact page that if I am not subscribed to the mailing list
I am mailing this small insignificant task won't be emailed to a large
group of people and will be moderated appropriately.
Thanks,
Dennis O.
8 years, 9 months
[libvirt] [libvirt-glib] gconfig: Fix next API version number
by Fabiano Fidêncio
Commit 01e01f2 introduced a wrong next API version number in
libvirt-gconfig.sym
Signed-off-by: Fabiano Fidêncio <fidencio(a)redhat.com>
---
libvirt-gconfig/libvirt-gconfig.sym | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libvirt-gconfig/libvirt-gconfig.sym b/libvirt-gconfig/libvirt-gconfig.sym
index f11f97a..5bc2e24 100644
--- a/libvirt-gconfig/libvirt-gconfig.sym
+++ b/libvirt-gconfig/libvirt-gconfig.sym
@@ -733,7 +733,7 @@ global:
gvir_config_domain_video_set_vgamem;
} LIBVIRT_GCONFIG_0.2.1;
-LIBVIRT_GCONFIG_0.2.4 {
+LIBVIRT_GCONFIG_0.2.3 {
gvir_config_domain_graphics_spice_set_gl;
gvir_config_domain_video_set_accel3d;
} LIBVIRT_GCONFIG_0.2.2;
--
2.5.0
8 years, 9 months
[libvirt] [PATCH 00/25] Final pile of qemu_command.c changes
by John Ferlan
Finishing the adventure - certainly qemuBuildCommandLine looks much
cleaner now and is much shorter (~2100 lines down to ~250 lines).
The downside is plowing though the changes and the reviews.
John Ferlan (25):
qemu: Introduce qemuBuildClockCommandLine
qemu: Introduce qemuBuildPMCommandLine
qemu: Introduce qemuBuildBootCommandLine
qemu: Introduce qemuBuildGlobalControllerCommandLine
qemu: Introduce qemuBuildControllerDevCommandLine
qemu: Introduce qemuBuildHubCommandLine
qemu: Introduce qemuBuildDiskDriveCommandLine
qemu: Introduce qemuBuildFSDevCommandLine
qemu: Introduce qemuBuildNetCommandLine
qemu: Introduce qemuBuildSmartcardCommandLine
qemu: Introduce qemuBuildSerialCommandLine
qemu: Introduce qemuBuildParallelsCommandLine
qemu: Introduce qemuBuildChannelsCommandLine
qemu: Introduce qemuBuildConsoleCommandLine
qemu: Modify qemuBuildTPMCommandLine
qemu: Introduce qemuBuildInputCommandLine
qemu: Introduce qemuBuildVideoCommandLine
qemu: Introduce qemuBuildSoundCommandLine
qemu: Introduce qemuBuildWatchdogCommandLine
qemu: Introduce qemuBuildRedirdevCommandLine
qemu: Introduce qemuBuildHostdevCommandLine
qemu: Introduce qemuBuildMemballoonCommandLine
qemu: Introduce qemuBuildRNGCommandLine
qemu: Introduce qemuBuildNVRAMCommandLine
qemu: Introduce qemuBuildPanicCommandLine
src/conf/domain_conf.c | 14 +-
src/conf/domain_conf.h | 8 +-
src/qemu/qemu_capabilities.c | 2 +-
src/qemu/qemu_capabilities.h | 2 +-
src/qemu/qemu_command.c | 7703 +++++++++++++++++++++-------------------
src/qemu/qemu_command.h | 46 +-
src/qemu/qemu_domain_address.c | 2 +-
src/qemu/qemu_domain_address.h | 2 +-
8 files changed, 4073 insertions(+), 3706 deletions(-)
--
2.5.0
8 years, 9 months
[libvirt] [PATCH] locking: Use bit shift for flag values not constant values.
by John Ferlan
So far it hasn't bitten us, but if the next value wasn't 4, then
the logic used to check flag bits would have issues.
Signed-off-by: John Ferlan <jferlan(a)redhat.com>
---
Noted this while reviewing danpb's virtlogd as chardev series.
src/locking/lock_driver_lockd.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/locking/lock_driver_lockd.h b/src/locking/lock_driver_lockd.h
index baf346a..6931fe7 100644
--- a/src/locking/lock_driver_lockd.h
+++ b/src/locking/lock_driver_lockd.h
@@ -23,8 +23,8 @@
# define __VIR_LOCK_DRIVER_LOCKD_H__
enum virLockSpaceProtocolAcquireResourceFlags {
- VIR_LOCK_SPACE_PROTOCOL_ACQUIRE_RESOURCE_SHARED = 1,
- VIR_LOCK_SPACE_PROTOCOL_ACQUIRE_RESOURCE_AUTOCREATE = 2,
+ VIR_LOCK_SPACE_PROTOCOL_ACQUIRE_RESOURCE_SHARED = (1 << 0),
+ VIR_LOCK_SPACE_PROTOCOL_ACQUIRE_RESOURCE_AUTOCREATE = (1 << 1),
};
#endif /* __VIR_LOCK_DRIVER_LOCKD_H__ */
--
2.5.0
8 years, 9 months
[libvirt] [PATCH] _virtualboxCreateMachine: Avoid unbound stack
by Michal Privoznik
If the stars are in the right position and you're building with
VBox >= 4.2.0 it will happen that compiler thinks an array
allocated on the stack may be unbound:
In file included from vbox/vbox_V4_2.c:13:0:
vbox/vbox_tmpl.c: In function '_virtualboxCreateMachine':
vbox/vbox_tmpl.c:2811:1: error: stack usage might be unbounded [-Werror=stack-usage=]
_virtualboxCreateMachine(vboxGlobalData *data, virDomainDefPtr def, IMachine **machine, char *uuidstr ATTRIBUTE_UNUSED)
^
Well, given how the variable is declared, I had some hard time
seeing it is actually bounded. Surprisingly compiler does not
complain because of -Wframe-larger-than. This is because
variable length arrays do not count into that warning.
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
src/vbox/vbox_tmpl.c | 18 +++++++-----------
1 file changed, 7 insertions(+), 11 deletions(-)
diff --git a/src/vbox/vbox_tmpl.c b/src/vbox/vbox_tmpl.c
index 0fbd5b3..7a8205d 100644
--- a/src/vbox/vbox_tmpl.c
+++ b/src/vbox/vbox_tmpl.c
@@ -2812,7 +2812,7 @@ _virtualboxCreateMachine(vboxGlobalData *data, virDomainDefPtr def, IMachine **m
{
vboxIID iid = VBOX_IID_INITIALIZER;
PRUnichar *machineNameUtf16 = NULL;
- nsresult rc;
+ nsresult rc = -1;
VBOX_UTF8_TO_UTF16(def->name, &machineNameUtf16);
vboxIIDFromUUID(&iid, def->uuid);
@@ -2843,18 +2843,12 @@ _virtualboxCreateMachine(vboxGlobalData *data, virDomainDefPtr def, IMachine **m
override,
machine);
#else /* VBOX_API_VERSION >= 4002000 */
- const char *flagsUUIDPrefix = "UUID=";
- const char *flagsForceOverwrite = "forceOverwrite=0";
- const char *flagsSeparator = ",";
- char createFlags[strlen(flagsUUIDPrefix) + VIR_UUID_STRING_BUFLEN + strlen(flagsSeparator) + strlen(flagsForceOverwrite) + 1];
+ char *createFlags = NULL;
PRUnichar *createFlagsUtf16 = NULL;
- snprintf(createFlags, sizeof(createFlags), "%s%s%s%s",
- flagsUUIDPrefix,
- uuidstr,
- flagsSeparator,
- flagsForceOverwrite
- );
+ if (virAsprintf(&createFlags,
+ "UUID=%s,forceOverwrite=0", uuidstr) < 0)
+ goto cleanup;
VBOX_UTF8_TO_UTF16(createFlags, &createFlagsUtf16);
rc = data->vboxObj->vtbl->CreateMachine(data->vboxObj,
NULL,
@@ -2864,6 +2858,8 @@ _virtualboxCreateMachine(vboxGlobalData *data, virDomainDefPtr def, IMachine **m
nsnull,
createFlagsUtf16,
machine);
+ cleanup:
+ VIR_FREE(createFlags);
#endif /* VBOX_API_VERSION >= 4002000 */
}
VBOX_UTF16_FREE(machineNameUtf16);
--
2.4.10
8 years, 9 months
[libvirt] [PATCH] qemu: improve the error when try to undefine transient network
by Shanzhi Yu
Signed-off-by: Shanzhi Yu <shyu(a)redhat.com>
---
src/network/bridge_driver.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c
index 7ab9e29..b62fdff 100644
--- a/src/network/bridge_driver.c
+++ b/src/network/bridge_driver.c
@@ -3222,6 +3222,12 @@ networkUndefine(virNetworkPtr net)
if (virNetworkObjIsActive(network))
active = true;
+ if (!network->persistent) {
+ virReportError(VIR_ERR_OPERATION_INVALID,
+ "%s", _("can't undefine transient network"));
+ goto cleanup;
+ }
+
/* remove autostart link */
if (virNetworkDeleteConfig(driver->networkConfigDir,
driver->networkAutostartDir,
--
1.8.3.1
8 years, 9 months
[libvirt] [PATCH] qemu: rename: Forbid renaming domains with managed save image
by Peter Krempa
The code does not handle renaming of the save state file. In addition to
that the resuming code would need to be tweaked to handle the name
change since the XML is extracted from the save image. The easies option
is to make the rename API even less useful by forbiding this.
---
src/qemu/qemu_driver.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 102fade..4020364 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -19994,6 +19994,12 @@ static int qemuDomainRename(virDomainPtr dom,
goto endjob;
}
+ if (vm->hasManagedSave) {
+ virReportError(VIR_ERR_OPERATION_INVALID, "%s",
+ _("domain with a managed saved state can't be renamed"));
+ goto endjob;
+ }
+
if (virDomainObjGetState(vm, NULL) != VIR_DOMAIN_SHUTOFF) {
virReportError(VIR_ERR_OPERATION_INVALID,
"%s", _("domain has to be shutoff before renaming"));
--
2.6.2
8 years, 9 months