Re: [libvirt] [PATCH] migration: add option to set target ndb server port

2016-02-12 Thread Maxim Nestratov

11.02.2016 16:19, Maxim Nestratov пишет:

29.01.2016 18:18, Maxim Nestratov пишет:

13.01.2016 14:01, Nikolay Shirokovskiy пишет:

[snip]
   Set maximum tolerable downtime for a domain which is being 
live-migrated to

You should use /**/ commens rather than //
Otherwise looks OK. ACK.

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Though I ACKed the patch, it can't be applied anymore on current 
master. Could you please rebase it and resend it to ease the life of 
people volunteered to review it.


Best,
Maxim

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Sorry, it was my glitch. Everythin is ok with applying the patch.
Anyway, someone else should review it.

Best,
Maxim

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH] migration: add option to set target ndb server port

2016-02-11 Thread Maxim Nestratov

29.01.2016 18:18, Maxim Nestratov пишет:

13.01.2016 14:01, Nikolay Shirokovskiy пишет:

Current libvirt + qemu pair lacks secure migrations in case of
VMs with non-shared disks. The only option to migrate securely
natively is to use tunneled mode and some kind of secure
destination URI. But tunelled mode does not support non-shared
disks.

The other way to make migration secure is to organize a tunnel
by external means. This is possible in case of shared disks
migration thru use of proper combination of destination URI,
migration URI and VIR_MIGRATE_PARAM_LISTEN_ADDRESS migration
param. But again this is not possible in case of non shared disks
migration as we have no option to control target nbd server port.
But fixing this much more simplier that supporting non-shared
disks in tunneled mode.

So this patch adds option to set target ndb port.

Finally all qemu migration connections will be secured AFAIK but
even in this case this patch could be convinient if one wants
all migration traffic be put in a single connection.
---
  include/libvirt/libvirt-domain.h |  10 +++
  src/qemu/qemu_driver.c   |  25 ---
  src/qemu/qemu_migration.c| 138 
+++

  src/qemu/qemu_migration.h|   3 +
  tools/virsh-domain.c |  12 
  tools/virsh.pod  |   5 +-
  6 files changed, 141 insertions(+), 52 deletions(-)

diff --git a/include/libvirt/libvirt-domain.h 
b/include/libvirt/libvirt-domain.h

index d26faa5..e577f26 100644
--- a/include/libvirt/libvirt-domain.h
+++ b/include/libvirt/libvirt-domain.h
@@ -757,6 +757,16 @@ typedef enum {
   */
  # define VIR_MIGRATE_PARAM_MIGRATE_DISKS"migrate_disks"
  +/**
+ * VIR_MIGRATE_PARAM_NBD_PORT:
+ *
+ * virDomainMigrate* params field: port that destination nbd server 
should use
+ * for incoming disks migration. Type is VIR_TYPED_PARAM_INT. If set 
to 0 or
+ * omitted, libvirt will choose a suitable default. At the moment 
this is only

+ * supported by the QEMU driver.
+ */
+# define VIR_MIGRATE_PARAM_NBD_PORT"nbd_port"
+
  /* Domain migration. */
  virDomainPtr virDomainMigrate (virDomainPtr domain, virConnectPtr 
dconn,

 unsigned long flags, const char *dname,
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 8ccf68b..4d00ba4 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -12082,7 +12082,7 @@ qemuDomainMigratePrepare2(virConnectPtr dconn,
  ret = qemuMigrationPrepareDirect(driver, dconn,
   NULL, 0, NULL, NULL, /* No 
cookies */

   uri_in, uri_out,
- &def, origname, NULL, 0, NULL, 
flags);
+ &def, origname, NULL, 0, NULL, 
0, flags);

 cleanup:
  VIR_FREE(origname);
@@ -12135,7 +12135,7 @@ qemuDomainMigratePerform(virDomainPtr dom,
   * Consume any cookie we were able to decode though
   */
  ret = qemuMigrationPerform(driver, dom->conn, vm,
-   NULL, dconnuri, uri, NULL, NULL, 0, 
NULL,
+   NULL, dconnuri, uri, NULL, NULL, 0, 
NULL, 0,

 cookie, cookielen,
 NULL, NULL, /* No output cookies in 
v2 */

 flags, dname, resource, false);
@@ -12308,7 +12308,7 @@ qemuDomainMigratePrepare3(virConnectPtr dconn,
   cookiein, cookieinlen,
   cookieout, cookieoutlen,
   uri_in, uri_out,
- &def, origname, NULL, 0, NULL, 
flags);
+ &def, origname, NULL, 0, NULL, 
0, flags);

 cleanup:
  VIR_FREE(origname);
@@ -12334,6 +12334,7 @@ qemuDomainMigratePrepare3Params(virConnectPtr 
dconn,

  const char *dname = NULL;
  const char *uri_in = NULL;
  const char *listenAddress = cfg->migrationAddress;
+int nbdPort = 0;
  int nmigrate_disks;
  const char **migrate_disks = NULL;
  char *origname = NULL;
@@ -12354,7 +12355,10 @@ 
qemuDomainMigratePrepare3Params(virConnectPtr dconn,

  &uri_in) < 0 ||
  virTypedParamsGetString(params, nparams,
VIR_MIGRATE_PARAM_LISTEN_ADDRESS,
-&listenAddress) < 0)
+&listenAddress) < 0 ||
+virTypedParamsGetInt(params, nparams,
+VIR_MIGRATE_PARAM_NBD_PORT,
+&nbdPort) < 0)
  goto cleanup;
