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

[PATCH] Prevent XenVbd from starting if emulated disk present



If any emulated disks are present (i.e. have not been unplugged), then
XenVbd will fail to start. This failure to start should indicate that a
reboot is required to complete the installation, and trigger the
DeviceInstall service to require a reboot.
Only the first 3 disks are checked, with the assumption that the 4th IDE
disk is an emulated DVD-ROM.

Signed-off-by: Owen Smith <owen.smith@xxxxxxxxxx>
---
 src/xenvbd/adapter.c | 22 +++++++++++++++++-----
 1 file changed, 17 insertions(+), 5 deletions(-)

diff --git a/src/xenvbd/adapter.c b/src/xenvbd/adapter.c
index 5e20944..15c4f5a 100644
--- a/src/xenvbd/adapter.c
+++ b/src/xenvbd/adapter.c
@@ -947,6 +947,14 @@ AdapterD3ToD0(
     if (!NT_SUCCESS(status))
         goto fail4;
 
+    for (TargetId = 0; TargetId < 3; ++TargetId) {
+        // Check the IDE (1st 4 targets) or NVME (1st target) devices are not 
emulated
+        // skip TargetId 3 as its used for the emulated DVD-ROM
+        status = STATUS_UNSUCCESSFUL;
+        if (AdapterIsTargetEmulated(Adapter, TargetId))
+            goto fail5;
+    }
+
     for (TargetId = 0; TargetId < XENVBD_MAX_TARGETS; ++TargetId) {
         PXENVBD_TARGET Target = AdapterGetTarget(Adapter, TargetId);
         if (Target == NULL)
@@ -955,7 +963,7 @@ AdapterD3ToD0(
         status = TargetD3ToD0(Target);
 
         if (!NT_SUCCESS(status))
-            goto fail5;
+            goto fail6;
     }
 
     status = XENBUS_SUSPEND(Register,
@@ -965,14 +973,14 @@ AdapterD3ToD0(
                             Adapter,
                             &Adapter->SuspendCallback);
     if (!NT_SUCCESS(status))
-        goto fail6;
+        goto fail7;
 
     return STATUS_SUCCESS;
 
+fail7:
+    Error("fail7\n");
 fail6:
     Error("fail6\n");
-fail5:
-    Error("fail5\n");
 
     for (TargetId = 0; TargetId < XENVBD_MAX_TARGETS; ++TargetId) {
         PXENVBD_TARGET Target = AdapterGetTarget(Adapter, TargetId);
@@ -981,6 +989,9 @@ fail5:
         TargetD0ToD3(Target);
     }
 
+fail5:
+    Error("fail5\n");
+
     __AdapterD0ToD3(Adapter);
 
 fail4:
@@ -2178,7 +2189,8 @@ AdapterHwPassiveInitialize(
 fail3:
     Error("fail2\n");
 
-    AdapterUnplugRequest(Adapter, FALSE);
+    if (status != STATUS_UNSUCCESSFUL)
+        AdapterUnplugRequest(Adapter, FALSE);
     AdapterTeardown(Adapter);
 
 fail2:
-- 
2.16.2.windows.1




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.