ovirt_provision_plugin 0.0.1 → 1.0.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
2
  SHA1:
3
- metadata.gz: 955bff3cec351e52917fa55899acf3ca756a5b07
4
- data.tar.gz: 75639352d0fe75f263312d7812b49925b814cfa4
3
+ metadata.gz: e34e8751197c85879b4acac702f27280b47023c2
4
+ data.tar.gz: 8ee48580f600641e1c93a61f09f8e88a6fed7c9d
5
5
  SHA512:
6
- metadata.gz: 1bd43a4d1d9513380e3e4b540dee7537041f279d7a0be84ce408e46cc127022a48c9a65351ad7eabe5b63e4bb9d09d873527e35670bcffd33da28358af97d7ef
7
- data.tar.gz: 5892ca776562fd51ef9af3e4181b20ef52734d15a60644ac667e6a60152af383645385ac35c12262a1f4b87fac4cb820b3a91ed6457e701bc4caaf1975ab264e
6
+ metadata.gz: 6ef825d15128bdcb0d70e8e0ea1ad86f0f72cd18ad0a4ac303d62e26f7cbc10abfebb6e686d290f76063a1985d74d8e57c086878f0c48d5771241bbd73e987a9
7
+ data.tar.gz: 50984c1d0ab8c1aff730d8b8e2481a41f7fc4c35a8a16237a2b36e24f0d385bfb333fc50ad5f20435f1eb5fb47ad5eebd2e0aaf4fad9576f30a4c85b621a7630
data/README.md CHANGED
@@ -1,23 +1,27 @@
1
- # OvirtProvisionPlugin
1
+ # ovirt_provision_plugin
2
2
 
3
- This plugin monitors oVirt provision for new host and perform related API calls to oVirt Engine.
3
+ Ovirt provision plugin sends API request to oVirt management to reinstall host id after discovered hosts are first provisioned
4
+ by oVirt engine (Using foreman provider integration).
4
5
 
5
6
  # How does it work
6
7
 
7
- oVirt 3.5 allows to add foreman hosts to oVirt-engine by its user interface. This plugin helps to manage
8
+ oVirt 3.5 allows to add foreman hosts provider to oVirt engine. This plugin is required to manage
8
9
  new discovered host (which are recognized by foreman_discovery plugin).
9
- When user adds new host from the discovered host, the host joins to oVirt cluster and get installed.
10
- When the OS installation part ends, OvirtProvisionPlugin sends API call to ovirt-engine to deploy the host, which
11
- means to install all that needed to provide vms manipulation on host (called deployed host).
10
+ When user adds new host from the discovered host by ovirt, the host is joined to cluster and foreman starts to provision
11
+ it regarding to the choosen host group configuration.
12
+ When the OS installation part ends, ovirt_provision_plugin recognizes it and sends API call to
13
+ ovirt-engine to reinstall the host id.
12
14
 
13
15
  ## Installation
14
16
 
