ovirt_provision_plugin 1.0.0 → 1.0.1
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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 349e41ad4b8e953c3c5c38f924b80cf21d37aef7
|
4
|
+
data.tar.gz: 44b74a82562056d07be2703ba5ebe466dfaa8981
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d8093c48083014eeac5d0ea827b9dbc87d825e5647a621cc8ae7e169ae53a5d29bbaa10b2be6d36075f48ca5df3b8f2541513dda507f4f67b73591b1a681b201
|
7
|
+
data.tar.gz: 7fb9fe49575241a618cb070648a9e193ba39441313da9d26c1f42aa65afb3a8a684f358e43adbd11c2930c69f9c58ed5d381b44b7b05d6457b5fb05cf98f738c
|
@@ -3,25 +3,25 @@ module OvirtProvisionPlugin
|
|
3
3
|
extend ActiveSupport::Concern
|
4
4
|
|
5
5
|
def ovirt_host_callback
|
6
|
-
logger.
|
6
|
+
logger.info "OvirtProvisionPlugin:: Running provision callback.."
|
7
7
|
max_tries = 10;
|
8
8
|
if self.is_ovirt_node?
|
9
|
-
logger.
|
9
|
+
logger.info "OvirtProvisionPlugin:: Node provisioning is done."
|
10
10
|
else
|
11
11
|
while max_tries > 0 && self.ovirt_host? && self.status_installing?
|
12
12
|
if (self.error?)
|
13
|
-
logger.
|
13
|
+
logger.warn "OvirtProvisionPlugin:: Failed to run classes. Trying again (#{max_tries})"
|
14
14
|
puppetrun!
|
15
15
|
max_tries = max_tries - 1
|
16
16
|
else
|
17
17
|
begin
|
18
|
-
logger.
|
18
|
+
logger.info "OvirtProvisionPlugin:: Running ovirt_host_callback on \"#{self.get_ovirt_host_name}\""
|
19
19
|
host_id = self.get_ovirt_host_id
|
20
20
|
client = self.get_ovirt_client
|
21
21
|
client.reinstall_host("#{host_id}")
|
22
|
-
logger.
|
22
|
+
logger.info "OvirtProvisionPlugin:: Sent reinstall command successfully"
|
23
23
|
rescue OVIRT::OvirtException
|
24
|
-
logger.
|
24
|
+
logger.warn "OvirtProvisionPlugin:: Failed to reinstall host. Trying again (#{max_tries})"
|
25
25
|
puppetrun!
|
26
26
|
max_tries = max_tries - 1
|
27
27
|
end
|
@@ -33,7 +33,7 @@ module OvirtProvisionPlugin
|
|
33
33
|
def is_ovirt_node?
|
34
34
|
is_ovirt_node = self.operatingsystem.name == "oVirt-Node" or self.operatingsystem.name == "RHEV-H"
|
35
35
|
if is_ovirt_node
|
36
|
-
logger.
|
36
|
+
logger.info "OvirtProvisionPlugin:: Provisioned ovirt node host"
|
37
37
|
return true
|
38
38
|
end
|
39
39
|
return false
|
@@ -41,7 +41,7 @@ module OvirtProvisionPlugin
|
|
41
41
|
|
42
42
|
def ovirt_host?
|
43
43
|
if self.get_ovirt_host_id
|
44
|
-
logger.
|
44
|
+
logger.info "OvirtProvisionPlugin:: host related to oVirt"
|
45
45
|
return true
|
46
46
|
end
|
47
47
|
return false
|
@@ -50,61 +50,66 @@ module OvirtProvisionPlugin
|
|
50
50
|
def status_installing?
|
51
51
|
h = self.get_ovirt_host
|
52
52
|
if h != "" && h.status.strip == "installing_os"
|
53
|
-
logger.
|
53
|
+
logger.info "OvirtProvisionPlugin:: host in status installing"
|
54
54
|
return true
|
55
55
|
end
|
56
56
|
return false
|
57
57
|
end
|
58
58
|
|
59
59
|
def get_ovirt_client
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
rescue NoMethodError
|
68
|
-
logger.debug "OvirtProvisionPlugin:: fail to read compute_rescource_id on host #{self.name}, id #{cr_id}"
|
69
|
-
return false
|
70
|
-
else
|
71
|
-
logger.debug "OvirtProvisionPlugin:: error occured during get_ovirt_client"
|
72
|
-
return false
|
60
|
+
begin
|
61
|
+
cr_id = parameters.find_by_name("compute_resource_id").value
|
62
|
+
cr = ComputeResource.find_by_id(cr_id)
|
63
|
+
connection_opts = {}
|
64
|
+
if not cr.public_key.blank?
|
65
|
+
connection_opts[:datacenter_id] = cr.uuid
|
66
|
+
connection_opts[:ca_cert_store] = OpenSSL::X509::Store.new.add_cert(OpenSSL::X509::Certificate.new(cr.public_key))
|
73
67
|
end
|
68
|
+
return OVIRT::Client.new("#{cr.user}", "#{cr.password}", "#{cr.url}", connection_opts)
|
69
|
+
rescue OVIRT::OvirtException
|
70
|
+
logger.error "OvirtProvisionPlugin:: compute resource id was not found"
|
71
|
+
return false
|
72
|
+
rescue NoMethodError
|
73
|
+
logger.error "OvirtProvisionPlugin:: fail to read compute_rescource_id on host #{self.name}, id #{cr_id}"
|
74
|
+
return false
|
75
|
+
else
|
76
|
+
logger.error "OvirtProvisionPlugin:: error occured during get_ovirt_client"
|
77
|
+
return false
|
78
|
+
end
|
74
79
|
end
|
75
80
|
|
76
81
|
def get_ovirt_host
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
82
|
+
client = self.get_ovirt_client
|
83
|
+
if not client
|
84
|
+
logger.error "OvirtProvisionPlugin:: couldn't get ovirt_host"
|
85
|
+
return ""
|
86
|
+
else
|
87
|
+
return client.host(get_ovirt_host_id)
|
88
|
+
end
|
84
89
|
end
|
85
90
|
|
86
91
|
def get_ovirt_host_name
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
92
|
+
h = self.get_ovirt_host
|
93
|
+
if not h
|
94
|
+
return ""
|
95
|
+
else
|
96
|
+
return h.name
|
97
|
+
end
|
93
98
|
end
|
94
99
|
|
95
100
|
def get_ovirt_host_id
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
101
|
+
begin
|
102
|
+
return self.parameters.find_by_name("host_ovirt_id").value
|
103
|
+
rescue OVIRT::OvirtException
|
104
|
+
logger.error "OvirtProvisionPlugin:: host ovirt id was not found"
|
105
|
+
return false
|
106
|
+
rescue NoMethodError
|
107
|
+
logger.error "OvirtProvisionPlugin:: fail to read host_ovirt_id on host #{self.name}"
|
108
|
+
return false
|
109
|
+
else
|
110
|
+
logger.error "OvirtProvisionPlugin:: error occured during get_ovirt_host_id"
|
111
|
+
return false
|
112
|
+
end
|
108
113
|
end
|
109
114
|
end
|
110
115
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ovirt_provision_plugin
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yaniv Bronhaim
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-11-
|
11
|
+
date: 2014-11-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: deface
|