fog-libvirt 0.5.0 → 0.9.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/README.md +1 -1
- data/fog-libvirt.gemspec +3 -3
- data/lib/fog/bin/libvirt.rb +1 -1
- data/lib/fog/libvirt.rb +1 -3
- data/lib/fog/libvirt/compute.rb +12 -11
- data/lib/fog/libvirt/models/compute/README.md +16 -0
- data/lib/fog/libvirt/models/compute/interface.rb +2 -2
- data/lib/fog/libvirt/models/compute/interfaces.rb +3 -3
- data/lib/fog/libvirt/models/compute/network.rb +3 -3
- data/lib/fog/libvirt/models/compute/networks.rb +3 -3
- data/lib/fog/libvirt/models/compute/nic.rb +2 -2
- data/lib/fog/libvirt/models/compute/nics.rb +3 -3
- data/lib/fog/libvirt/models/compute/node.rb +2 -2
- data/lib/fog/libvirt/models/compute/nodes.rb +3 -3
- data/lib/fog/libvirt/models/compute/pool.rb +2 -2
- data/lib/fog/libvirt/models/compute/pools.rb +3 -3
- data/lib/fog/libvirt/models/compute/server.rb +23 -8
- data/lib/fog/libvirt/models/compute/servers.rb +3 -3
- data/lib/fog/libvirt/models/compute/templates/server.xml.erb +65 -0
- data/lib/fog/libvirt/models/compute/templates/volume.xml.erb +8 -4
- data/lib/fog/libvirt/models/compute/util/uri.rb +2 -2
- data/lib/fog/libvirt/models/compute/util/util.rb +2 -2
- data/lib/fog/libvirt/models/compute/volume.rb +11 -9
- data/lib/fog/libvirt/models/compute/volumes.rb +3 -3
- data/lib/fog/libvirt/requests/compute/clone_volume.rb +3 -3
- data/lib/fog/libvirt/requests/compute/create_domain.rb +2 -2
- data/lib/fog/libvirt/requests/compute/create_volume.rb +2 -2
- data/lib/fog/libvirt/requests/compute/define_domain.rb +2 -2
- data/lib/fog/libvirt/requests/compute/define_pool.rb +2 -2
- data/lib/fog/libvirt/requests/compute/destroy_interface.rb +2 -2
- data/lib/fog/libvirt/requests/compute/destroy_network.rb +2 -2
- data/lib/fog/libvirt/requests/compute/dhcp_leases.rb +2 -2
- data/lib/fog/libvirt/requests/compute/get_node_info.rb +2 -2
- data/lib/fog/libvirt/requests/compute/libversion.rb +2 -2
- data/lib/fog/libvirt/requests/compute/list_domains.rb +9 -3
- data/lib/fog/libvirt/requests/compute/list_interfaces.rb +2 -2
- data/lib/fog/libvirt/requests/compute/list_networks.rb +11 -3
- data/lib/fog/libvirt/requests/compute/list_pool_volumes.rb +2 -2
- data/lib/fog/libvirt/requests/compute/list_pools.rb +2 -2
- data/lib/fog/libvirt/requests/compute/list_volumes.rb +16 -8
- data/lib/fog/libvirt/requests/compute/pool_action.rb +2 -2
- data/lib/fog/libvirt/requests/compute/update_autostart.rb +18 -0
- data/lib/fog/libvirt/requests/compute/update_display.rb +2 -2
- data/lib/fog/libvirt/requests/compute/upload_volume.rb +2 -2
- data/lib/fog/libvirt/requests/compute/vm_action.rb +2 -2
- data/lib/fog/libvirt/requests/compute/volume_action.rb +2 -2
- data/lib/fog/libvirt/version.rb +1 -1
- data/minitests/server/server_test.rb +1 -1
- data/minitests/server/user_data_iso_test.rb +8 -11
- data/minitests/test_helper.rb +1 -1
- data/tests/helper.rb +1 -1
- data/tests/helpers/formats_helper.rb +58 -56
- data/tests/helpers/formats_helper_tests.rb +22 -25
- data/tests/helpers/mock_helper.rb +1 -1
- data/tests/helpers/succeeds_helper.rb +2 -2
- data/tests/libvirt/compute_tests.rb +2 -1
- data/tests/libvirt/models/compute/interface_tests.rb +1 -1
- data/tests/libvirt/models/compute/interfaces_tests.rb +1 -1
- data/tests/libvirt/models/compute/network_tests.rb +1 -1
- data/tests/libvirt/models/compute/networks_tests.rb +1 -1
- data/tests/libvirt/models/compute/nic_tests.rb +1 -1
- data/tests/libvirt/models/compute/pool_tests.rb +1 -1
- data/tests/libvirt/models/compute/pools_tests.rb +1 -1
- data/tests/libvirt/models/compute/server_tests.rb +4 -1
- data/tests/libvirt/models/compute/servers_tests.rb +1 -1
- data/tests/libvirt/models/compute/volume_tests.rb +1 -1
- data/tests/libvirt/models/compute/volumes_tests.rb +2 -1
- data/tests/libvirt/requests/compute/update_autostart_tests.rb +12 -0
- metadata +12 -16
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
|
-
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 6c5d75c89309efc19a2a8e70db7f95dc754fe127358089bd8ebe0cd0f2ecf896
|
|
4
|
+
data.tar.gz: 2270fa713728f8824dffc45dca9344c1b244feeb3add91130d26fff493c00f18
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 1834c04363667e8bb7632055010f7544ec72aec0f49254e8c708bc1b73c0d731aa6474acd01644de9fa35d43491bfd5d7e60d3a6636d6301ba2446f6470b80cd
|
|
7
|
+
data.tar.gz: f6834023432a36058571b78e8c1b8f5ec5a5043990d8f738cbf7c986a9038a8a723415214fa702bc7ad09c83fbd119b961ea4ee5c0bc6ebd328b0ab744f12158
|
data/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
fog-libvirt is a libvirt provider for [fog](https://github.com/fog/fog).
|
|
4
4
|
|
|
5
|
-
[](https://github.com/fog/fog-libvirt/actions/workflows/ruby.yml)
|
|
6
6
|
[](https://gemnasium.com/fog/fog-libvirt)
|
|
7
7
|
[](https://codeclimate.com/github/fog/fog-libvirt)
|
|
8
8
|
[](http://badge.fury.io/rb/fog-libvirt)
|
data/fog-libvirt.gemspec
CHANGED
|
@@ -23,9 +23,9 @@ Gem::Specification.new do |s|
|
|
|
23
23
|
s.rdoc_options = ["--charset=UTF-8"]
|
|
24
24
|
s.extra_rdoc_files = %w[README.md]
|
|
25
25
|
|
|
26
|
-
s.required_ruby_version = '>= 2.
|
|
26
|
+
s.required_ruby_version = '>= 2.5.0'
|
|
27
27
|
|
|
28
|
-
s.add_dependency("fog-core", "
|
|
28
|
+
s.add_dependency("fog-core", ">= 1.27.4")
|
|
29
29
|
s.add_dependency("fog-json")
|
|
30
30
|
s.add_dependency("fog-xml", "~> 0.1.1")
|
|
31
31
|
s.add_dependency('ruby-libvirt','>= 0.7.0')
|
|
@@ -40,7 +40,7 @@ Gem::Specification.new do |s|
|
|
|
40
40
|
s.add_development_dependency("shindo", "~> 0.3.4")
|
|
41
41
|
s.add_development_dependency("simplecov")
|
|
42
42
|
s.add_development_dependency("yard")
|
|
43
|
-
s.add_development_dependency("mocha", "~> 1.
|
|
43
|
+
s.add_development_dependency("mocha", "~> 1.13.0")
|
|
44
44
|
|
|
45
45
|
# Let's not ship dot files and gemfiles
|
|
46
46
|
git_files = `git ls-files`.split("\n")
|
data/lib/fog/bin/libvirt.rb
CHANGED
data/lib/fog/libvirt.rb
CHANGED
|
@@ -9,9 +9,7 @@ module Fog
|
|
|
9
9
|
module Libvirt
|
|
10
10
|
extend Fog::Provider
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
autoload :Libvirt, File.expand_path('../libvirt/compute', __FILE__)
|
|
14
|
-
end
|
|
12
|
+
autoload :Compute, File.expand_path('../libvirt/compute', __FILE__)
|
|
15
13
|
|
|
16
14
|
service(:compute, 'Compute')
|
|
17
15
|
end
|
data/lib/fog/libvirt/compute.rb
CHANGED
|
@@ -2,8 +2,8 @@ require 'fog/libvirt/models/compute/util/util'
|
|
|
2
2
|
require 'fog/libvirt/models/compute/util/uri'
|
|
3
3
|
|
|
4
4
|
module Fog
|
|
5
|
-
module
|
|
6
|
-
class
|
|
5
|
+
module Libvirt
|
|
6
|
+
class Compute < Fog::Service
|
|
7
7
|
requires :libvirt_uri
|
|
8
8
|
recognizes :libvirt_username, :libvirt_password
|
|
9
9
|
recognizes :libvirt_ip_command
|
|
@@ -44,11 +44,12 @@ module Fog
|
|
|
44
44
|
request :list_interfaces
|
|
45
45
|
request :destroy_interface
|
|
46
46
|
request :get_node_info
|
|
47
|
+
request :update_autostart
|
|
47
48
|
request :update_display
|
|
48
49
|
request :libversion
|
|
49
50
|
|
|
50
51
|
module Shared
|
|
51
|
-
include Fog::
|
|
52
|
+
include Fog::Libvirt::Util
|
|
52
53
|
end
|
|
53
54
|
|
|
54
55
|
class Mock
|
|
@@ -78,7 +79,7 @@ module Fog
|
|
|
78
79
|
attr_reader :ip_command
|
|
79
80
|
|
|
80
81
|
def initialize(options={})
|
|
81
|
-
@uri = ::Fog::
|
|
82
|
+
@uri = ::Fog::Libvirt::Util::URI.new(enhance_uri(options[:libvirt_uri]))
|
|
82
83
|
@ip_command = options[:libvirt_ip_command]
|
|
83
84
|
|
|
84
85
|
# libvirt is part of the gem => ruby-libvirt
|
|
@@ -119,16 +120,16 @@ module Fog
|
|
|
119
120
|
# on macosx, chances are we are using libvirt through homebrew
|
|
120
121
|
# the client will default to a socket location based on it's own location (/opt)
|
|
121
122
|
# we conveniently point it to /var/run/libvirt/libvirt-sock
|
|
122
|
-
# if no socket option has been specified explicitly
|
|
123
|
+
# if no socket option has been specified explicitly and
|
|
124
|
+
# if the socket exists
|
|
123
125
|
|
|
124
|
-
|
|
126
|
+
socketpath="/var/run/libvirt/libvirt-sock"
|
|
127
|
+
if RUBY_PLATFORM =~ /darwin/ && File.exist?(socketpath)
|
|
125
128
|
querystring=::URI.parse(uri).query
|
|
126
129
|
if querystring.nil?
|
|
127
|
-
append="?socket
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
append="&socket=/var/run/libvirt/libvirt-sock"
|
|
131
|
-
end
|
|
130
|
+
append="?socket=#{socketpath}"
|
|
131
|
+
elsif !::CGI.parse(querystring).key?("socket")
|
|
132
|
+
append="&socket=#{socketpath}"
|
|
132
133
|
end
|
|
133
134
|
end
|
|
134
135
|
uri+append
|
|
@@ -26,6 +26,22 @@ 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
|
+
bus_type=virtio
|
|
39
|
+
```
|
|
40
|
+
For more recent versions of libvirt which support using the secret by name (`usage` attribute in the `secret` tag),
|
|
41
|
+
you can also drop `auth_uuid` and specify `auth_usage` instead. If both are specified, `auth_uuid` will be preferred for maximum compatibility.
|
|
42
|
+
|
|
43
|
+
The `bus_type` can be set to `virtio` or `scsi`. If it is ommited, the default is `scsi`.
|
|
44
|
+
|
|
29
45
|
## Configuration
|
|
30
46
|
|
|
31
47
|
The URI can be configured in two ways:
|
|
@@ -2,10 +2,10 @@ require 'fog/core/collection'
|
|
|
2
2
|
require 'fog/libvirt/models/compute/interface'
|
|
3
3
|
|
|
4
4
|
module Fog
|
|
5
|
-
module
|
|
6
|
-
class
|
|
5
|
+
module Libvirt
|
|
6
|
+
class Compute
|
|
7
7
|
class Interfaces < Fog::Collection
|
|
8
|
-
model Fog::Compute::
|
|
8
|
+
model Fog::Libvirt::Compute::Interface
|
|
9
9
|
|
|
10
10
|
def all(filter={})
|
|
11
11
|
load(service.list_interfaces(filter))
|
|
@@ -2,10 +2,10 @@ require 'fog/core/model'
|
|
|
2
2
|
require 'fog/libvirt/models/compute/util/util'
|
|
3
3
|
|
|
4
4
|
module Fog
|
|
5
|
-
module
|
|
6
|
-
class
|
|
5
|
+
module Libvirt
|
|
6
|
+
class Compute
|
|
7
7
|
class Network < Fog::Model
|
|
8
|
-
include Fog::
|
|
8
|
+
include Fog::Libvirt::Util
|
|
9
9
|
|
|
10
10
|
identity :uuid
|
|
11
11
|
attribute :name
|
|
@@ -2,10 +2,10 @@ require 'fog/core/collection'
|
|
|
2
2
|
require 'fog/libvirt/models/compute/network'
|
|
3
3
|
|
|
4
4
|
module Fog
|
|
5
|
-
module
|
|
6
|
-
class
|
|
5
|
+
module Libvirt
|
|
6
|
+
class Compute
|
|
7
7
|
class Networks < Fog::Collection
|
|
8
|
-
model Fog::Compute::
|
|
8
|
+
model Fog::Libvirt::Compute::Network
|
|
9
9
|
|
|
10
10
|
def all(filter={})
|
|
11
11
|
load(service.list_networks(filter))
|
|
@@ -2,10 +2,10 @@ require 'fog/core/collection'
|
|
|
2
2
|
require 'fog/libvirt/models/compute/nic'
|
|
3
3
|
|
|
4
4
|
module Fog
|
|
5
|
-
module
|
|
6
|
-
class
|
|
5
|
+
module Libvirt
|
|
6
|
+
class Compute
|
|
7
7
|
class Nics < Fog::Collection
|
|
8
|
-
model Fog::Compute::
|
|
8
|
+
model Fog::Libvirt::Compute::Nic
|
|
9
9
|
end
|
|
10
10
|
end
|
|
11
11
|
end
|
|
@@ -2,10 +2,10 @@ require 'fog/core/collection'
|
|
|
2
2
|
require 'fog/libvirt/models/compute/node'
|
|
3
3
|
|
|
4
4
|
module Fog
|
|
5
|
-
module
|
|
6
|
-
class
|
|
5
|
+
module Libvirt
|
|
6
|
+
class Compute
|
|
7
7
|
class Nodes < Fog::Collection
|
|
8
|
-
model Fog::Compute::
|
|
8
|
+
model Fog::Libvirt::Compute::Node
|
|
9
9
|
|
|
10
10
|
def all(filter={ })
|
|
11
11
|
load(service.get_node_info)
|
|
@@ -2,10 +2,10 @@ require 'fog/core/collection'
|
|
|
2
2
|
require 'fog/libvirt/models/compute/pool'
|
|
3
3
|
|
|
4
4
|
module Fog
|
|
5
|
-
module
|
|
6
|
-
class
|
|
5
|
+
module Libvirt
|
|
6
|
+
class Compute
|
|
7
7
|
class Pools < Fog::Collection
|
|
8
|
-
model Fog::Compute::
|
|
8
|
+
model Fog::Libvirt::Compute::Pool
|
|
9
9
|
|
|
10
10
|
def all(filter = {})
|
|
11
11
|
load(service.list_pools(filter))
|
|
@@ -3,10 +3,10 @@ require 'fog/libvirt/models/compute/util/util'
|
|
|
3
3
|
require 'fileutils'
|
|
4
4
|
|
|
5
5
|
module Fog
|
|
6
|
-
module
|
|
7
|
-
class
|
|
6
|
+
module Libvirt
|
|
7
|
+
class Compute
|
|
8
8
|
class Server < Fog::Compute::Server
|
|
9
|
-
include Fog::
|
|
9
|
+
include Fog::Libvirt::Util
|
|
10
10
|
attr_reader :xml
|
|
11
11
|
|
|
12
12
|
identity :id, :aliases => 'uuid'
|
|
@@ -28,6 +28,9 @@ module Fog
|
|
|
28
28
|
attribute :boot_order
|
|
29
29
|
attribute :display
|
|
30
30
|
attribute :cpu
|
|
31
|
+
attribute :hugepages
|
|
32
|
+
attribute :guest_agent
|
|
33
|
+
attribute :virtio_rng
|
|
31
34
|
|
|
32
35
|
attribute :state
|
|
33
36
|
|
|
@@ -75,6 +78,10 @@ module Fog
|
|
|
75
78
|
action_status
|
|
76
79
|
end
|
|
77
80
|
|
|
81
|
+
def update_autostart(value)
|
|
82
|
+
service.update_autostart(uuid, value)
|
|
83
|
+
end
|
|
84
|
+
|
|
78
85
|
def mac
|
|
79
86
|
nics.first.mac if nics && nics.first
|
|
80
87
|
end
|
|
@@ -129,9 +136,10 @@ module Fog
|
|
|
129
136
|
end
|
|
130
137
|
|
|
131
138
|
#alias methods
|
|
132
|
-
alias_method :halt,
|
|
133
|
-
alias_method :stop,
|
|
134
|
-
alias_method :active?,
|
|
139
|
+
alias_method :halt, :poweroff
|
|
140
|
+
alias_method :stop, :shutdown
|
|
141
|
+
alias_method :active?, :active
|
|
142
|
+
alias_method :autostart?, :autostart
|
|
135
143
|
|
|
136
144
|
def volumes
|
|
137
145
|
# lazy loading of volumes
|
|
@@ -339,6 +347,9 @@ module Fog
|
|
|
339
347
|
ip_address.chomp
|
|
340
348
|
end
|
|
341
349
|
|
|
350
|
+
# Locale-friendly removal of non-alpha nums
|
|
351
|
+
DOMAIN_CLEANUP_REGEXP = Regexp.compile('[\W_-]')
|
|
352
|
+
|
|
342
353
|
# This retrieves the ip address of the mac address using ip_command
|
|
343
354
|
# It returns an array of public and private ip addresses
|
|
344
355
|
# Currently only one ip address is returned, but in the future this could be multiple
|
|
@@ -352,7 +363,7 @@ module Fog
|
|
|
352
363
|
ip_command_global=service_arg.ip_command.nil? ? 'grep $mac /var/log/arpwatch.log|sed -e "s/new station//"|sed -e "s/changed ethernet address//g" |sed -e "s/reused old ethernet //" |tail -1 |cut -d ":" -f 4-| cut -d " " -f 3' : service_arg.ip_command
|
|
353
364
|
ip_command_local=options[:ip_command].nil? ? ip_command_global : options[:ip_command]
|
|
354
365
|
|
|
355
|
-
ip_command="mac=#{mac}; server_name=#{name}; "+ip_command_local
|
|
366
|
+
ip_command="mac=#{mac}; server_name=#{name.gsub(DOMAIN_CLEANUP_REGEXP, '_')}; "+ip_command_local
|
|
356
367
|
|
|
357
368
|
ip_address=nil
|
|
358
369
|
|
|
@@ -471,13 +482,17 @@ module Fog
|
|
|
471
482
|
:os_type => "hvm",
|
|
472
483
|
:arch => "x86_64",
|
|
473
484
|
:domain_type => "kvm",
|
|
485
|
+
:autostart => false,
|
|
474
486
|
:iso_dir => default_iso_dir,
|
|
475
487
|
:network_interface_type => "network",
|
|
476
488
|
:network_nat_network => "default",
|
|
477
489
|
:network_bridge_name => "br0",
|
|
478
490
|
:boot_order => %w[hd cdrom network],
|
|
479
491
|
:display => default_display,
|
|
480
|
-
:cpu => {}
|
|
492
|
+
:cpu => {},
|
|
493
|
+
:hugepages => false,
|
|
494
|
+
:guest_agent => true,
|
|
495
|
+
:virtio_rng => {},
|
|
481
496
|
}
|
|
482
497
|
end
|
|
483
498
|
|
|
@@ -2,10 +2,10 @@ require 'fog/core/collection'
|
|
|
2
2
|
require 'fog/libvirt/models/compute/server'
|
|
3
3
|
|
|
4
4
|
module Fog
|
|
5
|
-
module
|
|
6
|
-
class
|
|
5
|
+
module Libvirt
|
|
6
|
+
class Compute
|
|
7
7
|
class Servers < Fog::Collection
|
|
8
|
-
model Fog::Compute::
|
|
8
|
+
model Fog::Libvirt::Compute::Server
|
|
9
9
|
|
|
10
10
|
def all(filter={})
|
|
11
11
|
load(service.list_domains(filter))
|
|
@@ -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,48 @@
|
|
|
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
|
+
<% if args.key?("monitor") -%>
|
|
56
|
+
<% args["monitor"].split(",").each do |mon| %>
|
|
57
|
+
<host name='<%= mon %>' port='<%= args["port"] %>'/>
|
|
58
|
+
<% end %>
|
|
59
|
+
<% end %>
|
|
60
|
+
</source>
|
|
61
|
+
<auth username='<%= args["auth_username"] %>'>
|
|
62
|
+
<% if args.key?("auth_uuid") -%>
|
|
63
|
+
<secret type='ceph' uuid='<%= args["auth_uuid"] %>'/>
|
|
64
|
+
<% else -%>
|
|
65
|
+
<secret type='ceph' usage='<%= args["auth_usage"] %>'/>
|
|
66
|
+
<% end -%>
|
|
67
|
+
</auth>
|
|
68
|
+
<% if args['bus_type'] == 'virtio' %>
|
|
69
|
+
<target dev='vd<%= ('a'..'z').to_a[volumes.index(vol)] %>' bus='virtio'/>
|
|
70
|
+
<% else %>
|
|
71
|
+
<target dev='sd<%= ('a'..'z').to_a[volumes.index(vol)] %>' bus='scsi'/>
|
|
72
|
+
<% end %>
|
|
73
|
+
</disk>
|
|
74
|
+
<% else %>
|
|
36
75
|
<disk type='file' device='disk'>
|
|
37
76
|
<driver name='qemu' type='<%= vol.format_type %>'/>
|
|
38
77
|
<source file='<%= vol.path %>'/>
|
|
39
78
|
<%# we need to ensure a unique target dev -%>
|
|
40
79
|
<target dev='vd<%= ('a'..'z').to_a[volumes.index(vol)] %>' bus='virtio'/>
|
|
41
80
|
</disk>
|
|
81
|
+
<% end %>
|
|
42
82
|
<% end -%>
|
|
43
83
|
<% if iso_file -%>
|
|
44
84
|
<disk type='file' device='cdrom'>
|
|
@@ -55,6 +95,28 @@
|
|
|
55
95
|
<model type='<%= nic.model %>'/>
|
|
56
96
|
</interface>
|
|
57
97
|
<% end -%>
|
|
98
|
+
<% if guest_agent -%>
|
|
99
|
+
<channel type='unix'>
|
|
100
|
+
<target type='virtio' name='org.qemu.guest_agent.0'/>
|
|
101
|
+
</channel>
|
|
102
|
+
<% end -%>
|
|
103
|
+
<rng model='virtio'>
|
|
104
|
+
<%
|
|
105
|
+
rng_backend_model = virtio_rng[:backend_model] ? virtio_rng[:backend_model] : 'random'
|
|
106
|
+
-%>
|
|
107
|
+
<% if virtio_rng[:backend_path] -%>
|
|
108
|
+
<backend model='<%= rng_backend_model %>'><%= virtio_rng[:backend_path] %></backend>
|
|
109
|
+
<% else -%>
|
|
110
|
+
<backend model='<%= rng_backend_model %>'/>
|
|
111
|
+
<% end -%>
|
|
112
|
+
</rng>
|
|
113
|
+
<% if arch == "s390x" -%>
|
|
114
|
+
<controller type="scsi" index="0" model="virtio-scsi"/>
|
|
115
|
+
<console type="pty">
|
|
116
|
+
<target type="sclp"/>
|
|
117
|
+
</console>
|
|
118
|
+
<memballoon model="virtio"/>
|
|
119
|
+
<% else -%>
|
|
58
120
|
<serial type='pty'>
|
|
59
121
|
<target port='0'/>
|
|
60
122
|
</serial>
|
|
@@ -63,6 +125,7 @@
|
|
|
63
125
|
</console>
|
|
64
126
|
<input type='tablet' bus='usb'/>
|
|
65
127
|
<input type='mouse' bus='ps2'/>
|
|
128
|
+
<% end -%>
|
|
66
129
|
<%
|
|
67
130
|
display_type = display[:type]
|
|
68
131
|
|
|
@@ -82,9 +145,11 @@ unless display[:password].empty?
|
|
|
82
145
|
display_password = "passwd='#{display[:password]}'"
|
|
83
146
|
end
|
|
84
147
|
-%>
|
|
148
|
+
<% if arch != "s390x" -%>
|
|
85
149
|
<graphics type='<%= display_type %>' port='<%= display_port %>' autoport='<%= autoport %>' <%= display_listen %> <%= display_password %> />
|
|
86
150
|
<video>
|
|
87
151
|
<model type='cirrus' vram='9216' heads='1'/>
|
|
88
152
|
</video>
|
|
153
|
+
<% end -%>
|
|
89
154
|
</devices>
|
|
90
155
|
</domain>
|