WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [PATCH] pygrub: --not-really option for debugging

To: <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: [Xen-devel] [PATCH] pygrub: --not-really option for debugging
From: Tim Deegan <Tim.Deegan@xxxxxxxxxx>
Date: Fri, 2 Jul 2010 14:23:38 +0100
Delivery-date: Fri, 02 Jul 2010 06:24:52 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mutt/1.5.18 (2008-05-17)
Add a --not-really option to pygrub that lets us see what files it would
have extracted instead of actually extracting them.

Signed-off-by: Tim Deegan <Tim.Deegan@xxxxxxxxxx>


diff -r e021832644f4 tools/pygrub/src/pygrub
--- a/tools/pygrub/src/pygrub   Fri Jul 02 14:07:18 2010 +0100
+++ b/tools/pygrub/src/pygrub   Fri Jul 02 14:21:59 2010 +0100
@@ -631,13 +631,13 @@
     sel = None
     
     def usage():
-        print >> sys.stderr, "Usage: %s [-q|--quiet] [-i|--interactive] 
[--output=] [--kernel=] [--ramdisk=] [--args=] [--entry=] <image>" 
%(sys.argv[0],)
+        print >> sys.stderr, "Usage: %s [-q|--quiet] [-i|--interactive] 
[-n|--not-really] [--output=] [--kernel=] [--ramdisk=] [--args=] [--entry=] 
<image>" %(sys.argv[0],)
 
     try:
-        opts, args = getopt.gnu_getopt(sys.argv[1:], 'qih::',
-                                   ["quiet", "interactive", "help", "output=",
-                                    "entry=", "kernel=", "ramdisk=", "args=",
-                                    "isconfig"])
+        opts, args = getopt.gnu_getopt(sys.argv[1:], 'qinh::',
+                                   ["quiet", "interactive", "not-really", 
+                                    "help", "output=", "entry=", "kernel=", 
+                                    "ramdisk=", "args=", "isconfig"])
     except getopt.GetoptError:
         usage()
         sys.exit(1)
@@ -651,6 +651,7 @@
     entry = None
     interactive = True
     isconfig = False
+    not_really = False
 
     # what was passed in
     incfg = { "kernel": None, "ramdisk": None, "args": "" }
@@ -664,6 +665,8 @@
             interactive = False
         elif o in ("-i", "--interactive"):
             interactive = True
+        elif o in ("-n", "--not-really"):
+            not_really = True
         elif o in ("-h", "--help"):
             usage()
             sys.exit()
@@ -712,18 +715,24 @@
     if not chosencfg["kernel"]:
         chosencfg = run_grub(file, entry, fs, incfg["args"])
 
-    data = fs.open_file(chosencfg["kernel"]).read()
-    (tfd, bootcfg["kernel"]) = tempfile.mkstemp(prefix="boot_kernel.",
-        dir="/var/run/xend/boot")
-    os.write(tfd, data)
-    os.close(tfd)
+    if not_really:
+        bootcfg["kernel"] = "<kernel:%s>" % chosencfg["kernel"]
+    else:
+        data = fs.open_file(chosencfg["kernel"]).read()
+        (tfd, bootcfg["kernel"]) = tempfile.mkstemp(prefix="boot_kernel.",
+                                                    dir="/var/run/xend/boot")
+        os.write(tfd, data)
+        os.close(tfd)
 
     if chosencfg["ramdisk"]:
-        data = fs.open_file(chosencfg["ramdisk"],).read()
-        (tfd, bootcfg["ramdisk"]) = tempfile.mkstemp(prefix="boot_ramdisk.",
-            dir="/var/run/xend/boot")
-        os.write(tfd, data)
-        os.close(tfd)
+        if not_really:
+            bootcfg["ramdisk"] = "<ramdisk:%s>" % chosencfg["ramdisk"]
+        else:
+            data = fs.open_file(chosencfg["ramdisk"],).read()
+            (tfd, bootcfg["ramdisk"]) = tempfile.mkstemp(
+                prefix="boot_ramdisk.", dir="/var/run/xend/boot")
+            os.write(tfd, data)
+            os.close(tfd)
     else:
         initrd = None
 

Attachment: pygrub-notreally
Description: Text document

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-devel] [PATCH] pygrub: --not-really option for debugging, Tim Deegan <=