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

[win-pv-devel] [PATCH] Override PartMgr SanPolicy



This patch makes sure that PartMgr's SanPolicy is 1 after XENVBD
installation, which means that newly plugged VBDs will come online as most
admins will expect.

Signed-off-by: Paul Durrant <paul.durrant@xxxxxxxxxx>
---
 src/coinst/coinst.c | 64 +++++++++++++++++++++++++++++++++++++++++++++++++++--
 1 file changed, 62 insertions(+), 2 deletions(-)

diff --git a/src/coinst/coinst.c b/src/coinst/coinst.c
index 04b676a..1bdcbc6 100644
--- a/src/coinst/coinst.c
+++ b/src/coinst/coinst.c
@@ -46,6 +46,9 @@ __user_code;
 #define SERVICE_KEY(_Driver)    \
         SERVICES_KEY ## "\\" ## #_Driver
 
+#define PARAMETERS_KEY(_Driver) \
+        SERVICE_KEY(_Driver) ## "\\Parameters"
+
 #define UNPLUG_KEY \
         SERVICE_KEY(XEN) ## "\\Unplug"
 
@@ -257,7 +260,7 @@ OverrideGroupPolicyOptions(
                           0,
                           REG_DWORD,
                           (LPBYTE)&Value,
-                          (DWORD)sizeof(DWORD));
+                          (DWORD)sizeof (DWORD));
     if (Error != ERROR_SUCCESS) {
         SetLastError(Error);
         goto fail2;
@@ -268,7 +271,7 @@ OverrideGroupPolicyOptions(
                           0,
                           REG_DWORD,
                           (LPBYTE)&Value,
-                          (DWORD)sizeof(DWORD));
+                          (DWORD)sizeof (DWORD));
     if (Error != ERROR_SUCCESS) {
         SetLastError(Error);
         goto fail3;
@@ -346,6 +349,7 @@ IncreaseDiskTimeOut(
         goto done;
 
     Value = 120;
+
     Error = RegSetValueEx(Key,
                           "TimeOutValue",
                           0,
@@ -388,6 +392,61 @@ fail1:
 }
 
 static BOOLEAN
+OverrideSanPolicy(
+    VOID
+    )
+{
+    HKEY        Key;
+    DWORD       Value;
+    HRESULT     Error;
+
+    Error = RegOpenKeyEx(HKEY_LOCAL_MACHINE,
+                         PARAMETERS_KEY(PARTMGR),
+                         0,
+                         KEY_ALL_ACCESS,
+                         &Key);
+    if (Error != ERROR_SUCCESS) {
+        SetLastError(Error);
+        goto fail1;
+    }
+
+    Value = 1;
+
+    Error = RegSetValueEx(Key,
+                          "SanPolicy",
+                          0,
+                          REG_DWORD,
+                          (LPBYTE)&Value,
+                          (DWORD)sizeof (DWORD));
+    if (Error != ERROR_SUCCESS) {
+        SetLastError(Error);
+        goto fail2;
+    }
+
+    RegCloseKey(Key);
+
+    return TRUE;
+
+fail2:
+    Log("fail2");
+
+    RegCloseKey(Key);
+
+fail1:
+    Error = GetLastError();
+
+    {
+        PTCHAR  Message;
+
+        Message = __GetErrorMessage(Error);
+        Log("fail1 (%s)", Message);
+        LocalFree(Message);
+    }
+
+    return FALSE;
+}
+
+static BOOLEAN
 AllowUpdate(
     IN  PTCHAR      DriverName,
     OUT PBOOLEAN    Allow
@@ -691,6 +750,7 @@ __DifInstallPostProcess(
     Log("====>");
 
     (VOID) OverrideGroupPolicyOptions();
+    (VOID) OverrideSanPolicy();
     (VOID) IncreaseDiskTimeOut();
 
     NeedReboot = FALSE;
-- 
2.1.1


_______________________________________________
win-pv-devel mailing list
win-pv-devel@xxxxxxxxxxxxxxxxxxxx
http://lists.xenproject.org/cgi-bin/mailman/listinfo/win-pv-devel

 


Rackspace

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