Commits

Kaspar Schiess  committed 41dd0f2

Only transliterates certain keys

  • Participants
  • Parent commits 0d6d21a

Comments (0)

Files changed (3)

File lib/qemu-toolkit/vm.rb

     # Formats a parameter list as key=value,key=value
     #
     def parameter_list(parameters)
+      key_translator = Hash.new { |h,k| k }
+      key_translator.update(
+        x_txtimer: 'x-txtimer', 
+        x_txburst: 'x-txburst')
+      
       parameters.
-        map { |k,v| "#{k.to_s.tr('_', '-')}=#{v}" }.
+        map { |k,v| "#{key_translator[k]}=#{v}" }.
         join(',')
     end
     

File spec/fixture/etc/device.rb

 virtual_machine "device" do
   disk '/dev/null'
 
-  device 'driver', a: 'test', b: 'test', c_d: 'test'
+  device 'driver', a: 'test', b: 'test', c_d: 'test', x_txtimer: 'foo', x_txburst: 'bar'
 end

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

     let(:command) { device.command }
     
     it "includes a device parameter" do
-      command.should include('-device driver,a=test,b=test,c-d=test')
+      command.should include('-device driver,a=test,b=test,c_d=test,x-txtimer=foo,x-txburst=bar')
     end     
   end
   describe 'extra arguments' do