Kaspar Schiess avatar Kaspar Schiess committed fe0d4b7

'nic' option now optimises the virtio driver for throughput.

Comments (0)

Files changed (11)

 
   + 'boot' configuration option for specifying the boot order of the virtual
     machine. 
+  + 'nic' option now optimises the virtio driver for throughput. 
 
 = 0.4
   
 .\" generated with Ronn/v0.7.3
 .\" http://github.com/rtomayko/ronn/tree/0.7.3
 .
-.TH "QEMU\-TOOLKIT" "7" "December 2012" "" "qemu-toolkit"
+.TH "QEMU\-TOOLKIT" "7" "April 2013" "" "qemu-toolkit"
 .
 .SH "NAME"
 \fBqemu\-toolkit\fR \- A toolkit for running qemu on Illumos / OmniOS

doc/qemu-toolkit-configuration.7

 .\" generated with Ronn/v0.7.3
 .\" http://github.com/rtomayko/ronn/tree/0.7.3
 .
-.TH "QEMU\-TOOLKIT\-CONFIGURATION" "7" "December 2012" "" "qemu-toolkit"
+.TH "QEMU\-TOOLKIT\-CONFIGURATION" "7" "April 2013" "" "qemu-toolkit"
 .
 .SH "NAME"
 \fBqemu\-toolkit\-configuration\fR \- configuration for qemu\-toolkit
 Here\'s a list of configuration options within the virtual_machine declaration:
 .
 .TP
+boot \fIOPTIONS\fR
+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\'\.
+.
+.IP "" 4
+.
+.nf
+
+# 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\'
+.
+.fi
+.
+.IP "" 0
+
+.
+.TP
 cpus \fINUMBER\fR
 Configures the number of SMP cpus simulated to the guest system\. You should not configure more SMP cpus than you have physical CPU cores available\.
 .
 The \fBvia:\fR option takes either physical links or etherstub switches as value\. You can also specify a VLAN tag, separated by a colon\. (ie: e1000g0:4)
 .
 .IP
-nic \fBmodel:\fR will default to \fBvirtio\fR\.
+nic \fBmodel:\fR will default to \fBvirtio\fR\. The \fBvirtio\fR driver will be configured for maximum throughput by setting driver options directly as smartos does\. This optimisation may change over time, but will always try to optimise throughput and availability\.
 .
 .IP
 NOTE: QEMU/kvm on Illumos will default to providing a single pseudo\-nic that has a DHCP server attached to it by default\. If you do not specify a \fBnic\fR, this is what you\'ll get\.

doc/qemu-toolkit-configuration.7.ronn

     value. 
     You can also specify a VLAN tag, separated by a colon. (ie: e1000g0:4)
     
-    nic `model:` will default to `virtio`.
+    nic `model:` will default to `virtio`. The `virtio` driver will be 
+    configured for maximum throughput by setting driver options directly 
+    as smartos does. This optimisation may change over time, but will always
+    try to optimise throughput and availability. 
     
     NOTE: QEMU/kvm on Illumos will default to providing a single pseudo-nic
     that has a DHCP server attached to it by default. If you do not specify

doc/qemu-toolkit-install.7

 .\" generated with Ronn/v0.7.3
 .\" http://github.com/rtomayko/ronn/tree/0.7.3
 .
-.TH "QEMU\-TOOLKIT\-INSTALL" "7" "November 2012" "" "qemu-toolkit"
+.TH "QEMU\-TOOLKIT\-INSTALL" "7" "March 2013" "" "qemu-toolkit"
 .
 .SH "NAME"
 \fBqemu\-toolkit\-install\fR \- installations instructions for the qemu\-toolkit

doc/qemu-toolkit-overview.7

 .\" generated with Ronn/v0.7.3
 .\" http://github.com/rtomayko/ronn/tree/0.7.3
 .
