All of lore.kernel.org
 help / color / mirror / Atom feed
From: Md Haris Iqbal <haris.phnx@gmail.com>
To: qemu-devel@nongnu.org
Cc: dgilbert@redhat.com
Subject: [Qemu-devel] [Qemu-devel [RFC] [WIP] v1] Keeping the Destination side alive incase of network failure (Migration recover from network failure)
Date: Wed,  1 Jun 2016 00:43:13 +0530	[thread overview]
Message-ID: <1464721993-15682-1-git-send-email-haris.phnx@gmail.com> (raw)

---
 include/migration/migration.h |  3 +++
 migration/migration.c         | 12 ++++++++++++
 migration/savevm.c            | 25 +++++++++++++++++--------
 3 files changed, 32 insertions(+), 8 deletions(-)

diff --git a/include/migration/migration.h b/include/migration/migration.h
index ac2c12c..73832ac 100644
--- a/include/migration/migration.h
+++ b/include/migration/migration.h
@@ -326,6 +326,9 @@ void flush_page_queue(MigrationState *ms);
 int ram_save_queue_pages(MigrationState *ms, const char *rbname,
                          ram_addr_t start, ram_addr_t len);
 
+// New added function for postcopy migration recovery in case of failure
+void qemu_postcopy_migration_recovery(QEMUFile **f,MigrationIncomingState* mis);
+
 PostcopyState postcopy_state_get(void);
 /* Set the state and return the old state */
 PostcopyState postcopy_state_set(PostcopyState new_state);
diff --git a/migration/migration.c b/migration/migration.c
index 991313a..4301972 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -1797,6 +1797,18 @@ void migrate_fd_connect(MigrationState *s)
     s->migration_thread_running = true;
 }
 
+void qemu_postcopy_migration_recovery(QEMUFile **f,
+                                      MigrationIncomingState* mis)
+{
+    migrate_set_state(&mis->state, MIGRATION_STATUS_ACTIVE,
+                                   MIGRATION_STATUS_POSTCOPY_RECOVERING);
+    /* Code for network recovery to be added here */
+    while(1) {
+        fprintf(stderr, "Not letting it fail\n");
+        sleep(2);
+    }
+}
+
 PostcopyState  postcopy_state_get(void)
 {
     return atomic_mb_read(&incoming_postcopy_state);
diff --git a/migration/savevm.c b/migration/savevm.c
index 16ba443..03467da 100644
--- a/migration/savevm.c
+++ b/migration/savevm.c
@@ -1832,7 +1832,8 @@ qemu_loadvm_section_part_end(QEMUFile *f, MigrationIncomingState *mis)
 static int qemu_loadvm_state_main(QEMUFile *f, MigrationIncomingState *mis)
 {
     uint8_t section_type;
-    int ret;
+    PostcopyState ps;
+    int32_t ret;
 
     while ((section_type = qemu_get_byte(f)) != QEMU_VM_EOF) {
 
@@ -1841,21 +1842,16 @@ static int qemu_loadvm_state_main(QEMUFile *f, MigrationIncomingState *mis)
         case QEMU_VM_SECTION_START:
         case QEMU_VM_SECTION_FULL:
             ret = qemu_loadvm_section_start_full(f, mis);
-            if (ret < 0) {
-                return ret;
-            }
             break;
         case QEMU_VM_SECTION_PART:
         case QEMU_VM_SECTION_END:
             ret = qemu_loadvm_section_part_end(f, mis);
-            if (ret < 0) {
-                return ret;
-            }
             break;
         case QEMU_VM_COMMAND:
             ret = loadvm_process_command(f);
             trace_qemu_loadvm_state_section_command(ret);
-            if ((ret < 0) || (ret & LOADVM_QUIT)) {
+            if (ret & LOADVM_QUIT) {
+                fprintf(stderr, "LOADVM_QUIT\n");
                 return ret;
             }
             break;
@@ -1863,6 +1859,19 @@ static int qemu_loadvm_state_main(QEMUFile *f, MigrationIncomingState *mis)
             error_report("Unknown savevm section type %d", section_type);
             return -EINVAL;
         }
+
+        if (ret < 0) {
+            fprintf(stderr,  "Failure\n");
+
+            ps = postcopy_state_get();
+            ret = qemu_file_get_error(f);
+            fprintf(stderr, "Error %s %d\n", strerror(-ret), -ret);
+
+            if(ret != -EIO && ps == POSTCOPY_INCOMING_RUNNING)
+                qemu_postcopy_migration_recovery(&f, mis);
+            else
+                return ret;
+        }
     }
 
     return 0;
-- 
2.7.4

             reply	other threads:[~2016-05-31 19:13 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-31 19:13 Md Haris Iqbal [this message]
2016-06-01 17:07 ` [Qemu-devel] [Qemu-devel [RFC] [WIP] v1] Keeping the Destination side alive incase of network failure (Migration recover from network failure) Dr. David Alan Gilbert

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1464721993-15682-1-git-send-email-haris.phnx@gmail.com \
    --to=haris.phnx@gmail.com \
    --cc=dgilbert@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.