Re: [libvirt] [PATCH V8 2/2] libxl: add migration support

2014-06-11 Thread John Ferlan

This patch has resulted in a new Coverity warnings (looking at them was
just lower on my list of things to do lately)...

Anyway - see libxlDoMigrateReceive() and libxlDomainMigrationFinish()
for the details...

John

On 06/04/2014 04:35 PM, Jim Fehlig wrote:
 This patch adds initial migration support to the libxl driver,
 using the VIR_DRV_FEATURE_MIGRATION_PARAMS family of migration
 functions.
 
 Signed-off-by: Jim Fehlig jfeh...@suse.com
 ---
  po/POTFILES.in  |   1 +
  src/Makefile.am |   3 +-
  src/libxl/libxl_conf.h  |   6 +
  src/libxl/libxl_domain.h|   1 +
  src/libxl/libxl_driver.c| 235 ++
  src/libxl/libxl_migration.c | 585 
 
  src/libxl/libxl_migration.h |  79 ++
  7 files changed, 909 insertions(+), 1 deletion(-)
 
 diff --git a/po/POTFILES.in b/po/POTFILES.in
 index cff92d9..2ee7225 100644
 --- a/po/POTFILES.in
 +++ b/po/POTFILES.in
 @@ -74,6 +74,7 @@ src/lxc/lxc_process.c
  src/libxl/libxl_domain.c
  src/libxl/libxl_driver.c
  src/libxl/libxl_conf.c
 +src/libxl/libxl_migration.c
  src/network/bridge_driver.c
  src/network/bridge_driver_linux.c
  src/network/leaseshelper.c
 diff --git a/src/Makefile.am b/src/Makefile.am
 index d82ca26..01af164 100644
 --- a/src/Makefile.am
 +++ b/src/Makefile.am
 @@ -707,7 +707,8 @@ XENAPI_DRIVER_SOURCES =   
 \
  LIBXL_DRIVER_SOURCES =   \
   libxl/libxl_conf.c libxl/libxl_conf.h   \
   libxl/libxl_domain.c libxl/libxl_domain.h   \
 - libxl/libxl_driver.c libxl/libxl_driver.h
 + libxl/libxl_driver.c libxl/libxl_driver.h   \
 + libxl/libxl_migration.c libxl/libxl_migration.h
  
  UML_DRIVER_SOURCES = \
   uml/uml_conf.c uml/uml_conf.h   \
 diff --git a/src/libxl/libxl_conf.h b/src/libxl/libxl_conf.h
 index 433d6da..6aa36d2 100644
 --- a/src/libxl/libxl_conf.h
 +++ b/src/libxl/libxl_conf.h
 @@ -43,6 +43,9 @@
  # define LIBXL_VNC_PORT_MIN  5900
  # define LIBXL_VNC_PORT_MAX  65535
  
 +# define LIBXL_MIGRATION_PORT_MIN  49152
 +# define LIBXL_MIGRATION_PORT_MAX  49216
 +
  # define LIBXL_CONFIG_DIR SYSCONFDIR /libvirt/libxl
  # define LIBXL_AUTOSTART_DIR LIBXL_CONFIG_DIR /autostart
  # define LIBXL_STATE_DIR LOCALSTATEDIR /run/libvirt/libxl
 @@ -115,6 +118,9 @@ struct _libxlDriverPrivate {
  /* Immutable pointer, self-locking APIs */
  virPortAllocatorPtr reservedVNCPorts;
  
 +/* Immutable pointer, self-locking APIs */
 +virPortAllocatorPtr migrationPorts;
 +
  /* Immutable pointer, lockless APIs*/
  virSysinfoDefPtr hostsysinfo;
  };
 diff --git a/src/libxl/libxl_domain.h b/src/libxl/libxl_domain.h
 index 6939008..f459fdf 100644
 --- a/src/libxl/libxl_domain.h
 +++ b/src/libxl/libxl_domain.h
 @@ -69,6 +69,7 @@ struct _libxlDomainObjPrivate {
  virChrdevsPtr devs;
  libxl_evgen_domain_death *deathW;
  libxlDriverPrivatePtr driver;
 +unsigned short migrationPort;
  
  struct libxlDomainJobObj job;
  };
 diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c
 index 515d5c9..9feacb1 100644
 --- a/src/libxl/libxl_driver.c
 +++ b/src/libxl/libxl_driver.c
 @@ -45,6 +45,7 @@
  #include libxl_domain.h
  #include libxl_driver.h
  #include libxl_conf.h
 +#include libxl_migration.h
  #include xen_xm.h
  #include xen_sxpr.h
  #include virtypedparam.h
 @@ -209,6 +210,7 @@ libxlStateCleanup(void)
  virObjectUnref(libxl_driver-xmlopt);
  virObjectUnref(libxl_driver-domains);
  virObjectUnref(libxl_driver-reservedVNCPorts);
 +virObjectUnref(libxl_driver-migrationPorts);
  
  virObjectEventStateFree(libxl_driver-domainEventState);
  virSysinfoDefFree(libxl_driver-hostsysinfo);
 @@ -301,6 +303,13 @@ libxlStateInitialize(bool privileged,
LIBXL_VNC_PORT_MAX)))
  goto error;
  
 +/* Allocate bitmap for migration port reservation */
 +if (!(libxl_driver-migrationPorts =
 +  virPortAllocatorNew(_(migration),
 +  LIBXL_MIGRATION_PORT_MIN,
 +  LIBXL_MIGRATION_PORT_MAX)))
 +goto error;
 +
  if (!(libxl_driver-domains = virDomainObjListNew()))
  goto error;
  
 @@ -4153,6 +4162,7 @@ libxlConnectSupportsFeature(virConnectPtr conn, int 
 feature)
  
  switch (feature) {
  case VIR_DRV_FEATURE_TYPED_PARAM_STRING:
 +case VIR_DRV_FEATURE_MIGRATION_PARAMS:
  return 1;
  default:
  return 0;
 @@ -4331,6 +4341,226 @@ libxlNodeDeviceReset(virNodeDevicePtr dev)
  return ret;
  }
  
 +static char *
 +libxlDomainMigrateBegin3Params(virDomainPtr domain,
 +   virTypedParameterPtr params,
 +   int nparams,
 +   char **cookieout ATTRIBUTE_UNUSED,
 +  

Re: [libvirt] [PATCH V8 2/2] libxl: add migration support

2014-06-11 Thread Jim Fehlig
John Ferlan wrote:
 This patch has resulted in a new Coverity warnings (looking at them was
 just lower on my list of things to do lately)...

 Anyway - see libxlDoMigrateReceive() and libxlDomainMigrationFinish()
 for the details...
   

Should have looked at this before responding to your patch to fix the
warnings.  Does that patch fix all the issues noted below?

Regards,
Jim

 John

 On 06/04/2014 04:35 PM, Jim Fehlig wrote:
   
 This patch adds initial migration support to the libxl driver,
 using the VIR_DRV_FEATURE_MIGRATION_PARAMS family of migration
 functions.

 Signed-off-by: Jim Fehlig jfeh...@suse.com
 ---
  po/POTFILES.in  |   1 +
  src/Makefile.am |   3 +-
  src/libxl/libxl_conf.h  |   6 +
  src/libxl/libxl_domain.h|   1 +
  src/libxl/libxl_driver.c| 235 ++
  src/libxl/libxl_migration.c | 585 
 
  src/libxl/libxl_migration.h |  79 ++
  7 files changed, 909 insertions(+), 1 deletion(-)

 diff --git a/po/POTFILES.in b/po/POTFILES.in
 index cff92d9..2ee7225 100644
 --- a/po/POTFILES.in
 +++ b/po/POTFILES.in
 @@ -74,6 +74,7 @@ src/lxc/lxc_process.c
  src/libxl/libxl_domain.c
  src/libxl/libxl_driver.c
  src/libxl/libxl_conf.c
 +src/libxl/libxl_migration.c
  src/network/bridge_driver.c
  src/network/bridge_driver_linux.c
  src/network/leaseshelper.c
 diff --git a/src/Makefile.am b/src/Makefile.am
 index d82ca26..01af164 100644
 --- a/src/Makefile.am
 +++ b/src/Makefile.am
 @@ -707,7 +707,8 @@ XENAPI_DRIVER_SOURCES =  
 \
  LIBXL_DRIVER_SOURCES =  \
  libxl/libxl_conf.c libxl/libxl_conf.h   \
  libxl/libxl_domain.c libxl/libxl_domain.h   \
 -libxl/libxl_driver.c libxl/libxl_driver.h
 +libxl/libxl_driver.c libxl/libxl_driver.h   \
 +libxl/libxl_migration.c libxl/libxl_migration.h
  
  UML_DRIVER_SOURCES =\
  uml/uml_conf.c uml/uml_conf.h   \
 diff --git a/src/libxl/libxl_conf.h b/src/libxl/libxl_conf.h
 index 433d6da..6aa36d2 100644
 --- a/src/libxl/libxl_conf.h
 +++ b/src/libxl/libxl_conf.h
 @@ -43,6 +43,9 @@
  # define LIBXL_VNC_PORT_MIN  5900
  # define LIBXL_VNC_PORT_MAX  65535
  
 +# define LIBXL_MIGRATION_PORT_MIN  49152
 +# define LIBXL_MIGRATION_PORT_MAX  49216
 +
  # define LIBXL_CONFIG_DIR SYSCONFDIR /libvirt/libxl
  # define LIBXL_AUTOSTART_DIR LIBXL_CONFIG_DIR /autostart
  # define LIBXL_STATE_DIR LOCALSTATEDIR /run/libvirt/libxl
 @@ -115,6 +118,9 @@ struct _libxlDriverPrivate {
  /* Immutable pointer, self-locking APIs */
  virPortAllocatorPtr reservedVNCPorts;
  
 +/* Immutable pointer, self-locking APIs */
 +virPortAllocatorPtr migrationPorts;
 +
  /* Immutable pointer, lockless APIs*/
  virSysinfoDefPtr hostsysinfo;
  };
 diff --git a/src/libxl/libxl_domain.h b/src/libxl/libxl_domain.h
 index 6939008..f459fdf 100644
 --- a/src/libxl/libxl_domain.h
 +++ b/src/libxl/libxl_domain.h
 @@ -69,6 +69,7 @@ struct _libxlDomainObjPrivate {
  virChrdevsPtr devs;
  libxl_evgen_domain_death *deathW;
  libxlDriverPrivatePtr driver;
 +unsigned short migrationPort;
  
  struct libxlDomainJobObj job;
  };
 diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c
 index 515d5c9..9feacb1 100644
 --- a/src/libxl/libxl_driver.c
 +++ b/src/libxl/libxl_driver.c
 @@ -45,6 +45,7 @@
  #include libxl_domain.h
  #include libxl_driver.h
  #include libxl_conf.h
 +#include libxl_migration.h
  #include xen_xm.h
  #include xen_sxpr.h
  #include virtypedparam.h
 @@ -209,6 +210,7 @@ libxlStateCleanup(void)
  virObjectUnref(libxl_driver-xmlopt);
  virObjectUnref(libxl_driver-domains);
  virObjectUnref(libxl_driver-reservedVNCPorts);
 +virObjectUnref(libxl_driver-migrationPorts);
  
  virObjectEventStateFree(libxl_driver-domainEventState);
  virSysinfoDefFree(libxl_driver-hostsysinfo);
 @@ -301,6 +303,13 @@ libxlStateInitialize(bool privileged,
LIBXL_VNC_PORT_MAX)))
  goto error;
  
 +/* Allocate bitmap for migration port reservation */
 +if (!(libxl_driver-migrationPorts =
 +  virPortAllocatorNew(_(migration),
 +  LIBXL_MIGRATION_PORT_MIN,
 +  LIBXL_MIGRATION_PORT_MAX)))
 +goto error;
 +
  if (!(libxl_driver-domains = virDomainObjListNew()))
  goto error;
  
 @@ -4153,6 +4162,7 @@ libxlConnectSupportsFeature(virConnectPtr conn, int 
 feature)
  
  switch (feature) {
  case VIR_DRV_FEATURE_TYPED_PARAM_STRING:
 +case VIR_DRV_FEATURE_MIGRATION_PARAMS:
  return 1;
  default:
  return 0;
 @@ -4331,6 +4341,226 @@ libxlNodeDeviceReset(virNodeDevicePtr dev)
  return ret;
  }
  
 +static char *
 +libxlDomainMigrateBegin3Params(virDomainPtr domain,
 + 

Re: [libvirt] [PATCH V8 2/2] libxl: add migration support

2014-06-11 Thread John Ferlan


On 06/11/2014 11:13 AM, Jim Fehlig wrote:
 John Ferlan wrote:
 This patch has resulted in a new Coverity warnings (looking at them was
 just lower on my list of things to do lately)...

 Anyway - see libxlDoMigrateReceive() and libxlDomainMigrationFinish()
 for the details...
   
 
 Should have looked at this before responding to your patch to fix the
 warnings.  Does that patch fix all the issues noted below?
 
 Regards,
 Jim
 

Yes it does - I figured they were low hanging fruit so I just sent the
patch... Responding to it gives recent context rather than searching
out the git commit id or the list entry in the archives and pointing at it.

John

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


[libvirt] [PATCH V8 2/2] libxl: add migration support

2014-06-04 Thread Jim Fehlig
This patch adds initial migration support to the libxl driver,
using the VIR_DRV_FEATURE_MIGRATION_PARAMS family of migration
functions.

Signed-off-by: Jim Fehlig jfeh...@suse.com
---
 po/POTFILES.in  |   1 +
 src/Makefile.am |   3 +-
 src/libxl/libxl_conf.h  |   6 +
 src/libxl/libxl_domain.h|   1 +
 src/libxl/libxl_driver.c| 235 ++
 src/libxl/libxl_migration.c | 585 
 src/libxl/libxl_migration.h |  79 ++
 7 files changed, 909 insertions(+), 1 deletion(-)

diff --git a/po/POTFILES.in b/po/POTFILES.in
index cff92d9..2ee7225 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -74,6 +74,7 @@ src/lxc/lxc_process.c
 src/libxl/libxl_domain.c
 src/libxl/libxl_driver.c
 src/libxl/libxl_conf.c
+src/libxl/libxl_migration.c
 src/network/bridge_driver.c
 src/network/bridge_driver_linux.c
 src/network/leaseshelper.c
diff --git a/src/Makefile.am b/src/Makefile.am
index d82ca26..01af164 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -707,7 +707,8 @@ XENAPI_DRIVER_SOURCES = 
\
 LIBXL_DRIVER_SOURCES = \
libxl/libxl_conf.c libxl/libxl_conf.h   \
libxl/libxl_domain.c libxl/libxl_domain.h   \
-   libxl/libxl_driver.c libxl/libxl_driver.h
+   libxl/libxl_driver.c libxl/libxl_driver.h   \
+   libxl/libxl_migration.c libxl/libxl_migration.h
 
 UML_DRIVER_SOURCES =   \
uml/uml_conf.c uml/uml_conf.h   \
diff --git a/src/libxl/libxl_conf.h b/src/libxl/libxl_conf.h
index 433d6da..6aa36d2 100644
--- a/src/libxl/libxl_conf.h
+++ b/src/libxl/libxl_conf.h
@@ -43,6 +43,9 @@
 # define LIBXL_VNC_PORT_MIN  5900
 # define LIBXL_VNC_PORT_MAX  65535
 
+# define LIBXL_MIGRATION_PORT_MIN  49152
+# define LIBXL_MIGRATION_PORT_MAX  49216
+
 # define LIBXL_CONFIG_DIR SYSCONFDIR /libvirt/libxl
 # define LIBXL_AUTOSTART_DIR LIBXL_CONFIG_DIR /autostart
 # define LIBXL_STATE_DIR LOCALSTATEDIR /run/libvirt/libxl
@@ -115,6 +118,9 @@ struct _libxlDriverPrivate {
 /* Immutable pointer, self-locking APIs */
 virPortAllocatorPtr reservedVNCPorts;
 
+/* Immutable pointer, self-locking APIs */
+virPortAllocatorPtr migrationPorts;
+
 /* Immutable pointer, lockless APIs*/
 virSysinfoDefPtr hostsysinfo;
 };
diff --git a/src/libxl/libxl_domain.h b/src/libxl/libxl_domain.h
index 6939008..f459fdf 100644
--- a/src/libxl/libxl_domain.h
+++ b/src/libxl/libxl_domain.h
@@ -69,6 +69,7 @@ struct _libxlDomainObjPrivate {
 virChrdevsPtr devs;
 libxl_evgen_domain_death *deathW;
 libxlDriverPrivatePtr driver;
+unsigned short migrationPort;
 
 struct libxlDomainJobObj job;
 };
diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c
index 515d5c9..9feacb1 100644
--- a/src/libxl/libxl_driver.c
+++ b/src/libxl/libxl_driver.c
@@ -45,6 +45,7 @@
 #include libxl_domain.h
 #include libxl_driver.h
 #include libxl_conf.h
+#include libxl_migration.h
 #include xen_xm.h
 #include xen_sxpr.h
 #include virtypedparam.h
@@ -209,6 +210,7 @@ libxlStateCleanup(void)
 virObjectUnref(libxl_driver-xmlopt);
 virObjectUnref(libxl_driver-domains);
 virObjectUnref(libxl_driver-reservedVNCPorts);
+virObjectUnref(libxl_driver-migrationPorts);
 
 virObjectEventStateFree(libxl_driver-domainEventState);
 virSysinfoDefFree(libxl_driver-hostsysinfo);
@@ -301,6 +303,13 @@ libxlStateInitialize(bool privileged,
   LIBXL_VNC_PORT_MAX)))
 goto error;
 
