Skip to contentSkip to conversation

Fix bootloader run with domaininfo changes

PATCH In review Jeremy Katz 2 participants 3 messages Nov 9, 2005 – Nov 12, 2005

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix bootloader run with domaininfo changes

The various changes to move to using info instead of passing the config sxpr everywhere broke the use of a boot loader for booting with. The attached fixes things up so that
a) use of a bootloader ==> kernel not specified in the config file
b) don't cleanup bootloader files until after the domain has booted
c) rerun bootloader on reboot

Jeremy

tools/python/xen/xend/XendDomainInfo.py +7 -5
diff -r abbe3df33774 tools/python/xen/xend/XendDomainInfo.py
@@ -1098,9 +1098,6 @@
                                   self.info['image'],
                                   self.info['device'])
 
-        if self.info['bootloader']:
-            self.image.handleBootloading()
-
         xc.domain_setcpuweight(self.domid, self.info['cpu_weight'])
 
         m = self.image.getDomainMemory(self.info['memory_KiB'])
@@ -1122,6 +1119,9 @@
         self.introduceDomain()
 
         self.createDevices()
+
+        if self.info['bootloader']:
+            self.image.cleanupBootloading()
 
         self.info['start_time'] = time.time()
 
@@ -1287,6 +1287,7 @@
         False if it is to be destroyed.
         """
 
+        self.configure_bootloader()
         config = self.sxpr()
 
         if self.readVm(RESTART_IN_PROGRESS):
@@ -1389,8 +1390,9 @@
         # FIXME: this assumes the disk is the first device and
         # that we're booting from the first disk
         blcfg = None
+        config = self.sxpr()
         # FIXME: this assumes that we want to use the first disk
-        dev = sxp.child_value(self.config, "device")
+        dev = sxp.child_value(config, "device")
         if dev:
             disk = sxp.child_value(dev, "uname")
             fn = blkdev_uname_to_file(disk)
@@ -1400,7 +1402,7 @@
             msg = "Had a bootloader specified, but can't find disk"
             log.error(msg)
             raise VmError(msg)
-        self.config = sxp.merge(['vm', ['image', blcfg]], self.config)
+        self.info['image'] = sxp.to_string(blcfg)
 
 
     def send_sysrq(self, key):
tools/python/xen/xend/image.py +1 -1
diff -r abbe3df33774 tools/python/xen/xend/image.py
@@ -95,7 +95,7 @@
                         ("image/ramdisk", self.ramdisk))
 
 
-    def handleBootloading(self):
+    def cleanupBootloading(self):
         self.unlink(self.kernel)
         self.unlink(self.ramdisk)
 
tools/python/xen/xm/create.py +2 -2
diff -r abbe3df33774 tools/python/xen/xm/create.py
@@ -564,7 +564,7 @@
     file = blkif.blkdev_uname_to_file(uname)
 
     return bootloader(vals.bootloader, file, not vals.console_autoconnect,
-                      vals.vcpus, vals.blentry)
+                      vals.vcpus, vals.bootentry)
 
 def make_config(vals):
     """Create the domain configuration.
@@ -780,7 +780,7 @@
         vals.extra = vnc + ' ' + vals.extra
     
 def preprocess(vals):
-    if not vals.kernel:
+    if not vals.kernel and not vals.bootloader:
         err("No kernel specified")
     preprocess_disk(vals)
     preprocess_pci(vals)

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#1 lore raw

Re: [PATCH] Fix bootloader run with domaininfo changes [RESEND]

Quoted 8 lines · Jeremy Katz

The various changes to move to using info instead of passing the config sxpr everywhere broke the use of a boot loader for booting with. The attached fixes things up so that
a) use of a bootloader ==> kernel not specified in the config file
b) don't cleanup bootloader files until after the domain has booted
c) rerun bootloader on reboot

Sending again -- I haven't hit any negative side effects with this and I've been doing lots of rebooting for testing things

Jeremy

tools/python/xen/xend/XendDomainInfo.py +7 -5
diff -r abbe3df33774 tools/python/xen/xend/XendDomainInfo.py
@@ -1098,9 +1098,6 @@
                                   self.info['image'],
                                   self.info['device'])
 
-        if self.info['bootloader']:
-            self.image.handleBootloading()
-
         xc.domain_setcpuweight(self.domid, self.info['cpu_weight'])
 
         m = self.image.getDomainMemory(self.info['memory_KiB'])
@@ -1122,6 +1119,9 @@
         self.introduceDomain()
 
         self.createDevices()
+
+        if self.info['bootloader']:
+            self.image.cleanupBootloading()
 
         self.info['start_time'] = time.time()
 
@@ -1287,6 +1287,7 @@
         False if it is to be destroyed.
         """
 
+        self.configure_bootloader()
         config = self.sxpr()
 
         if self.readVm(RESTART_IN_PROGRESS):
@@ -1389,8 +1390,9 @@
         # FIXME: this assumes the disk is the first device and
         # that we're booting from the first disk
         blcfg = None
+        config = self.sxpr()
         # FIXME: this assumes that we want to use the first disk
-        dev = sxp.child_value(self.config, "device")
+        dev = sxp.child_value(config, "device")
         if dev:
             disk = sxp.child_value(dev, "uname")
             fn = blkdev_uname_to_file(disk)
@@ -1400,7 +1402,7 @@
             msg = "Had a bootloader specified, but can't find disk"
             log.error(msg)
             raise VmError(msg)
-        self.config = sxp.merge(['vm', ['image', blcfg]], self.config)
+        self.info['image'] = sxp.to_string(blcfg)
 
 
     def send_sysrq(self, key):
tools/python/xen/xend/image.py +1 -1
diff -r abbe3df33774 tools/python/xen/xend/image.py
@@ -95,7 +95,7 @@
                         ("image/ramdisk", self.ramdisk))
 
 
-    def handleBootloading(self):
+    def cleanupBootloading(self):
         self.unlink(self.kernel)
         self.unlink(self.ramdisk)
 
tools/python/xen/xm/create.py +2 -2
diff -r abbe3df33774 tools/python/xen/xm/create.py
@@ -564,7 +564,7 @@
     file = blkif.blkdev_uname_to_file(uname)
 
     return bootloader(vals.bootloader, file, not vals.console_autoconnect,
-                      vals.vcpus, vals.blentry)
+                      vals.vcpus, vals.bootentry)
 
 def make_config(vals):
     """Create the domain configuration.
@@ -780,7 +780,7 @@
         vals.extra = vnc + ' ' + vals.extra
     
 def preprocess(vals):
-    if not vals.kernel:
+    if not vals.kernel and not vals.bootloader:
         err("No kernel specified")
     preprocess_disk(vals)
     preprocess_pci(vals)

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#2 lore raw

Re: [PATCH] Fix bootloader run with domaininfo changes [RESEND]

Quoted 8 lines · Jeremy Katz
Quoted 7 lines · Jeremy Katz

The various changes to move to using info instead of passing the config sxpr everywhere broke the use of a boot loader for booting with. The attached fixes things up so that
a) use of a bootloader ==> kernel not specified in the config file
b) don't cleanup bootloader files until after the domain has booted
c) rerun bootloader on reboot

Quoted 4 lines
Quoted 1 line

Sending again -- I haven't hit any negative side effects with this and I've been doing lots of rebooting for testing things

Thanks Jeremy, I've applied that. Sorry about the delay.

Ewan.