fog-libvirt 0.6.0 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/lib/fog/libvirt/models/compute/README.md +13 -0
- data/lib/fog/libvirt/models/compute/server.rb +5 -1
- data/lib/fog/libvirt/models/compute/templates/server.xml.erb +39 -0
- data/lib/fog/libvirt/models/compute/volume.rb +4 -6
- data/lib/fog/libvirt/requests/compute/list_domains.rb +7 -1
- data/lib/fog/libvirt/version.rb +1 -1
- data/tests/libvirt/models/compute/server_tests.rb +1 -0
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 41b14c1f0524040fcbc157e504813ffe2514dbd3430c88909da1d531ec36c140
|
4
|
+
data.tar.gz: c0fedd19c37d2e5a864336ac9a51f1c4de026f1c6f6120e186153afcbfc5792a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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?
|
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
|
data/lib/fog/libvirt/version.rb
CHANGED
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.
|
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-
|
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
|
-
|
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
|