yeahuh / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone
ddf19c
From 0ba8d4ea1cc34230356cc446dfa8d1cb52cbd2f3 Mon Sep 17 00:00:00 2001
ddf19c
From: Thomas Huth <thuth@redhat.com>
ddf19c
Date: Fri, 29 May 2020 05:54:05 -0400
ddf19c
Subject: [PATCH 23/42] s390x: protvirt: Add migration blocker
ddf19c
ddf19c
RH-Author: Thomas Huth <thuth@redhat.com>
ddf19c
Message-id: <20200529055420.16855-24-thuth@redhat.com>
ddf19c
Patchwork-id: 97043
ddf19c
O-Subject: [RHEL-8.3.0 qemu-kvm PATCH v2 23/38] s390x: protvirt: Add migration blocker
ddf19c
Bugzilla: 1828317
ddf19c
RH-Acked-by: Claudio Imbrenda <cimbrend@redhat.com>
ddf19c
RH-Acked-by: Cornelia Huck <cohuck@redhat.com>
ddf19c
RH-Acked-by: David Hildenbrand <david@redhat.com>
ddf19c
ddf19c
From: Janosch Frank <frankja@linux.ibm.com>
ddf19c
ddf19c
Migration is not yet supported.
ddf19c
ddf19c
Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
ddf19c
Reviewed-by: David Hildenbrand <david@redhat.com>
ddf19c
Reviewed-by: Christian Borntraeger <borntraeger@de.ibm.com>
ddf19c
Reviewed-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
ddf19c
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
ddf19c
Message-Id: <20200319131921.2367-5-frankja@linux.ibm.com>
ddf19c
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
ddf19c
(cherry picked from commit 0141e1b47707d90f5bd9d252da064ebdaca698a6)
ddf19c
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
ddf19c
---
ddf19c
 hw/s390x/s390-virtio-ccw.c | 18 ++++++++++++++++++
ddf19c
 1 file changed, 18 insertions(+)
ddf19c
ddf19c
diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c
ddf19c
index 82da1d9ab5..dbd5125232 100644
ddf19c
--- a/hw/s390x/s390-virtio-ccw.c
ddf19c
+++ b/hw/s390x/s390-virtio-ccw.c
ddf19c
@@ -44,6 +44,9 @@
ddf19c
 #include "sysemu/sysemu.h"
ddf19c
 #include "hw/s390x/pv.h"
ddf19c
 #include <linux/kvm.h>
ddf19c
+#include "migration/blocker.h"
ddf19c
+
ddf19c
+static Error *pv_mig_blocker;
ddf19c
 
ddf19c
 S390CPU *s390_cpu_addr2state(uint16_t cpu_addr)
ddf19c
 {
ddf19c
@@ -325,15 +328,30 @@ static void s390_machine_unprotect(S390CcwMachineState *ms)
ddf19c
 {
ddf19c
     s390_pv_vm_disable();
ddf19c
     ms->pv = false;
ddf19c
+    migrate_del_blocker(pv_mig_blocker);
ddf19c
+    error_free_or_abort(&pv_mig_blocker);
ddf19c
 }
ddf19c
 
ddf19c
 static int s390_machine_protect(S390CcwMachineState *ms)
ddf19c
 {
ddf19c
+    Error *local_err = NULL;
ddf19c
     int rc;
ddf19c
 
ddf19c
+    error_setg(&pv_mig_blocker,
ddf19c
+               "protected VMs are currently not migrateable.");
ddf19c
+    rc = migrate_add_blocker(pv_mig_blocker, &local_err);
ddf19c
+    if (rc) {
ddf19c
+        error_report_err(local_err);
ddf19c
+        error_free_or_abort(&pv_mig_blocker);
ddf19c
+        return rc;
ddf19c
+    }
ddf19c
+
ddf19c
     /* Create SE VM */
ddf19c
     rc = s390_pv_vm_enable();
ddf19c
     if (rc) {
ddf19c
+        error_report_err(local_err);
ddf19c
+        migrate_del_blocker(pv_mig_blocker);
ddf19c
+        error_free_or_abort(&pv_mig_blocker);
ddf19c
         return rc;
ddf19c
     }
ddf19c
 
ddf19c
-- 
ddf19c
2.27.0
ddf19c