[libvirt] [PATCH] tests: do not overwrite return value when filling qemuCapsCache
by Ján Tomko
In qemuHotplugCreateObjects, the ret variable was filled by
the value returned by qemuTestCapsCacheInsert.
If any of the functions after this assignment failed, we would still
return success.
Also adjust testCompareXMLToArgvHelper, where this change is just
cosmetic, because the value was overwritten right away.
---
tests/qemuhotplugtest.c | 5 ++---
tests/qemuxml2argvtest.c | 5 ++---
2 files changed, 4 insertions(+), 6 deletions(-)
diff --git a/tests/qemuhotplugtest.c b/tests/qemuhotplugtest.c
index 1eb2b6a..ea6dc36 100644
--- a/tests/qemuhotplugtest.c
+++ b/tests/qemuhotplugtest.c
@@ -71,23 +71,22 @@ qemuHotplugCreateObjects(virDomainXMLOptionPtr xmlopt,
if (!(priv->qemuCaps = virQEMUCapsNew()))
goto cleanup;
/* for attach & detach qemu must support -device */
virQEMUCapsSet(priv->qemuCaps, QEMU_CAPS_DEVICE);
virQEMUCapsSet(priv->qemuCaps, QEMU_CAPS_VIRTIO_SCSI);
virQEMUCapsSet(priv->qemuCaps, QEMU_CAPS_DEVICE_USB_STORAGE);
if (event)
virQEMUCapsSet(priv->qemuCaps, QEMU_CAPS_DEVICE_DEL_EVENT);
- ret = qemuTestCapsCacheInsert(driver.qemuCapsCache, testname,
- priv->qemuCaps);
- if (ret < 0)
+ if (qemuTestCapsCacheInsert(driver.qemuCapsCache, testname,
+ priv->qemuCaps) < 0)
goto cleanup;
if (!((*vm)->def = virDomainDefParseString(domxml,
driver.caps,
driver.xmlopt,
VIR_DOMAIN_DEF_PARSE_INACTIVE)))
goto cleanup;
if (qemuDomainAssignAddresses((*vm)->def, priv->qemuCaps, *vm) < 0)
goto cleanup;
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index be74178..39443e2 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -400,23 +400,22 @@ testCompareXMLToArgvHelper(const void *data)
virAsprintf(&args, "%s/qemuxml2argvdata/qemuxml2argv-%s.args",
abs_srcdir, info->name) < 0)
goto cleanup;
if (virQEMUCapsGet(info->extraFlags, QEMU_CAPS_MONITOR_JSON))
flags |= FLAG_JSON;
if (virQEMUCapsGet(info->extraFlags, QEMU_CAPS_ENABLE_FIPS))
flags |= FLAG_FIPS;
- result = qemuTestCapsCacheInsert(driver.qemuCapsCache, info->name,
- info->extraFlags);
- if (result < 0)
+ if (qemuTestCapsCacheInsert(driver.qemuCapsCache, info->name,
+ info->extraFlags) < 0)
goto cleanup;
result = testCompareXMLToArgvFiles(xml, args, info->extraFlags,
migrateURI, flags, info->parseFlags);
cleanup:
VIR_FREE(migrateURI);
VIR_FREE(xml);
VIR_FREE(args);
return result;
--
2.7.3
9 years
[libvirt] [PATCH v6 0/5] migration: add multithread compression
by Nikolay Shirokovskiy
Add means to turn multithread compression on during migration.
Add means to pass compression parameters in migration command.
WARNING!
This should be pushed only after
https://www.redhat.com/archives/libvir-list/2016-March/msg01506.html
or virsh domain will break.
Changes from v5
===============
Originally i just wanted to send a rebase as i discovered that automatic
rebase goes wrong for the patch 1 but later found a couple of bugs
in the patch itself. Here they are:
1. fix qemuDomainMigratePrepare2 and qemuDomainMigratePerform3
passing NULL for compression.
Changes from v4
===============
1. Clean up documentation and comments.
2. Stop keeping compression options in flags internally. Move
flags data into generic compression structure.
3. Use existing libvirt enum infrastructure to deal with
compression methods. This makes parse and dump function less
painful.
4. Use booleans for 'set' flags instead of bitsets.
5. Othes minor changes on Jiri comments.
Eli Qiao (1):
qemumonitorjsontest: add test for getting multithread compress params
Nikolay Shirokovskiy (2):
migration: qemu: add option to select compression methods
qemu: migration: support setting compession parameters
ShaoHe Feng (2):
qemu: monitor: add migration parameters accessors
virsh: add compression options for migration
include/libvirt/libvirt-domain.h | 42 +++++++
src/qemu/qemu_driver.c | 60 +++++++--
src/qemu/qemu_migration.c | 262 +++++++++++++++++++++++++++++++++++----
src/qemu/qemu_migration.h | 36 ++++++
src/qemu/qemu_monitor.c | 24 +++-
src/qemu/qemu_monitor.h | 18 +++
src/qemu/qemu_monitor_json.c | 110 ++++++++++++++++
src/qemu/qemu_monitor_json.h | 5 +
tests/qemumonitorjsontest.c | 61 +++++++++
tools/virsh-domain.c | 76 ++++++++++++
tools/virsh.pod | 18 ++-
11 files changed, 671 insertions(+), 41 deletions(-)
--
1.8.3.1
9 years
[libvirt] [PATCH] virsh: support up to 64 migration options for command
by Nikolay Shirokovskiy
Upcoming compression options for migration command patch
series hits current limit of 32 possible options for a command.
Lets take one step further and support 64 possible options.
And all it takes is moving from 32 bit integers to 64 bit ones.
The only less then trivial change i found is moving from
'ffs' to 'ffsl'.
Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy(a)virtuozzo.com>
---
tools/vsh.c | 29 ++++++++++++++---------------
1 file changed, 14 insertions(+), 15 deletions(-)
diff --git a/tools/vsh.c b/tools/vsh.c
index 6bdc082..5659110 100644
--- a/tools/vsh.c
+++ b/tools/vsh.c
@@ -40,7 +40,6 @@
#include <limits.h>
#include <sys/stat.h>
#include <inttypes.h>
-#include <strings.h>
#include <signal.h>
#if WITH_READLINE
@@ -329,8 +328,8 @@ vshCmddefGetInfo(const vshCmdDef * cmd, const char *name)
/* Validate that the options associated with cmd can be parsed. */
static int
-vshCmddefOptParse(const vshCmdDef *cmd, uint32_t *opts_need_arg,
- uint32_t *opts_required)
+vshCmddefOptParse(const vshCmdDef *cmd, uint64_t *opts_need_arg,
+ uint64_t *opts_required)
{
size_t i;
bool optional = false;
@@ -344,7 +343,7 @@ vshCmddefOptParse(const vshCmdDef *cmd, uint32_t *opts_need_arg,
for (i = 0; cmd->opts[i].name; i++) {
const vshCmdOptDef *opt = &cmd->opts[i];
- if (i > 31)
+ if (i > 63)
return -1; /* too many options */
if (opt->type == VSH_OT_BOOL) {
optional = true;
@@ -407,7 +406,7 @@ static vshCmdOptDef helpopt = {
};
static const vshCmdOptDef *
vshCmddefGetOption(vshControl *ctl, const vshCmdDef *cmd, const char *name,
- uint32_t *opts_seen, int *opt_index, char **optstr)
+ uint64_t *opts_seen, int *opt_index, char **optstr)
{
size_t i;
const vshCmdOptDef *ret = NULL;
@@ -464,8 +463,8 @@ vshCmddefGetOption(vshControl *ctl, const vshCmdDef *cmd, const char *name,
}
static const vshCmdOptDef *
-vshCmddefGetData(const vshCmdDef *cmd, uint32_t *opts_need_arg,
- uint32_t *opts_seen)
+vshCmddefGetData(const vshCmdDef *cmd, uint64_t *opts_need_arg,
+ uint64_t *opts_seen)
{
size_t i;
const vshCmdOptDef *opt;
@@ -474,7 +473,7 @@ vshCmddefGetData(const vshCmdDef *cmd, uint32_t *opts_need_arg,
return NULL;
/* Grab least-significant set bit */
- i = ffs(*opts_need_arg) - 1;
+ i = ffsl(*opts_need_arg) - 1;
opt = &cmd->opts[i];
if (opt->type != VSH_OT_ARGV)
*opts_need_arg &= ~(1 << i);
@@ -486,8 +485,8 @@ vshCmddefGetData(const vshCmdDef *cmd, uint32_t *opts_need_arg,
* Checks for required options
*/
static int
-vshCommandCheckOpts(vshControl *ctl, const vshCmd *cmd, uint32_t opts_required,
- uint32_t opts_seen)
+vshCommandCheckOpts(vshControl *ctl, const vshCmd *cmd, uint64_t opts_required,
+ uint64_t opts_seen)
{
const vshCmdDef *def = cmd->def;
size_t i;
@@ -598,8 +597,8 @@ vshCmddefHelp(vshControl *ctl, const char *cmdname)
const char *desc = vshCmddefGetInfo(def, "desc");
const char *help = _(vshCmddefGetInfo(def, "help"));
char buf[256];
- uint32_t opts_need_arg;
- uint32_t opts_required;
+ uint64_t opts_need_arg;
+ uint64_t opts_required;
bool shortopt = false; /* true if 'arg' works instead of '--opt arg' */
if (vshCmddefOptParse(def, &opts_need_arg, &opts_required)) {
@@ -1350,9 +1349,9 @@ vshCommandParse(vshControl *ctl, vshCommandParser *parser)
const vshCmdDef *cmd = NULL;
vshCommandToken tk;
bool data_only = false;
- uint32_t opts_need_arg = 0;
- uint32_t opts_required = 0;
- uint32_t opts_seen = 0;
+ uint64_t opts_need_arg = 0;
+ uint64_t opts_required = 0;
+ uint64_t opts_seen = 0;
first = NULL;
--
1.8.3.1
9 years
[libvirt] [PATCH] virsh: use the same connection URI for reconnect
by Roman Bogorodskiy
When for some reason virsh looses connection and then tries to
reconnection, it uses the default URI instead of the one that was used
for the previous connection it got disconnected from.
In order to make it reconnect using the same URI, copy URI of the
current (disconnected) connection to vshControl 'connname' attribute.
---
tools/virsh.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/tools/virsh.c b/tools/virsh.c
index 5a61189..07097aa 100644
--- a/tools/virsh.c
+++ b/tools/virsh.c
@@ -359,6 +359,14 @@ virshConnectionHandler(vshControl *ctl)
{
virshControlPtr priv = ctl->privData;
+ if (disconnected && priv->conn) {
+ if (!ctl->connname) {
+ char *uri = virConnectGetURI(priv->conn);
+ ctl->connname = vshStrdup(ctl, uri);
+ VIR_FREE(uri);
+ }
+ }
+
if (!priv->conn || disconnected)
virshReconnect(ctl);
--
2.7.4
9 years
[libvirt] [PATCH REBASE 0/4] vz: use disk bus and target name as disk id
by Nikolay Shirokovskiy
This series is a preparation to implement device update functionality.
In case of disk updates disk bus and disk target name pair is considered
disk id. We already have places in vz driver code where we use disk source
as id. These places are either not critical (see boot patch) or
correct (see detach patch) so we need not to fix them immediately to use more
rubust id. But as this id will be introduced anyway for disk updates
let's move to new id in existing code. This way we have single
id for disks.
Nikolay Shirokovskiy (4):
vz: introduce vzsdk disk id function
vz: fix detach disk to use new disk id
vz: fix boot check to use new disk id
vz: cleanup: remove trivial function
src/vz/vz_sdk.c | 251 ++++++++++++++++++++++++++++----------------------------
1 file changed, 126 insertions(+), 125 deletions(-)
--
1.8.3.1
9 years
[libvirt] [PATCH] storage: mpath: Don't error on target_type=NULL
by Cole Robinson
We use device-mapper to enumerate all dm devices, and filter out
the list of multipath devices by checking the target_type string
name. The code however cancels all scanning if we encounter
target_type=NULL
I don't know how to reproduce that situation, but a user was hitting
it in their setup, and inspecting the lvm2/device-mapper code shows
many places where !target_type is explicitly ignored and processing
continues on to the next device. So I think we should do the same
https://bugzilla.redhat.com/show_bug.cgi?id=1069317
---
src/storage/storage_backend_mpath.c | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)
diff --git a/src/storage/storage_backend_mpath.c b/src/storage/storage_backend_mpath.c
index b5b4bb6..bf1b1ab 100644
--- a/src/storage/storage_backend_mpath.c
+++ b/src/storage/storage_backend_mpath.c
@@ -114,12 +114,7 @@ virStorageBackendIsMultipath(const char *dev_name)
dm_get_next_target(dmt, next, &start, &length, &target_type, ¶ms);
- if (target_type == NULL) {
- ret = -1;
- goto out;
- }
-
- if (STREQ(target_type, "multipath"))
+ if (STREQ_NULLABLE(target_type, "multipath"))
ret = 1;
out:
--
2.7.3
9 years
[libvirt] [PATCH] fix build by correcting functions order and src/Makefile.am
by Maxim Nestratov
commit 30c61901 added new functions to libvirt_private.syms
not alpabetically sorted and erroneously added vz sources to
STATEFUL_DRIVER_SOURCE_FILES, which triggered check-aclrules
running while vz driver isn't ready for it yet.
Pushing under build-breaker rule.
---
src/Makefile.am | 1 -
src/libvirt_private.syms | 12 ++++++------
2 files changed, 6 insertions(+), 7 deletions(-)
diff --git a/src/Makefile.am b/src/Makefile.am
index 08ff301..f5e57c0 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -630,7 +630,6 @@ DRIVER_SOURCE_FILES = \
$(NULL)
STATEFUL_DRIVER_SOURCE_FILES = \
- $(VZ_DRIVER_SOURCES) \
$(BHYVE_DRIVER_SOURCES) \
$(INTERFACE_DRIVER_SOURCES) \
$(LIBXL_DRIVER_SOURCES) \
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 1bcb3af..a9025f5 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -916,6 +916,11 @@ virCPUx86MakeData;
# datatypes.h
virConnectClass;
+virConnectCloseCallbackDataCall;
+virConnectCloseCallbackDataClass;
+virConnectCloseCallbackDataGetCallback;
+virConnectCloseCallbackDataRegister;
+virConnectCloseCallbackDataUnregister;
virDomainClass;
virDomainSnapshotClass;
virGetConnect;
@@ -929,20 +934,15 @@ virGetSecret;
virGetStoragePool;
virGetStorageVol;
virGetStream;
-virConnectCloseCallbackDataGetCallback;
-virNewConnectCloseCallbackData;
-virConnectCloseCallbackDataUnregister;
-virConnectCloseCallbackDataRegister;
-virConnectCloseCallbackDataCall;
virInterfaceClass;
virNetworkClass;
+virNewConnectCloseCallbackData;
virNodeDeviceClass;
virNWFilterClass;
virSecretClass;
virStoragePoolClass;
virStorageVolClass;
virStreamClass;
-virConnectCloseCallbackDataClass;
# fdstream.h
--
2.4.3
9 years
Re: [libvirt] [libvirt-users] Libvirtd running as root tries to access oneadmin (OpenNebula) NFS mount but throws: error: can’t canonicalize path
by TomK
Adding in libvir-list.
Cheers,
Tom K.
-------------------------------------------------------------------------------------
Mobile: 416 618 8456
Home: 905 857 9652
Living on earth is expensive, but it includes a free trip around the sun.
On 4/7/2016 7:32 PM, TomK wrote:
> Hey All,
>
> I've an issue where libvirtd tries to access an NFS mount but errors
> out with: can't canonicalize path '/var/lib/one//datastores/0 . The
> unprevilidged user is able to read/write fine to the share.
> root_squash is used and for security reasons no_root_squash cannot be
> used.
>
> On the controller and node SELinux is disabled.
>
> [oneadmin@mdskvm-p01 ~]$ virsh -d 1 --connect qemu:///system create
> /var/lib/one//datastores/0/38/deployment.0
> create: file(optdata): /var/lib/one//datastores/0/38/deployment.0
> error: Failed to create domain from
> /var/lib/one//datastores/0/38/deployment.0
> error: can't canonicalize path '/var/lib/one//datastores/0/38/disk.1':
> Permission denied
>
> I added some debug flags to get more info and added -x to the deploy
> script. Closest I get to more details is this:
>
> 2016-04-06 04:15:35.945+0000: 14072: debug :
> virStorageFileBackendFileInit:1441 : initializing FS storage file
> 0x7f6aa4009000 (file:/var/lib/one//datastores/0/38/disk.1)[9869:9869]
> 2016-04-06 04:15:35.954+0000: 14072: error :
> virStorageFileBackendFileGetUniqueIdentifier:1523 : can't canonicalize
> path '/var/lib/one//datastores/0/38/disk.1':
>
> https://www.redhat.com/archives/libvir-list/2014-May/msg00194.html
>
> Comment is: "The current implementation works for local
> storage only and returns the canonical path of the volume."
>
> But it seems the logic is applied to NFS mounts. Perhaps it shouldn't
> be? Anyway to get around this problem? This is CentOS 7 .
>
> Cheers,
> Tom K.
> -------------------------------------------------------------------------------------
>
> Living on earth is expensive, but it includes a free trip around the sun.
>
> _______________________________________________
> libvirt-users mailing list
> libvirt-users(a)redhat.com
> https://www.redhat.com/mailman/listinfo/libvirt-users
9 years