[libvirt] [PATCH 5/8] Public API for post-copy migration bandwidth

Jiri Denemark posted 8 patches 32 weeks ago

[libvirt] [PATCH 5/8] Public API for post-copy migration bandwidth

Posted by Jiri Denemark 32 weeks ago
This patch adds a new VIR_MIGRATE_PARAM_BANDWIDTH_POSTCOPY typed
parameter for virDomainMigrate3 and virDomainMigrateToURI3 for setting
maximum post-copy migration bandwidth.

In case the initial VIR_MIGRATE_PARAM_BANDWIDTH_POSTCOPY value turns out
to be suboptimal a new VIR_DOMAIN_MIGRATE_MAX_SPEED_POSTCOPY flag for
virDomainMigrateSetMaxSpeed and virDomainMigrateGetMaxSpeed may be used
to set/get the maximum post-copy migration bandwidth while migration is
already running.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
---
 include/libvirt/libvirt-domain.h | 15 +++++++++++++++
 src/libvirt-domain.c             | 11 ++++++++---
 2 files changed, 23 insertions(+), 3 deletions(-)

diff --git a/include/libvirt/libvirt-domain.h b/include/libvirt/libvirt-domain.h
index 0388911ded..d99f9b690b 100644
--- a/include/libvirt/libvirt-domain.h
+++ b/include/libvirt/libvirt-domain.h
@@ -903,6 +903,15 @@ typedef enum {
  */
 # define VIR_MIGRATE_PARAM_BANDWIDTH         "bandwidth"
 
+/**
+ * VIR_MIGRATE_PARAM_BANDWIDTH_POSTCOPY:
+ *
+ * virDomainMigrate* params field: the maximum bandwidth (in MiB/s) that will
+ * be used for post-copy phase of a migration as VIR_TYPED_PARAM_ULLONG. If set
+ * to 0 or omitted, post-copy migration speed will not be limited.
+ */
+# define VIR_MIGRATE_PARAM_BANDWIDTH_POSTCOPY "bandwidth.postcopy"
+
 /**
  * VIR_MIGRATE_PARAM_GRAPHICS_URI:
  *
@@ -1062,6 +1071,12 @@ int virDomainMigrateSetCompressionCache(virDomainPtr domain,
                                         unsigned long long cacheSize,
                                         unsigned int flags);
 
+/* Domain migration speed flags. */
+typedef enum {
+    /* Set or get maximum speed of postcopy migration. */
+    VIR_DOMAIN_MIGRATE_MAX_SPEED_POSTCOPY = (1 << 0),
+} virDomainMigrateMaxSpeedFlags;
+
 int virDomainMigrateSetMaxSpeed(virDomainPtr domain,
                                 unsigned long bandwidth,
                                 unsigned int flags);
diff --git a/src/libvirt-domain.c b/src/libvirt-domain.c
index 58b4863c8f..7b87b3716a 100644
--- a/src/libvirt-domain.c
+++ b/src/libvirt-domain.c
@@ -9036,11 +9036,13 @@ virDomainMigrateSetCompressionCache(virDomainPtr domain,
  * virDomainMigrateSetMaxSpeed:
  * @domain: a domain object
  * @bandwidth: migration bandwidth limit in MiB/s
- * @flags: extra flags; not used yet, so callers should always pass 0
+ * @flags: bitwise-OR of virDomainMigrateMaxSpeedFlags
  *
  * The maximum bandwidth (in MiB/s) that will be used to do migration
  * can be specified with the bandwidth parameter. Not all hypervisors
- * will support a bandwidth cap
+ * will support a bandwidth cap. When VIR_DOMAIN_MIGRATE_MAX_SPEED_POSTCOPY
+ * is set in @flags, this API sets the maximum bandwidth for the postcopy
+ * phase of the migration.
  *
  * Returns 0 in case of success, -1 otherwise.
  */
@@ -9077,10 +9079,13 @@ virDomainMigrateSetMaxSpeed(virDomainPtr domain,
  * virDomainMigrateGetMaxSpeed:
  * @domain: a domain object
  * @bandwidth: return value of current migration bandwidth limit in MiB/s
- * @flags: extra flags; not used yet, so callers should always pass 0
+ * @flags: bitwise-OR of virDomainMigrateMaxSpeedFlags
  *
  * Get the current maximum bandwidth (in MiB/s) that will be used if the
  * domain is migrated.  Not all hypervisors will support a bandwidth limit.
+ * When VIR_DOMAIN_MIGRATE_MAX_SPEED_POSTCOPY is set in @flags, this API
+ * gets the current maximum bandwidth for the postcopy phase of the
+ * migration.
  *
  * Returns 0 in case of success, -1 otherwise.
  */
-- 
2.20.1

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

Re: [libvirt] [PATCH 5/8] Public API for post-copy migration bandwidth

Posted by Ján Tomko 32 weeks ago
On Tue, Feb 05, 2019 at 04:23:08PM +0100, Jiri Denemark wrote:
>This patch adds a new VIR_MIGRATE_PARAM_BANDWIDTH_POSTCOPY typed
>parameter for virDomainMigrate3 and virDomainMigrateToURI3 for setting
>maximum post-copy migration bandwidth.
>
>In case the initial VIR_MIGRATE_PARAM_BANDWIDTH_POSTCOPY value turns out
>to be suboptimal a new VIR_DOMAIN_MIGRATE_MAX_SPEED_POSTCOPY flag for
>virDomainMigrateSetMaxSpeed and virDomainMigrateGetMaxSpeed may be used
>to set/get the maximum post-copy migration bandwidth while migration is
>already running.
>
>Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
>---
> include/libvirt/libvirt-domain.h | 15 +++++++++++++++
> src/libvirt-domain.c             | 11 ++++++++---
> 2 files changed, 23 insertions(+), 3 deletions(-)
>
>diff --git a/include/libvirt/libvirt-domain.h b/include/libvirt/libvirt-domain.h
>index 0388911ded..d99f9b690b 100644
>--- a/include/libvirt/libvirt-domain.h
>+++ b/include/libvirt/libvirt-domain.h
>@@ -903,6 +903,15 @@ typedef enum {
>  */
> # define VIR_MIGRATE_PARAM_BANDWIDTH         "bandwidth"
>
>+/**
>+ * VIR_MIGRATE_PARAM_BANDWIDTH_POSTCOPY:
>+ *
>+ * virDomainMigrate* params field: the maximum bandwidth (in MiB/s) that will

I guess granularity < 1 MiB/s is not worth the trouble of creating an
inconsistent API, is it?

>+ * be used for post-copy phase of a migration as VIR_TYPED_PARAM_ULLONG. If set
>+ * to 0 or omitted, post-copy migration speed will not be limited.
>+ */
>+# define VIR_MIGRATE_PARAM_BANDWIDTH_POSTCOPY "bandwidth.postcopy"
>+
> /**
>  * VIR_MIGRATE_PARAM_GRAPHICS_URI:
>  *
>@@ -1062,6 +1071,12 @@ int virDomainMigrateSetCompressionCache(virDomainPtr domain,
>                                         unsigned long long cacheSize,
>                                         unsigned int flags);
>
>+/* Domain migration speed flags. */
>+typedef enum {
>+    /* Set or get maximum speed of postcopy migration. */

post-copy is the spelling used for human-readable strings

>+    VIR_DOMAIN_MIGRATE_MAX_SPEED_POSTCOPY = (1 << 0),
>+} virDomainMigrateMaxSpeedFlags;
>+
> int virDomainMigrateSetMaxSpeed(virDomainPtr domain,
>                                 unsigned long bandwidth,
>                                 unsigned int flags);
>diff --git a/src/libvirt-domain.c b/src/libvirt-domain.c
>index 58b4863c8f..7b87b3716a 100644
>--- a/src/libvirt-domain.c
>+++ b/src/libvirt-domain.c
>@@ -9036,11 +9036,13 @@ virDomainMigrateSetCompressionCache(virDomainPtr domain,
>  * virDomainMigrateSetMaxSpeed:
>  * @domain: a domain object
>  * @bandwidth: migration bandwidth limit in MiB/s
>- * @flags: extra flags; not used yet, so callers should always pass 0
>+ * @flags: bitwise-OR of virDomainMigrateMaxSpeedFlags
>  *
>  * The maximum bandwidth (in MiB/s) that will be used to do migration
>  * can be specified with the bandwidth parameter. Not all hypervisors
>- * will support a bandwidth cap
>+ * will support a bandwidth cap. When VIR_DOMAIN_MIGRATE_MAX_SPEED_POSTCOPY
>+ * is set in @flags, this API sets the maximum bandwidth for the postcopy

post-copy

>+ * phase of the migration.
>  *
>  * Returns 0 in case of success, -1 otherwise.
>  */
>@@ -9077,10 +9079,13 @@ virDomainMigrateSetMaxSpeed(virDomainPtr domain,
>  * virDomainMigrateGetMaxSpeed:
>  * @domain: a domain object
>  * @bandwidth: return value of current migration bandwidth limit in MiB/s
>- * @flags: extra flags; not used yet, so callers should always pass 0
>+ * @flags: bitwise-OR of virDomainMigrateMaxSpeedFlags
>  *
>  * Get the current maximum bandwidth (in MiB/s) that will be used if the
>  * domain is migrated.  Not all hypervisors will support a bandwidth limit.
>+ * When VIR_DOMAIN_MIGRATE_MAX_SPEED_POSTCOPY is set in @flags, this API
>+ * gets the current maximum bandwidth for the postcopy phase of the

post-copy

>+ * migration.
>  *

Reviewed-by: Ján Tomko <jtomko@redhat.com>

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