Commits

Kaspar Schiess committed 27c1a62

Adds 'boot' directive to specify boot order

  • Participants
  • Parent commits 7caa87d

Comments (0)

Files changed (6)

 
+= 0.5
+
+  + 'boot' configuration option for specifying the boot order of the virtual
+    machine. 
+
 = 0.4
   
   ! Fixes missing requires for fileutils

File doc/qemu-toolkit-configuration.7.ronn

 
 Here's a list of configuration options within the virtual_machine declaration:
 
+  * boot <OPTIONS>: 
+    Configures the boot order of the virtual machine. Use the 'order' option 
+    to configure boot order; use the 'once' option to configure the first
+    boot of the machine. For more options, please see the QEMU documentation 
+    on '-boot'.
+
+        # Boot off the CDROM device, alyways
+        boot order: 'd'
+
+        # Boot off the CDROM the next time, otherwise from harddisk first
+        boot order: 'c', once: 'dc'
+
   * cpus <NUMBER>: 
     Configures the number of SMP cpus simulated to the guest system. 
     You should not configure more SMP cpus than you have physical CPU cores

File lib/qemu-toolkit/vm.rb

     attr_accessor :keyboard_layout
     # Other devices
     attr_reader :devices
+    # Boot order (if set)
+    attr_accessor :boot
     
     def initialize(backend)
       @disks = []
         cmd << "-device #{driver}," + 
           parameter_list(parameters)
       end
+
+      # Boot order
+      if boot
+        cmd << "-boot " + parameter_list(boot)
+      end
       
       # networking: nic
       vlan = 0

File spec/fixture/etc/all.rb

 virtual_machine "all" do
+  # Boot from disk, then from cdrom
+  boot order: 'cd'
+
   # Using a local device as disk:
   disk '/dev/null'
   

File spec/fixture/etc/bootorder.rb

+virtual_machine "bootorder" do
+  # Using a local device as disk:
+  disk '/dev/null'
+
+  # Boot from disk, then from cdrom
+  boot order: 'cd', once: 'dc', menu: 'on'
+end

File spec/lib/qemu-toolkit/vm_spec.rb

       vm.command.should include('-bar')
     end 
   end
+  describe "boot order" do
+    let(:vm) { QemuToolkit::VM['bootorder', backend] }
+
+    it "should issue a -boot directive" do
+      vm.command.should include('-boot order=cd,once=dc,menu=on')
+    end
+  end
 
   describe '#target(host, port)' do
     it "returns an ISCSITarget instance" do