-.TH "QEMU\-TOOLKIT\-OVERVIEW" "7" "November 2012" "" "qemu-toolkit"
+.TH "QEMU\-TOOLKIT\-OVERVIEW" "7" "March 2013" "" "qemu-toolkit"
 .
 .SH "NAME"
 \fBqemu\-toolkit\-overview\fR \- architecture and philosophy of qemu\-toolkit
 .\" generated with Ronn/v0.7.3
 .\" http://github.com/rtomayko/ronn/tree/0.7.3
 .
-.TH "STORADM" "1" "November 2012" "" "qemu-toolkit"
+.TH "STORADM" "1" "March 2013" "" "qemu-toolkit"
 .
 .SH "NAME"
 \fBstoradm\fR \- manages virtual machine storage
 .\" generated with Ronn/v0.7.3
 .\" http://github.com/rtomayko/ronn/tree/0.7.3
 .
-.TH "VMADM" "1" "November 2012" "" "qemu-toolkit"
+.TH "VMADM" "1" "March 2013" "" "qemu-toolkit"
 .
 .SH "NAME"
 \fBvmadm\fR \- manages qemu\-toolkit virtual machines

lib/qemu-toolkit/vm.rb

       if boot
         cmd << "-boot " + parameter_list(boot)
       end
+
+      cmd += network_options      
+      
+      # Extra arguments
+      cmd += @extra_args
       
+      return cmd
+    end
+    def network_options
+      cmd = []
+
       # networking: nic
       vlan = 0
       # Look up all existing vnics for this virtual machine
         # Get a vnic that travels via the given interface.
         vnic = vnics_for_interface.shift ||
           Vnic.create(name, parameters[:via], @backend)
-        
+
         cmd << "-net vnic,"+
           parameter_list(
             vlan: vlan, name: nic_name, 
             ifname: vnic.vnic_name, 
             macaddr: parameters[:macaddr])
-        cmd << "-net nic,"+
-          parameter_list(
-            vlan: vlan, name: nic_name, 
-            model: parameters[:model] || 'virtio', 
-            macaddr: parameters[:macaddr])
+
+        model = parameters[:model] || 'virtio'
+        if model == 'virtio'
+          cmd << '-device virtio-net-pci,'+
+            parameter_list(
+              mac: parameters[:macaddr], 
+              tx: 'timer', x_txtimer: 200000, x_txburst: 128, 
+              vlan: vlan) 
+        else
+          cmd << "-net nic,"+
+            parameter_list(
+              vlan: vlan, name: nic_name, 
+              model: model,
+              macaddr: parameters[:macaddr])
+        end
 
         vlan += 1
       end
         cmd << "-net #{type},"+
           parameter_list(parameters)
       end
-      
-      # Extra arguments
-      cmd += @extra_args
-      
-      return cmd
+
+      cmd
     end
     def disk_options
       cmd = []

spec/fixture/etc/nic.rb

     macaddr: '2:8:20:52:a6:7e', 
     model: 'virtio', 
     via: 'igb1'
-    
+
   # This is what happens below the covers.
   net :vnic, vlan: 1, name: 'vm1', ifname: 'vm1', macaddr: '1:8:20:52:a6:7e'
   net :nic, vlan: 1, name: "vm1", model: "virtio", macaddr: '1:8:20:52:a6:7e'

spec/lib/qemu-toolkit/vm_spec.rb

         it { should include("-net nic,vlan=1,name=vm1,model=virtio,macaddr=1:8:20:52:a6:7e") }
       end
       describe 'automatic vnic configuration' do
-        it { should include("-net vnic,vlan=0,name=eth0,ifname=nic_1,macaddr=2:8:20:52:a6:7e") }
-        it { should include("-net nic,vlan=0,name=eth0,model=virtio,macaddr=2:8:20:52:a6:7e") }
+        it { should include(
+          "-device virtio-net-pci,mac=2:8:20:52:a6:7e,tx=timer,x-txtimer=200000,x-txburst=128,vlan=0")}
+        it { should include(
+          "-net vnic,vlan=0,name=eth0,ifname=nic_1,macaddr=2:8:20:52:a6:7e") }
       end
     end
   end
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.