File suse-set-migration-constraints.patch of Package perl-Sys-Virt

Add migration constraint parameters to libvirt perl bindings

References: fate#316614, bsc#859868

Index: Sys-Virt-8.0.0/lib/Sys/Virt/Domain.pm
===================================================================
--- Sys-Virt-8.0.0.orig/lib/Sys/Virt/Domain.pm
+++ Sys-Virt-8.0.0/lib/Sys/Virt/Domain.pm
@@ -1176,6 +1176,18 @@ omitted libvirt will auto-generate suita
 only necessary to specify this URI if the destination host has multiple
 interfaces and a specific interface is required to transmit storage data.
 
+=item C<Sys::Virt::Domain::MIGRATE_PARAM_SUSE_MAX_ITERS>
+
+The the maximum number of iterations before final suspend
+
+=item C<Sys::Virt::Domain::MIGRATE_PARAM_SUSE_MIN_REMAINING>
+
+The number of dirty pages before final suspend
+
+=item C<Sys::Virt::Domain::MIGRATE_PARAM_SUSE_ABORT_IF_BUSY>
+
+Abort the migration instead of doing the final suspend for VMs with busy workloads
+
 =back
 
 =item $ddom = $dom->migrate(destcon, flags=0, dname=undef, uri=undef, bandwidth=0)
Index: Sys-Virt-8.0.0/lib/Sys/Virt.xs
===================================================================
--- Sys-Virt-8.0.0.orig/lib/Sys/Virt.xs
+++ Sys-Virt-8.0.0/lib/Sys/Virt.xs
@@ -5613,7 +5613,7 @@ _migrate(dom, destcon, newparams, flags=
      virTypedParameterPtr params;
      int nparams;
     CODE:
-     nparams = 19;
+     nparams = 22;
      Newx(params, nparams, virTypedParameter);
 
      strncpy(params[0].field, VIR_MIGRATE_PARAM_URI,
@@ -5692,6 +5692,18 @@ _migrate(dom, destcon, newparams, flags=
              VIR_TYPED_PARAM_FIELD_LENGTH);
      params[18].type = VIR_TYPED_PARAM_STRING;
 
+     strncpy(params[19].field, VIR_MIGRATE_PARAM_SUSE_MAX_ITERS,
+             VIR_TYPED_PARAM_FIELD_LENGTH);
+     params[19].type = VIR_TYPED_PARAM_UINT;
+
+     strncpy(params[20].field, VIR_MIGRATE_PARAM_SUSE_MIN_REMAINING,
+             VIR_TYPED_PARAM_FIELD_LENGTH);
+     params[20].type = VIR_TYPED_PARAM_UINT;
+
+     strncpy(params[21].field, VIR_MIGRATE_PARAM_SUSE_ABORT_IF_BUSY,
+             VIR_TYPED_PARAM_FIELD_LENGTH);
+     params[21].type = VIR_TYPED_PARAM_UINT;
+
      nparams = vir_typed_param_from_hv(newparams, params, nparams);
 
      vir_typed_param_add_string_list_from_hv(newparams, &params, &nparams,
@@ -5720,7 +5732,7 @@ _migrate_to_uri(dom, desturi, newparams,
      virTypedParameterPtr params;
      int nparams;
   PPCODE:
-     nparams = 19;
+     nparams = 22;
      Newx(params, nparams, virTypedParameter);
 
      strncpy(params[0].field, VIR_MIGRATE_PARAM_URI,
@@ -5799,6 +5811,18 @@ _migrate_to_uri(dom, desturi, newparams,
              VIR_TYPED_PARAM_FIELD_LENGTH);
      params[18].type = VIR_TYPED_PARAM_STRING;
 
+     strncpy(params[19].field, VIR_MIGRATE_PARAM_SUSE_MAX_ITERS,
+             VIR_TYPED_PARAM_FIELD_LENGTH);
+     params[19].type = VIR_TYPED_PARAM_UINT;
+
+     strncpy(params[20].field, VIR_MIGRATE_PARAM_SUSE_MIN_REMAINING,
+             VIR_TYPED_PARAM_FIELD_LENGTH);
+     params[20].type = VIR_TYPED_PARAM_UINT;
+
+     strncpy(params[21].field, VIR_MIGRATE_PARAM_SUSE_ABORT_IF_BUSY,
+             VIR_TYPED_PARAM_FIELD_LENGTH);
+     params[21].type = VIR_TYPED_PARAM_UINT;
+
      nparams = vir_typed_param_from_hv(newparams, params, nparams);
 
      vir_typed_param_add_string_list_from_hv(newparams, &params, &nparams,
@@ -9680,6 +9704,9 @@ BOOT:
       REGISTER_CONSTANT_STR(VIR_MIGRATE_PARAM_DISKS_URI, MIGRATE_PARAM_DISKS_URI);
 
       REGISTER_CONSTANT(VIR_DOMAIN_MIGRATE_MAX_SPEED_POSTCOPY, MIGRATE_MAX_SPEED_POSTCOPY);
+      REGISTER_CONSTANT_STR(VIR_MIGRATE_PARAM_SUSE_MAX_ITERS, MIGRATE_PARAM_SUSE_MAX_ITERS);
+      REGISTER_CONSTANT_STR(VIR_MIGRATE_PARAM_SUSE_MIN_REMAINING, MIGRATE_PARAM_SUSE_MIN_REMAINING);
+      REGISTER_CONSTANT_STR(VIR_MIGRATE_PARAM_SUSE_ABORT_IF_BUSY, MIGRATE_PARAM_SUSE_ABORT_IF_BUSY);
 
       REGISTER_CONSTANT(VIR_DOMAIN_XML_SECURE, XML_SECURE);
       REGISTER_CONSTANT(VIR_DOMAIN_XML_INACTIVE, XML_INACTIVE);
openSUSE Build Service is sponsored by