fog-libvirt 0.6.0 → 0.7.0

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
- SHA1:
3
- metadata.gz: 4d3e03b125cb0f12ce53c57d60771ca49907477e
4
- data.tar.gz: 7ace802207daa028a1bfbc94a0c182ffe7f51e2d
2
+ SHA256:
3
+ metadata.gz: 41b14c1f0524040fcbc157e504813ffe2514dbd3430c88909da1d531ec36c140
4
+ data.tar.gz: c0fedd19c37d2e5a864336ac9a51f1c4de026f1c6f6120e186153afcbfc5792a
5
5
  SHA512:
6
- metadata.gz: 983092becd604cceed9072b7a26ae8970a1f078bd5e0af97ebdf7f09ea11c3ac01cc7af6ce68be46303c8a11be1b101fa01501d4f31af16ac11ec61030b9fc4c
7
- data.tar.gz: 59c5488a0938ac843c8a6405e868b11cba9e027e32782de9d12be7bd7b6ec7964d3e42dc068be636f58a1d12eed53dd7ab925d9b788aa75b93f0b48b1fd073ad
6
+ metadata.gz: 584d715816d4ccea8933a43182288aa76f0c49d39f5358892c0e72e3c55c8649fe70092bf4e7046202e95e6e15e8a7de6ebcc07042b55fb1635c6168841adf29
7
+ data.tar.gz: 61804dd8912bfdee1299275fe0961c0f36e3328233b65db9a23e9f21dd9843134c071c70562c7abec6643ba35b817201b25a9eea4787abaef0639e551ffd6fa9
@@ -26,6 +26,19 @@ Only ssh is supported as the transport for remote URI's. TLS is NOT supported, a
26
26
  - To check the connection you need to override your libvirt socket location in the URI
27
27
  - "qemu+ssh://patrick@myserver/system?socket=/var/run/libvirt/libvirt-sock"
28
28
 
29
+ ## Ceph RBD volumes
30
+ To configure Ceph RBD volumes, the file ``/etc/foreman/ceph.conf`` is used.
31
+ After adding the authentication key to a libvirt secret, it can be configured as follows:
32
+ ```
33
+ monitor=mon001.example.com,mon002.example.com,mon003.example.com
34
+ port=6789
35
+ libvirt_ceph_pool=rbd_pool_name
36
+ auth_username=libvirt
37
+ auth_uuid=uuid_of_libvirt_secret
38
+ ```
39
+ For more recent versions of libvirt which support using the secret by name (`usage` attribute in the `secret` tag),
40
+ you can also drop `auth_uuid` and specify `auth_usage` instead. If both are specified, `auth_uuid` will be preferred for maximum compatibility.
41
+
29
42
  ## Configuration
30
43
 
31
44
  The URI can be configured in two ways:
@@ -28,6 +28,8 @@ module Fog
28
28
  attribute :boot_order
29
29
  attribute :display
30
30
  attribute :cpu
31
+ attribute :hugepages
32
+ attribute :guest_agent
31
33
 
32
34
  attribute :state
33
35
 
@@ -477,7 +479,9 @@ module Fog
477
479
  :network_bridge_name => "br0",
478
480
  :boot_order => %w[hd cdrom network],
479
481
  :display => default_display,
480
- :cpu => {}
482
+ :cpu => {},
483
+ :hugepages => false,
484
+ :guest_agent => true,
481
485
  }
482
486
  end
483
487
 
@@ -1,6 +1,11 @@
1
1
  <domain type='<%= domain_type %>'>
2
2
  <name><%= name %></name>
3
3
  <memory><%= memory_size %></memory>
4
+ <% if hugepages -%>
5
+ <memoryBacking>
6
+ <hugepages/>
7
+ </memoryBacking>
8
+ <% end -%>
4
9
  <vcpu><%= cpus %></vcpu>
5
10
  <os>
6
11
  <type arch='<%= arch %>'><%= os_type %></type>
@@ -32,13 +37,42 @@
32
37
  <% end -%>
33
38
  <clock offset='utc'/>
34
39
  <devices>
40
+ <% args = {}
41
+ if File.file?('/etc/foreman/ceph.conf')
42
+ File.readlines('/etc/foreman/ceph.conf').each do |line|
43
+ pair = line.strip.split("=")
44
+ key = pair[0]
45
+ value = pair[1]
46
+ args[key] = value
47
+ end
48
+ end
49
+ %>
35
50
  <% volumes.each do |vol| -%>
