Peter V. Saveliev has uploaded a new change for review.

Change subject: vdsm: support VIR_MIGRATE_ABORT_ON_ERROR
......................................................................

vdsm: support VIR_MIGRATE_ABORT_ON_ERROR

Abort VM migration on EIO by default. The flag is supported
since libvirt 1.0.1 upstream, so use getattr() to keep code
compatible with older libvirt versions. In the latter case
migration EIO abort will not work.

Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=961154
Signed-off-by: Peter V. Saveliev <[email protected]>
Change-Id: Ic7f715c51f28ef2cd01fb95d42553ca10c79ea80
---
M lib/vdsm/config.py.in
M vdsm/vm.py
2 files changed, 16 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/22/17422/1

diff --git a/lib/vdsm/config.py.in b/lib/vdsm/config.py.in
index bdbd91a..2cb1b48 100644
--- a/lib/vdsm/config.py.in
+++ b/lib/vdsm/config.py.in
@@ -83,6 +83,10 @@
         ('migration_downtime_steps', '10',
             'Incremental steps used to reach migration_downtime.'),
 
+        ('migration_abort_on_eio', 'true',
+            'Abort VM migration on I/O error and refuse to migrate '
+            'VMs, paused because of EIO.'),
+
         ('max_outgoing_migrations', '3',
             'Maximum concurrent outgoing migrations'),
 
diff --git a/vdsm/vm.py b/vdsm/vm.py
index 4333170..8a60159 100644
--- a/vdsm/vm.py
+++ b/vdsm/vm.py
@@ -379,12 +379,23 @@
                 # side
                 self._preparingMigrationEvt = False
                 if not self._migrationCanceledEvt:
+                    # Note on VIR_MIGRATE_ABORT_ON_ERROR:
+                    #
+                    # The flag is added in libvirt-1.1.0, is available
+                    # since libvirt-0.10.2-20.el6 in RHEL 6.5, but will not
+                    # be backported to RHEL 6.4 ever.
+                    # So the solution could be a dependency in the spec-file,
+                    # but this getattr() trick just let us not to do unneeded
+                    # fork.
                     self._vm._dom.migrateToURI2(
                         duri, muri, None,
                         libvirt.VIR_MIGRATE_LIVE |
                         libvirt.VIR_MIGRATE_PEER2PEER |
                         (libvirt.VIR_MIGRATE_TUNNELLED if
-                            self._tunneled else 0),
+                            self._tunneled else 0) |
+                        (getattr(libvirt, 'VIR_MIGRATE_ABORT_ON_ERROR', 0) if
+                            config.get('vars',
+                                       'migration_abort_on_eio') else 0),
                         None, maxBandwidth)
             finally:
                 t.cancel()


-- 
To view, visit http://gerrit.ovirt.org/17422
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic7f715c51f28ef2cd01fb95d42553ca10c79ea80
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Peter V. Saveliev <[email protected]>
_______________________________________________
vdsm-patches mailing list
[email protected]
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches

Reply via email to