susi-qemu 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4bc88655a9b5207f858886dacd6c466036b42747a3d382d2ea76b2feb0803d82
4
- data.tar.gz: 98c59659a0aca9366eab87caef03a5cabcf756b9492905da41bcb6e288b6aec7
3
+ metadata.gz: d0fad5758256c0e74da6f5b06cc494653f4dace51cdaf0c358b658d7255f539c
4
+ data.tar.gz: 743619250706519bc7d4bd5d93953a8c2a08d1acaf9923d0100fc65c26e3630a
5
5
  SHA512:
6
- metadata.gz: 3d9101294ba6ac775992dc889c4fe3b39591ddcb78d13665ab7368fcc3f9c7a8abd0a4b9753cae44feb76b204535cdd4df067f42289638835da032935c73e686
7
- data.tar.gz: 65716f78fe4b5b4fa5a55aeaef70c7b2e462800d6c0f204c59e866e5ccf15224a42e0af96299e9392ade4d35e223625e05b6abe5e5678a608fd2b012c92a1450
6
+ metadata.gz: 23502b5662ca90b84c15e42456689f80cb9b216b8f1e6d507fd99c19957ba47296ab38d3e910d399559ecb5f3f2a9b9e5b34f8e8d864d4560b4f4ccb8f0422fb
7
+ data.tar.gz: 719ca17aade8cc9bc3603041907aee96021030bea45401179b76f9e3f640041cd4bdba101b65fd98acf57a8ee67ffc4dd5b9723fbf1065beb8b2c78830cefacc
data/lib/output.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module Susi
2
- DEBUG = false
2
+ DEBUG = true
3
3
 
4
4
  def self.debug(msg)
5
5
  puts msg if DEBUG
data/lib/susi.rb CHANGED
@@ -50,6 +50,7 @@ YAML
50
50
  config = YAML.load_file(CONFIG_FILE)
51
51
  id = config['id']
52
52
  name = config['name'] || Dir.pwd.split('/').last
53
+ usb = config['usb']
53
54
  disk_template = "#{TEMPLATE_DIR}/#{config['template']}"
54
55
 
55
56
  # check if vm is already running
@@ -63,12 +64,12 @@ YAML
63
64
  Susi::debug "Disk not found, cloning..."
64
65
  Disk.clone(disk_template, disk_name)
65
66
 
66
- VM.start(name, disk_name)
67
+ VM.start(name, disk_name, usb: usb)
67
68
 
68
69
  # SSH into VM and set hostname
69
70
  SSH.set_hostname(name)
70
71
  else
71
- VM.start(name, disk_name)
72
+ VM.start(name, disk_name, usb: usb)
72
73
  end
73
74
  end
74
75
 
data/lib/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Susi
2
- VERSION = '0.0.6'
2
+ VERSION = '0.0.7'
3
3
  end
data/lib/vm.rb CHANGED
@@ -122,7 +122,7 @@ module Susi
122
122
  raise "No free port found in range #{start_port}..#{end_port}"
123
123
  end
124
124
 
125
- def self.start(name, disk, cdrom: nil)
125
+ def self.start(name, disk, cdrom: nil, usb: nil)
126
126
  qmp_port = self.get_free_port(4000, 4099)
127
127
  ssh_port = self.get_free_port(2000, 2099)
128
128
  vnc_port = self.get_free_port(5900, 5999)
@@ -154,6 +154,14 @@ module Susi
154
154
  cmd << "-cdrom #{cdrom}"
155
155
  end
156
156
 
157
+ if usb
158
+ cmd << "-device qemu-xhci"
159
+ usb.each do |usbstr|
160
+ vendor, product = usbstr.split(':')
161
+ cmd << "-device usb-host,vendorid=0x#{vendor},productid=0x#{product}"
162
+ end
163
+ end
164
+
157
165
  cmd = cmd.join(" ")
158
166
  Susi::debug cmd
159
167
  system(cmd)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: susi-qemu
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Bovensiepen