51
+ <% if File.file?('/etc/foreman/ceph.conf') && vol.pool_name.include?(args["libvirt_ceph_pool"]) %>
52
+ <disk type='network' device='disk'>
53
+ <driver name='qemu' type='<%= vol.format_type %>' cache='writeback' discard='unmap'/>
54
+ <source protocol='rbd' name='<%= vol.path %>'>
55
+ <% args["monitor"].split(",").each do |mon| %>
56
+ <host name='<%= mon %>' port='<%= args["port"] %>'/>
57
+ <% end %>
58
+ </source>
59
+ <auth username='<%= args["auth_username"] %>'>
60
+ <% if args.key?("auth_uuid") -%>
61
+ <secret type='ceph' uuid='<%= args["auth_uuid"] %>'/>
62
+ <% else -%>
63
+ <secret type='ceph' usage='<%= args["auth_usage"] %>'/>
64
+ <% end -%>
65
+ </auth>
66
+ <target dev='sd<%= ('a'..'z').to_a[volumes.index(vol)] %>' bus='scsi'/>
67
+ </disk>
68
+ <% else %>
36
69
  <disk type='file' device='disk'>
37
70
  <driver name='qemu' type='<%= vol.format_type %>'/>
38
71
  <source file='<%= vol.path %>'/>
39
72
  <%# we need to ensure a unique target dev -%>
40
73
  <target dev='vd<%= ('a'..'z').to_a[volumes.index(vol)] %>' bus='virtio'/>
41
74
  </disk>
75
+ <% end %>
42
76
  <% end -%>
43
77
  <% if iso_file -%>
44
78
  <disk type='file' device='cdrom'>
@@ -54,6 +88,11 @@
54
88
  <source <%= nic.type == 'bridge' ? "bridge='#{nic.bridge}'" : "network='#{nic.network}'" %> />
55
89
  <model type='<%= nic.model %>'/>
56
90
  </interface>
91
+ <% end -%>
92
+ <% if guest_agent -%>
93
+ <channel type='unix'>
94
+ <target type='virtio' name='org.qemu.guest_agent.0'/>
95
+ </channel>
57
96
  <% end -%>
58
97
  <serial type='pty'>
59
98
  <target port='0'/>
@@ -114,14 +114,12 @@ module Fog
114
114
  end
115
115
 
116
116
  def split_size_unit(text)
117
- if text.kind_of? Integer
118
- # if text is an integer, match will fail
119
- size = text
120
- unit = 'G'
121
- else
122
- matcher = text.match(/(\d+)(.+)/)
117
+ if (text.kind_of? String) && (matcher = text.match(/(\d+)(.+)/))
123
118
  size = matcher[1]
124
119
  unit = matcher[2]
120
+ else
121
+ size = text.to_i
122
+ unit = "G"
125
123
  end
126
124
  [size, unit]
127
125
  end
@@ -39,7 +39,13 @@ module Fog
39
39
  end
40
40
 
41
41
  def domain_volumes xml
42
- xml_elements(xml, "domain/devices/disk/source", "file")
42
+ vols_by_file = xml_elements(xml, "domain/devices/disk/source", "file")
43
+ vols_by_name = xml_elements(xml, "domain/devices/disk/source", "name")
44
+ vols = []
45
+ vols_by_file.zip(vols_by_name).each do |by_file,by_name|
46
+ vols.push(by_file.nil? ? by_name : by_file)
47
+ end
48
+ vols
43
49
  end
44
50
 
45
51
  def boot_order xml
@@ -1,5 +1,5 @@
1
1
  module Fog
2
2
  module Libvirt
3
- VERSION = '0.6.0'
3
+ VERSION = '0.7.0'
4
4
  end
5
5
  end
@@ -42,6 +42,7 @@ Shindo.tests('Fog::Compute[:libvirt] | server model', ['libvirt']) do
42
42
  :volumes,
43
43
  :active,
44
44
  :boot_order,
45
+ :hugepages,
45
46
  :state]
46
47
  tests("The server model should respond to") do
47
48
  attributes.each do |attribute|
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fog-libvirt
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - geemus (Wesley Beary)
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-01-31 00:00:00.000000000 Z
11
+ date: 2019-10-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fog-core
@@ -326,8 +326,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
326
326
  - !ruby/object:Gem::Version
327
327
  version: '0'
328
328
  requirements: []
329
- rubyforge_project:
330
- rubygems_version: 2.6.14.1
329
+ rubygems_version: 3.0.3
331
330
  signing_key:
332
331
  specification_version: 2
333
332
  summary: Module for the 'fog' gem to support libvirt