nmigrate_disks = virTypedParamsGetStringList(params, nparams,
@@ -12385,7 +12389,8 @@ qemuDomainMigratePrepare3Params(virConnectPtr 
dconn,

   cookieout, cookieoutlen,
   uri_in, uri_out,
   &def, orig

Re: [libvirt] [PATCH] migration: add option to set target ndb server port

2016-01-29 Thread Maxim Nestratov

13.01.2016 14:01, Nikolay Shirokovskiy пишет:

Current libvirt + qemu pair lacks secure migrations in case of
VMs with non-shared disks. The only option to migrate securely
natively is to use tunneled mode and some kind of secure
destination URI. But tunelled mode does not support non-shared
disks.

The other way to make migration secure is to organize a tunnel
by external means. This is possible in case of shared disks
migration thru use of proper combination of destination URI,
migration URI and VIR_MIGRATE_PARAM_LISTEN_ADDRESS migration
param. But again this is not possible in case of non shared disks
migration as we have no option to control target nbd server port.
But fixing this much more simplier that supporting non-shared
disks in tunneled mode.

So this patch adds option to set target ndb port.

Finally all qemu migration connections will be secured AFAIK but
even in this case this patch could be convinient if one wants
all migration traffic be put in a single connection.
---
  include/libvirt/libvirt-domain.h |  10 +++
  src/qemu/qemu_driver.c   |  25 ---
  src/qemu/qemu_migration.c| 138 +++
  src/qemu/qemu_migration.h|   3 +
  tools/virsh-domain.c |  12 
  tools/virsh.pod  |   5 +-
  6 files changed, 141 insertions(+), 52 deletions(-)

diff --git a/include/libvirt/libvirt-domain.h b/include/libvirt/libvirt-domain.h
index d26faa5..e577f26 100644
--- a/include/libvirt/libvirt-domain.h
+++ b/include/libvirt/libvirt-domain.h
@@ -757,6 +757,16 @@ typedef enum {
   */
  # define VIR_MIGRATE_PARAM_MIGRATE_DISKS"migrate_disks"
  
+/**

+ * VIR_MIGRATE_PARAM_NBD_PORT:
+ *
+ * virDomainMigrate* params field: port that destination nbd server should use
+ * for incoming disks migration. Type is VIR_TYPED_PARAM_INT. If set to 0 or
+ * omitted, libvirt will choose a suitable default. At the moment this is only
+ * supported by the QEMU driver.
+ */
+# define VIR_MIGRATE_PARAM_NBD_PORT"nbd_port"
+
  /* Domain migration. */
  virDomainPtr virDomainMigrate (virDomainPtr domain, virConnectPtr dconn,
 unsigned long flags, const char *dname,
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 8ccf68b..4d00ba4 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -12082,7 +12082,7 @@ qemuDomainMigratePrepare2(virConnectPtr dconn,
  ret = qemuMigrationPrepareDirect(driver, dconn,
   NULL, 0, NULL, NULL, /* No cookies */
   uri_in, uri_out,
- &def, origname, NULL, 0, NULL, flags);
+ &def, origname, NULL, 0, NULL, 0, flags);
  
   cleanup:

  VIR_FREE(origname);
@@ -12135,7 +12135,7 @@ qemuDomainMigratePerform(virDomainPtr dom,
   * Consume any cookie we were able to decode though
   */
  ret = qemuMigrationPerform(driver, dom->conn, vm,
-   NULL, dconnuri, uri, NULL, NULL, 0, NULL,
+   NULL, dconnuri, uri, NULL, NULL, 0, NULL, 0,
 cookie, cookielen,
 NULL, NULL, /* No output cookies in v2 */
 flags, dname, resource, false);
@@ -12308,7 +12308,7 @@ qemuDomainMigratePrepare3(virConnectPtr dconn,
   cookiein, cookieinlen,
   cookieout, cookieoutlen,
   uri_in, uri_out,
- &def, origname, NULL, 0, NULL, flags);
+ &def, origname, NULL, 0, NULL, 0, flags);
  
   cleanup:

  VIR_FREE(origname);
@@ -12334,6 +12334,7 @@ qemuDomainMigratePrepare3Params(virConnectPtr dconn,
  const char *dname = NULL;
  const char *uri_in = NULL;
  const char *listenAddress = cfg->migrationAddress;
+int nbdPort = 0;
  int nmigrate_disks;
  const char **migrate_disks = NULL;
  char *origname = NULL;
@@ -12354,7 +12355,10 @@ qemuDomainMigratePrepare3Params(virConnectPtr dconn,
  &uri_in) < 0 ||
  virTypedParamsGetString(params, nparams,
  VIR_MIGRATE_PARAM_LISTEN_ADDRESS,
-&listenAddress) < 0)
+&listenAddress) < 0 ||
+virTypedParamsGetInt(params, nparams,
+VIR_MIGRATE_PARAM_NBD_PORT,
+&nbdPort) < 0)
  goto cleanup;
  
  nmigrate_disks = virTypedParamsGetStringList(params, nparams,

@@ -12385,7 +12389,8 @@ qemuDomainMigratePrepare3Params(virConnectPtr dconn,
   cookieout, cookieoutlen,
   uri_in, uri_out,
   &def, origname, listenAddress,
-   

Re: [libvirt] [PATCH] migration: add option to set target ndb server port

2016-01-26 Thread Nikolay Shirokovskiy
I'm looking forward to be reviewed)

Sincerely yours,
Patch Series

On 13.01.2016 14:01, Nikolay Shirokovskiy wrote:
> Current libvirt + qemu pair lacks secure migrations in case of
> VMs with non-shared disks. The only option to migrate securely
> natively is to use tunneled mode and some kind of secure
> destination URI. But tunelled mode does not support non-shared
> disks.
> 
> The other way to make migration secure is to organize a tunnel
> by external means. This is possible in case of shared disks
> migration thru use of proper combination of destination URI,
> migration URI and VIR_MIGRATE_PARAM_LISTEN_ADDRESS migration
> param. But again this is not possible in case of non shared disks
> migration as we have no option to control target nbd server port.
> But fixing this much more simplier that supporting non-shared
> disks in tunneled mode.
> 
> So this patch adds option to set target ndb port.
> 
> Finally all qemu migration connections will be secured AFAIK but
> even in this case this patch could be convinient if one wants
> all migration traffic be put in a single connection.
> ---
>  include/libvirt/libvirt-domain.h |  10 +++
>  src/qemu/qemu_driver.c   |  25 ---
>  src/qemu/qemu_migration.c| 138 
> +++
>  src/qemu/qemu_migration.h|   3 +
>  tools/virsh-domain.c |  12 
>  tools/virsh.pod  |   5 +-
>  6 files changed, 141 insertions(+), 52 deletions(-)
> 
> diff --git a/include/libvirt/libvirt-domain.h 
> b/include/libvirt/libvirt-domain.h
> index d26faa5..e577f26 100644
> --- a/include/libvirt/libvirt-domain.h
> +++ b/include/libvirt/libvirt-domain.h
> @@ -757,6 +757,16 @@ typedef enum {
>   */
>  # define VIR_MIGRATE_PARAM_MIGRATE_DISKS"migrate_disks"
>  
> +/**
> + * VIR_MIGRATE_PARAM_NBD_PORT:
> + *
> + * virDomainMigrate* params field: port that destination nbd server should 
> use
> + * for incoming disks migration. Type is VIR_TYPED_PARAM_INT. If set to 0 or
> + * omitted, libvirt will choose a suitable default. At the moment this is 
> only
> + * supported by the QEMU driver.
> + */
> +# define VIR_MIGRATE_PARAM_NBD_PORT"nbd_port"
> +
>  /* Domain migration. */
>  virDomainPtr virDomainMigrate (virDomainPtr domain, virConnectPtr dconn,
> unsigned long flags, const char *dname,
> diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
> index 8ccf68b..4d00ba4 100644
> --- a/src/qemu/qemu_driver.c
> +++ b/src/qemu/qemu_driver.c
> @@ -12082,7 +12082,7 @@ qemuDomainMigratePrepare2(virConnectPtr dconn,
>  ret = qemuMigrationPrepareDirect(driver, dconn,
>   NULL, 0, NULL, NULL, /* No cookies */
>   uri_in, uri_out,
> - &def, origname, NULL, 0, NULL, flags);
> + &def, origname, NULL, 0, NULL, 0, 
> flags);
>  
>   cleanup:
>  VIR_FREE(origname);
> @@ -12135,7 +12135,7 @@ qemuDomainMigratePerform(virDomainPtr dom,
>   * Consume any cookie we were able to decode though
>   */
>  ret = qemuMigrationPerform(driver, dom->conn, vm,
> -   NULL, dconnuri, uri, NULL, NULL, 0, NULL,
> +   NULL, dconnuri, uri, NULL, NULL, 0, NULL, 0,
> cookie, cookielen,
> NULL, NULL, /* No output cookies in v2 */
> flags, dname, resource, false);
> @@ -12308,7 +12308,7 @@ qemuDomainMigratePrepare3(virConnectPtr dconn,
>   cookiein, cookieinlen,
>   cookieout, cookieoutlen,
>   uri_in, uri_out,
> - &def, origname, NULL, 0, NULL, flags);
> + &def, origname, NULL, 0, NULL, 0, 
> flags);
>  
>   cleanup:
>  VIR_FREE(origname);
> @@ -12334,6 +12334,7 @@ qemuDomainMigratePrepare3Params(virConnectPtr dconn,
>  const char *dname = NULL;
>  const char *uri_in = NULL;
>  const char *listenAddress = cfg->migrationAddress;
> +int nbdPort = 0;
>  int nmigrate_disks;
>  const char **migrate_disks = NULL;
>  char *origname = NULL;
> @@ -12354,7 +12355,10 @@ qemuDomainMigratePrepare3Params(virConnectPtr dconn,
>  &uri_in) < 0 ||
>  virTypedParamsGetString(params, nparams,
>  VIR_MIGRATE_PARAM_LISTEN_ADDRESS,
> -&listenAddress) < 0)
> +&listenAddress) < 0 ||
> +virTypedParamsGetInt(params, nparams,
> +VIR_MIGRATE_PARAM_NBD_PORT,
> +&nbdPort) < 0)
>  goto cleanup;
>  
>  nmigrate_disks = virTypedParamsGetStringList(params, nparams,
> @@ -123

[libvirt] [PATCH] migration: add option to set target ndb server port

2016-01-13 Thread Nikolay Shirokovskiy
Current libvirt + qemu pair lacks secure migrations in case of
VMs with non-shared disks. The only option to migrate securely
natively is to use tunneled mode and some kind of secure
destination URI. But tunelled mode does not support non-shared
disks.

The other way to make migration secure is to organize a tunnel
by external means. This is possible in case of shared disks
migration thru use of proper combination of destination URI,
migration URI and VIR_MIGRATE_PARAM_LISTEN_ADDRESS migration
param. But again this is not possible in case of non shared disks
migration as we have no option to control target nbd server port.
But fixing this much more simplier that supporting non-shared
disks in tunneled mode.

So this patch adds option to set target ndb port.

Finally all qemu migration connections will be secured AFAIK but
even in this case this patch could be convinient if one wants
all migration traffic be put in a single connection.
---
 include/libvirt/libvirt-domain.h |  10 +++
 src/qemu/qemu_driver.c   |  25 ---
 src/qemu/qemu_migration.c| 138 +++
 src/qemu/qemu_migration.h|   3 +
 tools/virsh-domain.c |  12 
 tools/virsh.pod  |   5 +-
 6 files changed, 141 insertions(+), 52 deletions(-)

diff --git a/include/libvirt/libvirt-domain.h b/include/libvirt/libvirt-domain.h
index d26faa5..e577f26 100644
--- a/include/libvirt/libvirt-domain.h
+++ b/include/libvirt/libvirt-domain.h
@@ -757,6 +757,16 @@ typedef enum {
  */
 # define VIR_MIGRATE_PARAM_MIGRATE_DISKS"migrate_disks"
 
+/**
+ * VIR_MIGRATE_PARAM_NBD_PORT:
+ *
+ * virDomainMigrate* params field: port that destination nbd server should use
+ * for incoming disks migration. Type is VIR_TYPED_PARAM_INT. If set to 0 or
+ * omitted, libvirt will choose a suitable default. At the moment this is only
+ * supported by the QEMU driver.
+ */
+# define VIR_MIGRATE_PARAM_NBD_PORT"nbd_port"
+
 /* Domain migration. */
 virDomainPtr virDomainMigrate (virDomainPtr domain, virConnectPtr dconn,
unsigned long flags, const char *dname,
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 8ccf68b..4d00ba4 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -12082,7 +12082,7 @@ qemuDomainMigratePrepare2(virConnectPtr dconn,
 ret = qemuMigrationPrepareDirect(driver, dconn,
  NULL, 0, NULL, NULL, /* No cookies */
  uri_in, uri_out,
- &def, origname, NULL, 0, NULL, flags);
+ &def, origname, NULL, 0, NULL, 0, flags);
 
  cleanup:
 VIR_FREE(origname);
@@ -12135,7 +12135,7 @@ qemuDomainMigratePerform(virDomainPtr dom,
  * Consume any cookie we were able to decode though
  */
 ret = qemuMigrationPerform(driver, dom->conn, vm,
-   NULL, dconnuri, uri, NULL, NULL, 0, NULL,
+   NULL, dconnuri, uri, NULL, NULL, 0, NULL, 0,
cookie, cookielen,
NULL, NULL, /* No output cookies in v2 */
flags, dname, resource, false);
@@ -12308,7 +12308,7 @@ qemuDomainMigratePrepare3(virConnectPtr dconn,
  cookiein, cookieinlen,
  cookieout, cookieoutlen,
  uri_in, uri_out,
- &def, origname, NULL, 0, NULL, flags);
+ &def, origname, NULL, 0, NULL, 0, flags);
 
  cleanup:
 VIR_FREE(origname);
@@ -12334,6 +12334,7 @@ qemuDomainMigratePrepare3Params(virConnectPtr dconn,
 const char *dname = NULL;
 const char *uri_in = NULL;
 const char *listenAddress = cfg->migrationAddress;
+int nbdPort = 0;
 int nmigrate_disks;
 const char **migrate_disks = NULL;
 char *origname = NULL;
@@ -12354,7 +12355,10 @@ qemuDomainMigratePrepare3Params(virConnectPtr dconn,
 &uri_in) < 0 ||
 virTypedParamsGetString(params, nparams,
 VIR_MIGRATE_PARAM_LISTEN_ADDRESS,
-&listenAddress) < 0)
+&listenAddress) < 0 ||
+virTypedParamsGetInt(params, nparams,
+VIR_MIGRATE_PARAM_NBD_PORT,
+&nbdPort) < 0)
 goto cleanup;
 
 nmigrate_disks = virTypedParamsGetStringList(params, nparams,
@@ -12385,7 +12389,8 @@ qemuDomainMigratePrepare3Params(virConnectPtr dconn,
  cookieout, cookieoutlen,
  uri_in, uri_out,
  &def, origname, listenAddress,
- nmigrate_disks, migrate_disks, flags);
+