Skip to contentSkip to conversation

xl: do not allow shutdown and reboot dom0

PATCH New Yang Hongyang 1 participant 1 message Jun 3, 2010

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xl: do not allow shutdown and reboot dom0

do not allow shutdown and reboot dom0

tools/libxl/xl_cmdimpl.c +8 -0
diff -r 5aabc6f94df5 tools/libxl/xl_cmdimpl.c
@@ -1632,6 +1632,10 @@
 {
     int rc;
     find_domain(p);
+    if (domid == 0) {
+        fprintf(stderr, "Domain 0 cannot be shutdown.\n");
+        exit(-1);
+    }
     rc=libxl_domain_shutdown(&ctx, domid, 0);
     if (rc) { fprintf(stderr,"shutdown failed (rc=%d)\n.",rc);exit(-1); }
 }
@@ -1640,6 +1644,10 @@
 {
     int rc;
     find_domain(p);
+    if (domid == 0) {
+        fprintf(stderr, "Domain 0 cannot be rebooted.\n");
+        exit(-1);
+    }
     rc=libxl_domain_shutdown(&ctx, domid, 1);
     if (rc) { fprintf(stderr,"reboot failed (rc=%d)\n.",rc);exit(-1); }
 }
Signature · 2 lines
Regards
Yang Hongyang