[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] [PATCH 2/2] qemu: Forbid migration of machines with I/O errors



On 06/11/13 14:05, Michal Privoznik wrote:
On 11.06.2013 11:49, Peter Krempa wrote:
Such machine can't be successuflly migrated unles the I/O error has
recovered and might lead to data corruption. Forbid this kind of
migration.
---
  src/qemu/qemu_migration.c | 10 ++++++++++
  1 file changed, 10 insertions(+)

diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index 8e57521..97daaa0 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -1423,6 +1423,7 @@ qemuMigrationIsAllowed(virQEMUDriverPtr driver, virDomainObjPtr vm,
                         virDomainDefPtr def, bool remote)
  {
      int nsnapshots;
+    int pauseReason;
      bool forbid;
      int i;

@@ -1445,6 +1446,15 @@ qemuMigrationIsAllowed(virQEMUDriverPtr driver, virDomainObjPtr vm,
                                 nsnapshots);
                  return false;
              }
+
+            /* cancel migration if disk I/O error is emitted while migrating */
+            if (virDomainObjGetState(vm, &pauseReason) == VIR_DOMAIN_PAUSED &&
+                pauseReason == VIR_DOMAIN_PAUSED_IOERROR) {
+                virReportError(VIR_ERR_OPERATION_INVALID, "%s",
+                               _("cannot migrate domain with I/O error"));
+                return false;
+            }
+
          }

          if (virDomainHasDiskMirror(vm)) {


Do we want to document this behaviour change?

How about:

diff --git a/src/libvirt.c b/src/libvirt.c
index 620dbdd..6413a1e 100644
--- a/src/libvirt.c
+++ b/src/libvirt.c
@@ -5809,41 +5809,42 @@ error:
  * guest ABI,
  *
  * If a hypervisor supports renaming domains during migration,
  * the dname parameter specifies the new name for the domain.
  * Setting dname to NULL keeps the domain name the same.  If domain
  * renaming is not supported by the hypervisor, dname must be NULL or
  * else an error will be returned.
  *
  * The maximum bandwidth (in MiB/s) that will be used to do migration
  * can be specified with the bandwidth parameter.  If set to 0,
  * libvirt will choose a suitable default.  Some hypervisors do
  * not support this feature and will return an error if bandwidth
  * is not 0.
  *
  * To see which features are supported by the current hypervisor,
  * see virConnectGetCapabilities, /capabilities/host/migration_features.
  *
  * There are many limitations on migration imposed by the underlying
  * technology - for example it may not be possible to migrate between
  * different processors even with the same architecture, or between
- * different types of hypervisor.
+ * different types of hypervisor. Migration of domains that encountered
+ * errors may not be possible.
  *
  * Returns 0 if the migration succeeded, -1 upon error.
  */
 int
 virDomainMigrateToURI2(virDomainPtr domain,
                        const char *dconnuri,
                        const char *miguri,
                        const char *dxml,
                        unsigned long flags,
                        const char *dname,
                        unsigned long bandwidth)
 {
     VIR_DOMAIN_DEBUG(domain, "dconnuri=%s, miguri=%s, dxml=%s, "
                      "flags=%lx, dname=%s, bandwidth=%lu",
                      NULLSTR(dconnuri), NULLSTR(miguri), NULLSTR(dxml),
                      flags, NULLSTR(dname), bandwidth);

     virResetLastError();

     /* First checkout the source */





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]