[libvirt] [PATCH 0/2] Allow hotplug of vhost-mq
by Michal Privoznik
Basically this is trivial. Everything is prepared and the only
thing that prevented us from doing this was missing exception in
one check. Trivial.
Michal Privoznik (2):
qemuDomainAttachNetDevice: Don't overwrite error on rollback
qemuDomainAttachNetDevice: Enable multiqueue for vhost-user
src/qemu/qemu_hotplug.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
--
2.8.4
8 years, 1 month
[libvirt] [PATCH 0/2] vbox: add support for 5.1.x
by Dawid Zamirski
With VBox 5.1.x release new SDK header needs to be added to libvirt
sources. Sending as attachments due to the size of the first patch
being a large header file taken from VBOX SDK.
Dawid Zamirski (2):
vbox: add vbox 5.1 C API header file.
vbox: hookup the 5.1 C API to the unified driver.
src/Makefile.am | 1 +
src/vbox/vbox_CAPI_v5_1.h | 26117 ++++++++++++++++++++++++++++++++++++++++
src/vbox/vbox_V5_1.c | 13 +
src/vbox/vbox_common.h | 2 +
src/vbox/vbox_storage.c | 2 +
src/vbox/vbox_tmpl.c | 2 +
src/vbox/vbox_uniformed_api.h | 1 +
7 files changed, 26138 insertions(+)
create mode 100644 src/vbox/vbox_CAPI_v5_1.h
create mode 100644 src/vbox/vbox_V5_1.c
--
2.9.3
8 years, 1 month
[libvirt] [PATCH] vz: fixed migration in p2p mode
by Pavel Glushchak
dom xml generated on begin step should be passed
to perform step in VIR_MIGRATE_PARAM_DEST_XML parameter.
Otherwise 'XML error: failed to parse xml document' is
raised on destination host as dom xml is NULL.
Signed-off-by: Pavel Glushchak <pglushchak(a)virtuozzo.com>
---
src/vz/vz_driver.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/src/vz/vz_driver.c b/src/vz/vz_driver.c
index b7c37bb..b2c3e31 100644
--- a/src/vz/vz_driver.c
+++ b/src/vz/vz_driver.c
@@ -3199,6 +3199,7 @@ vzDomainMigratePerformP2P(virDomainObjPtr dom,
virConnectPtr dconn = NULL;
virTypedParameterPtr params = NULL;
int ret = -1;
+ int maxparams = nparams;
if (virTypedParamsCopy(¶ms, orig_params, nparams) < 0)
return -1;
@@ -3210,6 +3211,10 @@ vzDomainMigratePerformP2P(virDomainObjPtr dom,
&cookieout, &cookieoutlen)))
goto done;
+ if (virTypedParamsAddString(¶ms, &nparams, &maxparams,
+ VIR_MIGRATE_PARAM_DEST_XML, dom_xml) < 0)
+ goto done;
+
cookiein = cookieout;
cookieinlen = cookieoutlen;
cookieout = NULL;
--
1.8.3.1
8 years, 1 month
[libvirt] [PATCH] news: Add modern ivshmem support
by Martin Kletzander
Signed-off-by: Martin Kletzander <mkletzan(a)redhat.com>
---
docs/news.html.in | 3 +++
1 file changed, 3 insertions(+)
diff --git a/docs/news.html.in b/docs/news.html.in
index fca1e29d043c..473c2ead13b4 100644
--- a/docs/news.html.in
+++ b/docs/news.html.in
@@ -22,6 +22,9 @@
List user-visible changes instead of single commits for a better
high-level overview of differences between libvirt releases
</li>
+ <li>The shmem device can now utilize qemu's ivshmem-plain and
+ ivshmem-doorbell, more modern versions of ivshmem
+ </li>
<li>Various bug fixes and improvements</li>
</ul>
--
2.10.2
8 years, 1 month
[libvirt] [PATCH 0/3] NEWS: Improve generated file
by Andrea Bolognani
Way too tired, can't even blurb.
Andrea Bolognani (3):
NEWS: Archive 2016 releases
NEWS: Update XSLT stylesheet
NEWS: Update entries
docs/{news.html.in => news-2016.html.in} | 9 -
docs/news.html.in | 3777 +-----------------------------
docs/news.xsl | 34 +-
3 files changed, 56 insertions(+), 3764 deletions(-)
copy docs/{news.html.in => news-2016.html.in} (99%)
--
2.7.4
8 years, 1 month
[libvirt] [PATCH] network: increase openvswitch call timeout
by Stefan Zimmermann
Since a successful completion of the calls to openvswitch is expected
a long timeout should be chosen to account for heavily loaded systems.
Therefore this patch increases the timeout value from 5 to 120 seconds.
Signed-off-by: Stefan Zimmermann <stzi(a)linux.vnet.ibm.com>
Reviewed-by: Boris Fiuczynski <fiuczy(a)linux.vnet.ibm.com>
---
src/util/virnetdevopenvswitch.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/util/virnetdevopenvswitch.c b/src/util/virnetdevopenvswitch.c
index 9283bbb..37c2dce 100644
--- a/src/util/virnetdevopenvswitch.c
+++ b/src/util/virnetdevopenvswitch.c
@@ -87,7 +87,7 @@ int virNetDevOpenvswitchAddPort(const char *brname, const char *ifname,
cmd = virCommandNew(OVSVSCTL);
- virCommandAddArgList(cmd, "--timeout=5", "--", "--if-exists", "del-port",
+ virCommandAddArgList(cmd, "--timeout=120", "--", "--if-exists", "del-port",
ifname, "--", "add-port", brname, ifname, NULL);
if (virtVlan && virtVlan->nTags > 0) {
@@ -181,7 +181,7 @@ int virNetDevOpenvswitchRemovePort(const char *brname ATTRIBUTE_UNUSED, const ch
virCommandPtr cmd = NULL;
cmd = virCommandNew(OVSVSCTL);
- virCommandAddArgList(cmd, "--timeout=5", "--", "--if-exists", "del-port", ifname, NULL);
+ virCommandAddArgList(cmd, "--timeout=120", "--", "--if-exists", "del-port", ifname, NULL);
if (virCommandRun(cmd, NULL) < 0) {
virReportError(VIR_ERR_INTERNAL_ERROR,
@@ -210,7 +210,7 @@ int virNetDevOpenvswitchGetMigrateData(char **migrate, const char *ifname)
size_t len;
int ret = -1;
- cmd = virCommandNewArgList(OVSVSCTL, "--timeout=5", "--if-exists", "get", "Interface",
+ cmd = virCommandNewArgList(OVSVSCTL, "--timeout=120", "--if-exists", "get", "Interface",
ifname, "external_ids:PortData", NULL);
virCommandSetOutputBuffer(cmd, migrate);
@@ -253,7 +253,7 @@ int virNetDevOpenvswitchSetMigrateData(char *migrate, const char *ifname)
return 0;
}
- cmd = virCommandNewArgList(OVSVSCTL, "--timeout=5", "set",
+ cmd = virCommandNewArgList(OVSVSCTL, "--timeout=120", "set",
"Interface", ifname, NULL);
virCommandAddArgFormat(cmd, "external_ids:PortData=%s", migrate);
--
2.8.4
8 years, 1 month
[libvirt] [PATCH 0/2] qemu: Fix propagation of 'qemu_id' parameter in the vcpus
by Peter Krempa
The propagation code got misplaced in the code that optimizes the extraction of
the halted state of the vcpus.
Peter Krempa (2):
tests: qemumonitorjson: Rename 'qemu-id' to 'enable-id' in cpu info
test
qemu: monitor: Properly propagate the 'qemu_id' field through the
matcher
src/qemu/qemu_monitor.c | 3 ++
.../qemumonitorjson-cpuinfo-ppc64-basic.data | 10 ++++++-
.../qemumonitorjson-cpuinfo-ppc64-hotplug-1.data | 20 +++++++++++--
.../qemumonitorjson-cpuinfo-ppc64-hotplug-2.data | 30 ++++++++++++++++++--
.../qemumonitorjson-cpuinfo-ppc64-hotplug-4.data | 30 ++++++++++++++++++--
.../qemumonitorjson-cpuinfo-ppc64-no-threads.data | 24 ++++++++++------
...emumonitorjson-cpuinfo-x86-basic-pluggable.data | 15 ++++++----
.../qemumonitorjson-cpuinfo-x86-full.data | 33 ++++++++++++++--------
tests/qemumonitorjsontest.c | 5 +++-
9 files changed, 136 insertions(+), 34 deletions(-)
--
2.10.2
8 years, 1 month
[libvirt] [PATCH 0/3] qemu: Don't call qemuMonitorGetCPUInfo to update vCPU halted state
by Peter Krempa
The original implementation reused qemuMonitorGetCPUInfo to update the halted
state. The function is very complex and should not be called all the time just
to update a trivial parameter.
Add infrastructure to properly update the state without the need to match in
hotplug parameters.
Peter Krempa (3):
qemu: monitor: Extract qemu cpu id along with other data
qemu: monitor: Extract halted state to a bitmap indexed by cpu id
qemu: domain: Refresh vcpu halted state using qemuMonitorGetCpuHalted
src/qemu/qemu_domain.c | 20 ++++++++------------
src/qemu/qemu_domain.h | 1 +
src/qemu/qemu_monitor.c | 40 ++++++++++++++++++++++++++++++++++++++++
src/qemu/qemu_monitor.h | 3 +++
src/qemu/qemu_monitor_json.c | 3 +++
src/qemu/qemu_monitor_text.c | 11 +++++++++++
tests/qemumonitorjsontest.c | 8 ++++----
7 files changed, 70 insertions(+), 16 deletions(-)
--
2.10.2
8 years, 1 month
[libvirt] [PATCH] libxl: add tunnelled migration support
by Bob Liu
Tunnelled migration doesn't require any extra network connections beside the
libvirt daemon.
It's capable of strong encryption and the default option of openstack-nova.
This patch adds the tunnelled migration(Tunnel3params) support to libxl.
On the src side, the data flow is:
* libxlDoMigrateSend() -> pipe
* libxlTunnel3MigrationFunc() polls pipe out and then write to dest stream.
While on the dest side:
Stream -> pipe -> 'recvfd of libxlDomainStartRestore'
The usage is the same as p2p migration, execpt adding one extra '--tunnelled' to
the libvirt p2p migration command.
Signed-off-by: Bob Liu <bob.liu(a)oracle.com>
---
src/libxl/libxl_driver.c | 58 ++++++++-
src/libxl/libxl_migration.c | 281 +++++++++++++++++++++++++++++++++++++++++---
src/libxl/libxl_migration.h | 9 ++
3 files changed, 331 insertions(+), 17 deletions(-)
diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c
index b66cb1f..bc2633b 100644
--- a/src/libxl/libxl_driver.c
+++ b/src/libxl/libxl_driver.c
@@ -5918,6 +5918,61 @@ libxlDomainMigrateBegin3Params(virDomainPtr domain,
}
static int
+libxlDomainMigratePrepareTunnel3Params(virConnectPtr dconn,
+ virStreamPtr st,
+ virTypedParameterPtr params,
+ int nparams,
+ const char *cookiein,
+ int cookieinlen,
+ char **cookieout ATTRIBUTE_UNUSED,
+ int *cookieoutlen ATTRIBUTE_UNUSED,
+ unsigned int flags)
+{
+ libxlDriverPrivatePtr driver = dconn->privateData;
+ virDomainDefPtr def = NULL;
+ const char *dom_xml = NULL;
+ const char *dname = NULL;
+ const char *uri_in = NULL;
+
+#ifdef LIBXL_HAVE_NO_SUSPEND_RESUME
+ virReportUnsupportedError();
+ return -1;
+#endif
+
+ virCheckFlags(LIBXL_MIGRATION_FLAGS, -1);
+ if (virTypedParamsValidate(params, nparams, LIBXL_MIGRATION_PARAMETERS) < 0)
+ goto error;
+
+ if (virTypedParamsGetString(params, nparams,
+ VIR_MIGRATE_PARAM_DEST_XML,
+ &dom_xml) < 0 ||
+ virTypedParamsGetString(params, nparams,
+ VIR_MIGRATE_PARAM_DEST_NAME,
+ &dname) < 0 ||
+ virTypedParamsGetString(params, nparams,
+ VIR_MIGRATE_PARAM_URI,
+ &uri_in) < 0)
+
+ goto error;
+
+ if (!(def = libxlDomainMigrationPrepareDef(driver, dom_xml, dname)))
+ goto error;
+
+ if (virDomainMigratePrepareTunnel3ParamsEnsureACL(dconn, def) < 0)
+ goto error;
+
+ if (libxlDomainMigrationPrepareTunnel3(dconn, st, &def, cookiein,
+ cookieinlen, flags) < 0)
+ goto error;
+
+ return 0;
+
+ error:
+ virDomainDefFree(def);
+ return -1;
+}
+
+static int
libxlDomainMigratePrepare3Params(virConnectPtr dconn,
virTypedParameterPtr params,
int nparams,
@@ -6017,7 +6072,7 @@ libxlDomainMigratePerform3Params(virDomainPtr dom,
if (virDomainMigratePerform3ParamsEnsureACL(dom->conn, vm->def) < 0)
goto cleanup;
- if (flags & VIR_MIGRATE_PEER2PEER) {
+ if ((flags & (VIR_MIGRATE_TUNNELLED | VIR_MIGRATE_PEER2PEER))) {
if (libxlDomainMigrationPerformP2P(driver, vm, dom->conn, dom_xml,
dconnuri, uri, dname, flags) < 0)
goto cleanup;
@@ -6501,6 +6556,7 @@ static virHypervisorDriver libxlHypervisorDriver = {
.nodeDeviceReset = libxlNodeDeviceReset, /* 1.2.3 */
.domainMigrateBegin3Params = libxlDomainMigrateBegin3Params, /* 1.2.6 */
.domainMigratePrepare3Params = libxlDomainMigratePrepare3Params, /* 1.2.6 */
+ .domainMigratePrepareTunnel3Params = libxlDomainMigratePrepareTunnel3Params, /* 2.5.0 */
.domainMigratePerform3Params = libxlDomainMigratePerform3Params, /* 1.2.6 */
.domainMigrateFinish3Params = libxlDomainMigrateFinish3Params, /* 1.2.6 */
.domainMigrateConfirm3Params = libxlDomainMigrateConfirm3Params, /* 1.2.6 */
diff --git a/src/libxl/libxl_migration.c b/src/libxl/libxl_migration.c
index 534abb8..f3152dc 100644
--- a/src/libxl/libxl_migration.c
+++ b/src/libxl/libxl_migration.c
@@ -44,6 +44,7 @@
#include "libxl_migration.h"
#include "locking/domain_lock.h"
#include "virtypedparam.h"
+#include "fdstream.h"
#define VIR_FROM_THIS VIR_FROM_LIBXL
@@ -484,6 +485,90 @@ libxlDomainMigrationPrepareDef(libxlDriverPrivatePtr driver,
}
int
+libxlDomainMigrationPrepareTunnel3(virConnectPtr dconn,
+ virStreamPtr st,
+ virDomainDefPtr *def,
+ const char *cookiein,
+ int cookieinlen,
+ unsigned int flags)
+{
+ libxlMigrationCookiePtr mig = NULL;
+ libxlDriverPrivatePtr driver = dconn->privateData;
+ virDomainObjPtr vm = NULL;
+ libxlMigrationDstArgs *args = NULL;
+ virThread thread;
+ int dataFD[2] = { -1, -1 };
+ int ret = -1;
+
+ if (libxlMigrationEatCookie(cookiein, cookieinlen, &mig) < 0)
+ goto error;
+
+ if (mig->xenMigStreamVer > LIBXL_SAVE_VERSION) {
+ virReportError(VIR_ERR_OPERATION_UNSUPPORTED,
+ _("Xen migration stream version '%d' is not supported on this host"),
+ mig->xenMigStreamVer);
+ goto error;
+ }
+
+ if (!(vm = virDomainObjListAdd(driver->domains, *def,
+ driver->xmlopt,
+ VIR_DOMAIN_OBJ_LIST_ADD_LIVE |
+ VIR_DOMAIN_OBJ_LIST_ADD_CHECK_LIVE,
+ NULL)))
+ goto error;
+
+ /*
+ * The data flow of tunnel3 migration in the dest side:
+ * stream -> pipe -> recvfd of libxlDomainStartRestore
+ */
+ if (pipe(dataFD) < 0)
+ goto error;
+
+ /* Stream data will be written to pipeIn */
+ if (virFDStreamOpen(st, dataFD[1]) < 0)
+ goto error;
+ dataFD[1] = -1; /* 'st' owns the FD now & will close it */
+
+ if (libxlMigrationDstArgsInitialize() < 0)
+ goto error;
+
+ if (!(args = virObjectNew(libxlMigrationDstArgsClass)))
+ goto error;
+
+ args->conn = dconn;
+ args->vm = vm;
+ args->flags = flags;
+ args->migcookie = mig;
+ /* Receive from pipeOut */
+ args->recvfd = dataFD[0];
+ args->nsocks = 0;
+ if (virThreadCreate(&thread, false, libxlDoMigrateReceive, args) < 0) {
+ virReportError(VIR_ERR_OPERATION_FAILED, "%s",
+ _("Failed to create thread for receiving migration data"));
+ goto error;
+ }
+
+ ret = 0;
+ goto done;
+
+ error:
+ VIR_FORCE_CLOSE(dataFD[1]);
+ VIR_FORCE_CLOSE(dataFD[0]);
+ virObjectUnref(args);
+ /* Remove virDomainObj from domain list */
+ if (vm) {
+ virDomainObjListRemove(driver->domains, vm);
+ vm = NULL;
+ }
+
+ done:
+ if (vm)
+ virObjectUnlock(vm);
+
+ return ret;
+}
+
+int
libxlDomainMigrationPrepare(virConnectPtr dconn,
virDomainDefPtr *def,
const char *uri_in,
@@ -710,9 +795,154 @@ libxlDomainMigrationPrepare(virConnectPtr dconn,
return ret;
}
-/* This function is a simplification of virDomainMigrateVersion3Full
- * excluding tunnel support and restricting it to migration v3
- * with params since it was the first to be introduced in libxl.
+typedef struct _libxlTunnelMigrationThread libxlTunnelMigrationThread;
+struct _libxlTunnelMigrationThread {
+ virThread thread;
+ virStreamPtr st;
+ int srcFD;
+};
+#define TUNNEL_SEND_BUF_SIZE 65536
+
+/*
+ * The data flow of tunnel3 migration in the src side:
+ * libxlDoMigrateSend() -> pipe
+ * libxlTunnel3MigrationFunc() polls pipe out and then write to dest stream.
+ */
+static void libxlTunnel3MigrationFunc(void *arg)
+{
+ libxlTunnelMigrationThread *data = (libxlTunnelMigrationThread *)arg;
+ char *buffer = NULL;
+ struct pollfd fds[1];
+ int timeout = -1;
+
+ if (VIR_ALLOC_N(buffer, TUNNEL_SEND_BUF_SIZE) < 0) {
+ virReportError(errno, "%s", _("poll failed in migration tunnel"));
+ return;
+ }
+
+ fds[0].fd = data->srcFD;
+ for (;;) {
+ int ret;
+
+ fds[0].events = POLLIN;
+ fds[0].revents = 0;
+ ret = poll(fds, ARRAY_CARDINALITY(fds), timeout);
+ if (ret < 0) {
+ if (errno == EAGAIN || errno == EINTR)
+ continue;
+ virReportError(errno, "%s",
+ _("poll failed in libxlTunnel3MigrationFunc"));
+ goto cleanup;
+ }
+
+ if (ret == 0) {
+ VIR_DEBUG("poll got timeout");
+ break;
+ }
+
+ if (fds[0].revents & (POLLIN | POLLERR | POLLHUP)) {
+ int nbytes;
+
+ nbytes = read(data->srcFD, buffer, TUNNEL_SEND_BUF_SIZE);
+ if (nbytes > 0) {
+ /* Write to dest stream */
+ if (virStreamSend(data->st, buffer, nbytes) < 0) {
+ virReportError(errno, "%s",
+ _("tunnelled migration failed to send to virStream"));
+ virStreamAbort(data->st);
+ goto cleanup;
+ }
+ } else if (nbytes < 0) {
+ virReportError(errno, "%s",
+ _("tunnelled migration failed to read from xen side"));
+ virStreamAbort(data->st);
+ goto cleanup;
+ } else {
+ /* EOF; transferred all data */
+ break;
+ }
+ }
+ }
+
+ if (virStreamFinish(data->st) < 0)
+ virReportError(errno, "%s",
+ _("tunnelled migration failed to finish stream"));
+ cleanup:
+ VIR_FREE(buffer);
+
+ return;
+}
+
+struct libxlTunnelControl {
+ libxlTunnelMigrationThread tmThread;
+ int dataFD[2];
+};
+
+static int
+libxlMigrationStartTunnel(libxlDriverPrivatePtr driver,
+ virDomainObjPtr vm,
+ unsigned long flags,
+ virStreamPtr st,
+ struct libxlTunnelControl *tc)
+{
+ libxlTunnelMigrationThread *tmThreadPtr = NULL;
+ int ret = -1;
+
+ if (VIR_ALLOC(tc) < 0)
+ goto out;
+
+ tc->dataFD[0] = -1;
+ tc->dataFD[1] = -1;
+ if (pipe(tc->dataFD) < 0) {
+ virReportError(errno, "%s", _("Unable to make pipes"));
+ goto out;
+ }
+
+ tmThreadPtr = &tc->tmThread;
+ /* Read from pipe */
+ tmThreadPtr->srcFD = tc->dataFD[0];
+ /* Write to dest stream */
+ tmThreadPtr->st = st;
+ if (virThreadCreate(&tmThreadPtr->thread, true,
+ libxlTunnel3MigrationFunc,
+ tmThreadPtr) < 0) {
+ virReportError(errno, "%s",
+ _("Unable to create tunnel migration thread"));
+ goto out;
+ }
+
+ virObjectUnlock(vm);
+ /* Send data to pipe */
+ ret = libxlDoMigrateSend(driver, vm, flags, tc->dataFD[1]);
+ virObjectLock(vm);
+
+ out:
+ /* libxlMigrationStopTunnel will be called in libxlDoMigrateP2P to free
+ * all resources for us. */
+ return ret;
+}
+
+static void libxlMigrationStopTunnel(struct libxlTunnelControl *tc)
+{
+ libxlTunnelMigrationThread *tmThreadPtr = NULL;
+
+ if (!tc)
+ return;
+
+ tmThreadPtr = &tc->tmThread;
+ if (tmThreadPtr) {
+ virThreadCancel(&tmThreadPtr->thread);
+ virThreadJoin(&tmThreadPtr->thread);
+ }
+
+ VIR_FORCE_CLOSE(tc->dataFD[0]);
+ VIR_FORCE_CLOSE(tc->dataFD[1]);
+ VIR_FREE(tc);
+}
+
+/* This function is a simplification of virDomainMigrateVersion3Full and
+ * restricting it to migration v3 with params since it was the first to be
+ * introduced in libxl.
*/
static int
libxlDoMigrateP2P(libxlDriverPrivatePtr driver,
@@ -737,6 +967,9 @@ libxlDoMigrateP2P(libxlDriverPrivatePtr driver,
bool cancelled = true;
virErrorPtr orig_err = NULL;
int ret = -1;
+ /* For tunnel migration */
+ virStreamPtr st = NULL;
+ struct libxlTunnelControl *tc = NULL;
dom_xml = libxlDomainMigrationBegin(sconn, vm, xmlin,
&cookieout, &cookieoutlen);
@@ -764,29 +997,40 @@ libxlDoMigrateP2P(libxlDriverPrivatePtr driver,
VIR_DEBUG("Prepare3");
virObjectUnlock(vm);
- ret = dconn->driver->domainMigratePrepare3Params
- (dconn, params, nparams, cookieout, cookieoutlen, NULL, NULL, &uri_out, destflags);
+ if (flags & VIR_MIGRATE_TUNNELLED) {
+ if (!(st = virStreamNew(dconn, 0)))
+ goto cleanup;
+ ret = dconn->driver->domainMigratePrepareTunnel3Params
+ (dconn, st, params, nparams, cookieout, cookieoutlen, NULL, NULL, destflags);
+ } else {
+ ret = dconn->driver->domainMigratePrepare3Params
+ (dconn, params, nparams, cookieout, cookieoutlen, NULL, NULL, &uri_out, destflags);
+ }
virObjectLock(vm);
if (ret == -1)
goto cleanup;
- if (uri_out) {
- if (virTypedParamsReplaceString(¶ms, &nparams,
- VIR_MIGRATE_PARAM_URI, uri_out) < 0) {
- orig_err = virSaveLastError();
+ if (!(flags & VIR_MIGRATE_TUNNELLED)) {
+ if (uri_out) {
+ if (virTypedParamsReplaceString(¶ms, &nparams,
+ VIR_MIGRATE_PARAM_URI, uri_out) < 0) {
+ orig_err = virSaveLastError();
+ goto finish;
+ }
+ } else {
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("domainMigratePrepare3 did not set uri"));
goto finish;
}
- } else {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("domainMigratePrepare3 did not set uri"));
- goto finish;
}
VIR_DEBUG("Perform3 uri=%s", NULLSTR(uri_out));
- ret = libxlDomainMigrationPerform(driver, vm, NULL, NULL,
- uri_out, NULL, flags);
-
+ if (flags & VIR_MIGRATE_TUNNELLED)
+ ret = libxlMigrationStartTunnel(driver, vm, flags, st, tc);
+ else
+ ret = libxlDomainMigrationPerform(driver, vm, NULL, NULL,
+ uri_out, NULL, flags);
if (ret < 0)
orig_err = virSaveLastError();
@@ -824,6 +1068,11 @@ libxlDoMigrateP2P(libxlDriverPrivatePtr driver,
vm->def->name);
cleanup:
+ if (flags & VIR_MIGRATE_TUNNELLED) {
+ libxlMigrationStopTunnel(tc);
+ virObjectUnref(st);
+ }
+
if (ddomain) {
virObjectUnref(ddomain);
ret = 0;
diff --git a/src/libxl/libxl_migration.h b/src/libxl/libxl_migration.h
index 8a074a0..fcea558 100644
--- a/src/libxl/libxl_migration.h
+++ b/src/libxl/libxl_migration.h
@@ -29,6 +29,7 @@
# define LIBXL_MIGRATION_FLAGS \
(VIR_MIGRATE_LIVE | \
VIR_MIGRATE_PEER2PEER | \
+ VIR_MIGRATE_TUNNELLED | \
VIR_MIGRATE_PERSIST_DEST | \
VIR_MIGRATE_UNDEFINE_SOURCE | \
VIR_MIGRATE_PAUSED)
@@ -53,6 +54,14 @@ libxlDomainMigrationPrepareDef(libxlDriverPrivatePtr driver,
const char *dname);
int
+libxlDomainMigrationPrepareTunnel3(virConnectPtr dconn,
+ virStreamPtr st,
+ virDomainDefPtr *def,
+ const char *cookiein,
+ int cookieinlen,
+ unsigned int flags);
+
+int
libxlDomainMigrationPrepare(virConnectPtr dconn,
virDomainDefPtr *def,
const char *uri_in,
--
2.6.5
8 years, 1 month
[libvirt] [PATCH] bhyve: cleanup bhyveBuildNetArgStr error handling
by Roman Bogorodskiy
Use 'goto cleanup'-style error handling instead of explicitly
freeing variables in every error path.
---
src/bhyve/bhyve_command.c | 39 +++++++++++++++++----------------------
1 file changed, 17 insertions(+), 22 deletions(-)
diff --git a/src/bhyve/bhyve_command.c b/src/bhyve/bhyve_command.c
index 022b03b..4914d98 100644
--- a/src/bhyve/bhyve_command.c
+++ b/src/bhyve/bhyve_command.c
@@ -52,26 +52,25 @@ bhyveBuildNetArgStr(const virDomainDef *def,
char macaddr[VIR_MAC_STRING_BUFLEN];
char *realifname = NULL;
char *brname = NULL;
+ int ret = -1;
virDomainNetType actualType = virDomainNetGetActualType(net);
if (actualType == VIR_DOMAIN_NET_TYPE_BRIDGE) {
if (VIR_STRDUP(brname, virDomainNetGetActualBridgeName(net)) < 0)
- return -1;
+ goto cleanup;
} else {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("Network type %d is not supported"),
virDomainNetGetActualType(net));
- return -1;
+ goto cleanup;
}
if (!net->ifname ||
STRPREFIX(net->ifname, VIR_NET_GENERATED_PREFIX) ||
strchr(net->ifname, '%')) {
VIR_FREE(net->ifname);
- if (VIR_STRDUP(net->ifname, VIR_NET_GENERATED_PREFIX "%d") < 0) {
- VIR_FREE(brname);
- return -1;
- }
+ if (VIR_STRDUP(net->ifname, VIR_NET_GENERATED_PREFIX "%d") < 0)
+ goto cleanup;
}
if (!dryRun) {
@@ -80,33 +79,24 @@ bhyveBuildNetArgStr(const virDomainDef *def,
virDomainNetGetActualVirtPortProfile(net),
virDomainNetGetActualVlan(net),
VIR_NETDEV_TAP_CREATE_IFUP | VIR_NETDEV_TAP_CREATE_PERSIST) < 0) {
- VIR_FREE(net->ifname);
- VIR_FREE(brname);
- return -1;
+ goto cleanup;
}
realifname = virNetDevTapGetRealDeviceName(net->ifname);
- if (realifname == NULL) {
- VIR_FREE(net->ifname);
- VIR_FREE(brname);
- return -1;
- }
+ if (realifname == NULL)
+ goto cleanup;
VIR_DEBUG("%s -> %s", net->ifname, realifname);
/* hack on top of other hack: we need to set
* interface to 'UP' again after re-opening to find its
* name
*/
- if (virNetDevSetOnline(net->ifname, true) != 0) {
- VIR_FREE(realifname);
- VIR_FREE(net->ifname);
- VIR_FREE(brname);
- return -1;
- }
+ if (virNetDevSetOnline(net->ifname, true) != 0)
+ goto cleanup;
} else {
if (VIR_STRDUP(realifname, "tap0") < 0)
- return -1;
+ goto cleanup;
}
@@ -114,9 +104,14 @@ bhyveBuildNetArgStr(const virDomainDef *def,
virCommandAddArgFormat(cmd, "%d:0,virtio-net,%s,mac=%s",
net->info.addr.pci.slot,
realifname, virMacAddrFormat(&net->mac, macaddr));
+
+ ret = 0;
+ cleanup:
+ VIR_FREE(brname);
+ VIR_FREE(net->ifname);
VIR_FREE(realifname);
- return 0;
+ return ret;
}
static int
--
2.10.1
8 years, 1 month