15
- See [How_to_Install_a_Plugin](http://projects.theforeman.org/projects/foreman/wiki/How_to_Install_a_Plugin)
16
- for how to install Foreman plugins
17
+ yum install ruby193-rubygem-ovirt_provision_plugin
17
18
 
18
- ## Usage
19
+ [TODO: remove this section when plugin gets to official repo]
20
+ Currently you can use:
21
+ http://yum.theforeman.org/plugins/nightly/el6/x86_64/ruby193-rubygem-ovirt_provision_plugin-0.0.1-1.el6.noarch.rpm
19
22
 
20
- Adding the plugin to foreman gem will add automatically to the provision host flow the registration to oVirt cluster.
23
+ The plugin requires also rbovirt updates, which can be found in:
24
+ http://yum.theforeman.org/nightly/el6/x86_64/ruby193-rubygem-rbovirt-0.0.28-1.el6.noarch.rpm
21
25
 
22
26
  ## Contributing
23
27
 
@@ -4,11 +4,29 @@ module OvirtProvisionPlugin
4
4
 
5
5
  def ovirt_host_callback
6
6
  logger.debug "OvirtProvisionPlugin:: Running provision callback.."
7
- if self.ovirt_host? && self.status_installing? && (not self.is_ovirt_node?) && (not self.error?)
8
- logger.debug "OvirtProvisionPlugin:: Running ovirt_host_callback on \"#{self.get_ovirt_host_name}\""
9
- host_id = self.get_ovirt_host_id
10
- client = self.get_ovirt_client
11
- client.reinstall_host("#{host_id}")
7
+ max_tries = 10;
8
+ if self.is_ovirt_node?
9
+ logger.debug "OvirtProvisionPlugin:: Node provisioning is done."
10
+ else
11
+ while max_tries > 0 && self.ovirt_host? && self.status_installing?
12
+ if (self.error?)
13
+ logger.debug "OvirtProvisionPlugin:: Failed to run classes. Trying again (#{max_tries})"
14
+ puppetrun!
15
+ max_tries = max_tries - 1
16
+ else
17
+ begin
18
+ logger.debug "OvirtProvisionPlugin:: Running ovirt_host_callback on \"#{self.get_ovirt_host_name}\""
19
+ host_id = self.get_ovirt_host_id
20
+ client = self.get_ovirt_client
21
+ client.reinstall_host("#{host_id}")
22
+ logger.debug "OvirtProvisionPlugin:: Sent reinstall command successfully"
23
+ rescue OVIRT::OvirtException
24
+ logger.debug "OvirtProvisionPlugin:: Failed to reinstall host. Trying again (#{max_tries})"
25
+ puppetrun!
26
+ max_tries = max_tries - 1
27
+ end
28
+ end
29
+ end
12
30
  end
13
31
  end
14
32
 
@@ -31,7 +49,7 @@ module OvirtProvisionPlugin
31
49
 
32
50
  def status_installing?
33
51
  h = self.get_ovirt_host
34
- if h && h.status.strip == "installing_os"
52
+ if h != "" && h.status.strip == "installing_os"
35
53
  logger.debug "OvirtProvisionPlugin:: host in status installing"
36
54
  return true
37
55
  end
@@ -40,13 +58,14 @@ module OvirtProvisionPlugin
40
58
 
41
59
  def get_ovirt_client
42
60
  begin
43
- cr = ComputeResource.find_by_id(parameters.find_by_name("compute_resource_id").value)
61
+ cr_id = parameters.find_by_name("compute_resource_id").value
62
+ cr = ComputeResource.find_by_id(cr_id)
44
63
  return OVIRT::Client.new("#{cr.user}", "#{cr.password}", "#{cr.url}")
45
64
  rescue OVIRT::OvirtException
46
65
  logger.debug "OvirtProvisionPlugin:: compute resource id was not found"
47
66
  return false
48
67
  rescue NoMethodError
49
- logger.debug "OvirtProvisionPlugin:: fail to read compute_recource_id on host #{self.name}"
68
+ logger.debug "OvirtProvisionPlugin:: fail to read compute_rescource_id on host #{self.name}, id #{cr_id}"
50
69
  return false
51
70
  else
52
71
  logger.debug "OvirtProvisionPlugin:: error occured during get_ovirt_client"
@@ -1,3 +1,3 @@
1
1
  module OvirtProvisionPlugin
2
- VERSION = "0.0.1"
2
+ VERSION = "1.0.0"
3
3
  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: 0.0.1
4
+ version: 1.0.0
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-06-22 00:00:00.000000000 Z
11
+ date: 2014-11-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: deface
@@ -24,7 +24,23 @@ dependencies:
24
24
  - - '>='
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
- description: ''
27
+ - !ruby/object:Gem::Dependency
28
+ name: rbovirt
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '>='
32
+ - !ruby/object:Gem::Version
33
+ version: 0.0.27
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: 0.0.27
41
+ description: Ovirt provision plugin sends API request to oVirt management to reinstall
42
+ host id after discovered hosts are first provisioned by oVirt engine (Using foreman
43
+ provider integration).
28
44
  email:
29
45
  - ybronhei@redhat.com
30
46
  executables: []
@@ -33,26 +49,26 @@ extra_rdoc_files: []
33
49
  files:
34
50
  - app/models/concerns/ovirt_provision_plugin/host_extensions.rb
35
51
  - app/models/concerns/ovirt_provision_plugin/report_extensions.rb
36
- - app/overrides/dashboard/index/sample_override.html.erb.deface
37
- - app/views/ovirt_provision_plugin/layouts/layouts/new_layout.html.erb
38
- - app/views/ovirt_provision_plugin/layouts/new_layout.html.erb
52
+ - app/views/ovirt_provision_plugin/hosts/ovirt_hosts.html.erb
39
53
  - app/views/ovirt_provision_plugin/hosts/hosts/ovirt_hosts.html.erb
40
54
  - app/views/ovirt_provision_plugin/hosts/hosts/new_action.html.erb
41
- - app/views/ovirt_provision_plugin/hosts/ovirt_hosts.html.erb
42
55
  - app/views/ovirt_provision_plugin/hosts/new_action.html.erb
56
+ - app/views/ovirt_provision_plugin/layouts/new_layout.html.erb
57
+ - app/views/ovirt_provision_plugin/layouts/layouts/new_layout.html.erb
58
+ - app/overrides/dashboard/index/sample_override.html.erb.deface
43
59
  - app/helpers/concerns/ovirt_provision_plugin/hosts_helper_extensions.rb
44
60
  - config/routes.rb
45
- - lib/ovirt_provision_plugin.rb
46
61
  - lib/tasks/ovirt_provision_plugin_tasks.rake
47
- - lib/ovirt_provision_plugin/engine.rb
48
62
  - lib/ovirt_provision_plugin/version.rb
63
+ - lib/ovirt_provision_plugin/engine.rb
64
+ - lib/ovirt_provision_plugin.rb
49
65
  - LICENSE
50
66
  - Rakefile
51
67
  - README.md
52
- - test/test_plugin_helper.rb
53
- - test/factories/ovirt_provision_plugin_factories.rb
54
68
  - test/unit/ovirt_provision_plugin_test.rb
55
- homepage: ''
69
+ - test/factories/ovirt_provision_plugin_factories.rb
70
+ - test/test_plugin_helper.rb
71
+ homepage: https://github.com/theforeman/ovirt_provision_plugin
56
72
  licenses: []
57
73
  metadata: {}
58
74
  post_install_message:
@@ -77,6 +93,6 @@ specification_version: 4
77
93
  summary: This plugin monitors oVirt provision for new host and perform related API
78
94
  calls to ovirt-engine.
79
95
  test_files:
80
- - test/test_plugin_helper.rb
81
- - test/factories/ovirt_provision_plugin_factories.rb
82
96
  - test/unit/ovirt_provision_plugin_test.rb
97
+ - test/factories/ovirt_provision_plugin_factories.rb
98
+ - test/test_plugin_helper.rb