+/* Allocate bitmap for migration port reservation */
+if (!(libxl_driver-migrationPorts =
+  virPortAllocatorNew(_(migration),
+  LIBXL_MIGRATION_PORT_MIN,
+  LIBXL_MIGRATION_PORT_MAX)))
+goto error;
+
 if (!(libxl_driver-domains = virDomainObjListNew()))
 goto error;
 
@@ -4153,6 +4162,7 @@ libxlConnectSupportsFeature(virConnectPtr conn, int 
feature)
 
 switch (feature) {
 case VIR_DRV_FEATURE_TYPED_PARAM_STRING:
+case VIR_DRV_FEATURE_MIGRATION_PARAMS:
 return 1;
 default:
 return 0;
@@ -4331,6 +4341,226 @@ libxlNodeDeviceReset(virNodeDevicePtr dev)
 return ret;
 }
 
+static char *
+libxlDomainMigrateBegin3Params(virDomainPtr domain,
+   virTypedParameterPtr params,
+   int nparams,
+   char **cookieout ATTRIBUTE_UNUSED,
+   int *cookieoutlen ATTRIBUTE_UNUSED,
+   unsigned int flags)
+{
+const char *xmlin = NULL;
+virDomainObjPtr vm = NULL;
+
+virCheckFlags(LIBXL_MIGRATION_FLAGS, NULL);
+if (virTypedParamsValidate(params, nparams, LIBXL_MIGRATION_PARAMETERS)  
0)
+return NULL;
+
+if (virTypedParamsGetString(params, 

Re: [libvirt] [PATCH V8 2/2] libxl: add migration support

2014-06-04 Thread Daniel P. Berrange
On Wed, Jun 04, 2014 at 02:35:14PM -0600, Jim Fehlig wrote:
 This patch adds initial migration support to the libxl driver,
 using the VIR_DRV_FEATURE_MIGRATION_PARAMS family of migration
 functions.
 
 Signed-off-by: Jim Fehlig jfeh...@suse.com
 ---
  po/POTFILES.in  |   1 +
  src/Makefile.am |   3 +-
  src/libxl/libxl_conf.h  |   6 +
  src/libxl/libxl_domain.h|   1 +
  src/libxl/libxl_driver.c| 235 ++
  src/libxl/libxl_migration.c | 585 
 
  src/libxl/libxl_migration.h |  79 ++
  7 files changed, 909 insertions(+), 1 deletion(-)

ACK


Regards,
Daniel
-- 
|: http://berrange.com  -o-http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org  -o- http://virt-manager.org :|
|: http://autobuild.org   -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org   -o-   http://live.gnome.org/gtk-vnc :|

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


Re: [libvirt] [PATCH V8 2/2] libxl: add migration support

2014-06-04 Thread Jim Fehlig
Daniel P. Berrange wrote:
 On Wed, Jun 04, 2014 at 02:35:14PM -0600, Jim Fehlig wrote:
   
 This patch adds initial migration support to the libxl driver,
 using the VIR_DRV_FEATURE_MIGRATION_PARAMS family of migration
 functions.

 Signed-off-by: Jim Fehlig jfeh...@suse.com
 ---
  po/POTFILES.in  |   1 +
  src/Makefile.am |   3 +-
  src/libxl/libxl_conf.h  |   6 +
  src/libxl/libxl_domain.h|   1 +
  src/libxl/libxl_driver.c| 235 ++
  src/libxl/libxl_migration.c | 585 
 
  src/libxl/libxl_migration.h |  79 ++
  7 files changed, 909 insertions(+), 1 deletion(-)
 

 ACK
   

Thanks, I pushed these patches now.  The ABI stability check was a nice
improvement.  Verified it works when making simple changes like number
of vcpus, max mem, etc.

Regards,
Jim

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