Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion chef/cookbooks/nova/recipes/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,16 @@
# limitations under the License.
#

node.set[:nova][:my_ip] = Chef::Recipe::Barclamp::Inventory.get_network_by_type(node, "admin").address
my_ip_net = "admin"

# z/VM compute nodes might need a different "my_ip" setting to be accessible
# from the xCAT management node
if node["roles"].include?("nova-compute-zvm")
my_ip_net = node["nova"]["zvm"]["zvm_xcat_network"]
end

node.set[:nova][:my_ip] =
Chef::Recipe::Barclamp::Inventory.get_network_by_type(node, my_ip_net).address

package "nova-common" do
if %w(rhel suse).include?(node[:platform_family])
Expand Down
15 changes: 15 additions & 0 deletions chef/cookbooks/nova/templates/default/nova.conf.erb
Original file line number Diff line number Diff line change
Expand Up @@ -1584,6 +1584,9 @@ control_exchange = nova

# Sets the admin password in the config drive (boolean value)
#zvm_config_drive_inject_password = false
<% if @libvirt_type.eql?('zvm') -%>
zvm_config_drive_inject_password=<%= node[:nova][:zvm][:zvm_config_drive_inject_password] %>
<% end -%>

# Force can be: (ARCHITECTURE) attempt relocation even though hardware
# architecture facilities or CP features are not available on destination
Expand All @@ -1607,6 +1610,9 @@ control_exchange = nova

# Timeout(seconds) when start an instance. (integer value)
#zvm_reachable_timeout = 300
<% if @libvirt_type.eql?('zvm') -%>
zvm_reachable_timeout=<%= node[:nova][:zvm][:zvm_reachable_timeout] %>
<% end -%>

# XCAT connection read timeout(seconds) (integer value)
#zvm_xcat_connection_timeout = 3600
Expand All @@ -1620,9 +1626,15 @@ control_exchange = nova

# Default password for a new created z/VM user (string value)
#zvm_user_default_password = dfltpass
<% if @libvirt_type.eql?('zvm') -%>
zvm_user_default_password=<%= node[:nova][:zvm][:zvm_user_default_password] %>
<% end -%>

# Default privilege level for a new created z/VM user (string value)
#zvm_user_default_privilege = g
<% if @libvirt_type.eql?('zvm') -%>
zvm_user_default_privilege=<%= node[:nova][:zvm][:zvm_user_default_privilege] %>
<% end -%>

# Virtual device number for ephemeral root disk (string value)
#zvm_user_root_vdev = 0100
Expand All @@ -1642,6 +1654,9 @@ control_exchange = nova

# Default os root password for a new created vm (string value)
#zvm_image_default_password = rootpass
<% if @libvirt_type.eql?('zvm') -%>
zvm_image_default_password=<%= node[:nova][:zvm][:zvm_image_default_password] %>
<% end -%>

# The period(days) to clean up an image that not be used for deploy in one xCAT
# MN within the defined time (integer value)
Expand Down
31 changes: 31 additions & 0 deletions chef/data_bags/crowbar/migrate/nova/044_add_zvm_extra.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
def upgrade(ta, td, a, d)
z = a["zvm"]

unless z.key? "zvm_user_default_password"
z["zvm_user_default_password"] = ta["zvm"]["zvm_user_default_password"]
end
unless z.key? "zvm_user_default_privilege"
z["zvm_user_default_privilege"] = ta["zvm"]["zvm_user_default_privilege"]
end
unless z.key? "zvm_reachable_timeout"
z["zvm_reachable_timeout"] = ta["zvm"]["zvm_reachable_timeout"]
end

return a, d
end

def downgrade(ta, td, a, d)
z = a["zvm"]

unless ta["zvm"].key? "zvm_user_default_password"
z.delete("zvm_user_default_password")
end
unless ta["zvm"].key? "zvm_user_default_privilege"
z.delete("zvm_user_default_privilege")
end
unless ta["zvm"].key? "zvm_reachable_timeout"
z.delete("zvm_reachable_timeout")
end

return a, d
end
15 changes: 15 additions & 0 deletions chef/data_bags/crowbar/migrate/nova/045_add_zvm_xcat_network.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
def upgrade(ta, td, a, d)
unless a["zvm"].key? "zvm_xcat_network"
a["zvm"]["zvm_xcat_network"] = "admin"
end

return a, d
end

def downgrade(ta, td, a, d)
unless ta["zvm"].key? "zvm_xcat_network"
a["zvm"].delete("zvm_xcat_network")
end

return a, d
end
6 changes: 5 additions & 1 deletion chef/data_bags/crowbar/template-nova.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
"zvm_xcat_server": "",
"zvm_xcat_username": "",
"zvm_xcat_password": "",
"zvm_xcat_network": "admin",
"zvm_diskpool": "",
"zvm_diskpool_type": "",
"zvm_host": "",
Expand All @@ -65,6 +66,9 @@
"zvm_xcat_master": "",
"zvm_image_default_password": "rootpass",
"zvm_config_drive_inject_password": true,
"zvm_reachable_timeout": 600,
"zvm_user_default_password": "dfltpass",
"zvm_user_default_privilege": "g",
"zvm_xcat_ssh_key": ""
},
"ssl": {
Expand Down Expand Up @@ -93,7 +97,7 @@
"nova": {
"crowbar-revision": 0,
"crowbar-applied": false,
"schema-revision": 43,
"schema-revision": 45,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why 45? and not 44?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One commit moves to 44, and the next one to 45. We try to do revision bumps in an atomic way in terms of commits, so that any checkout would work.

"element_states": {
"nova-controller": [ "readying", "ready", "applying" ],
"nova-compute-docker": [ "readying", "ready", "applying" ],
Expand Down
4 changes: 4 additions & 0 deletions chef/data_bags/crowbar/template-nova.schema
Original file line number Diff line number Diff line change
Expand Up @@ -86,13 +86,17 @@
"zvm_xcat_server": { "type": "str", "required": true },
"zvm_xcat_username": { "type": "str", "required": true },
"zvm_xcat_password": { "type": "str", "required": true },
"zvm_xcat_network": { "type": "str", "required": true },
"zvm_diskpool": { "type": "str", "required": true },
"zvm_diskpool_type": { "type": "str", "required": true },
"zvm_host": { "type": "str", "required": true },
"zvm_scsi_pool": { "type": "str", "required": true },
"zvm_user_profile": { "type": "str", "required": true },
"zvm_xcat_master": { "type": "str", "required": true },
"zvm_image_default_password": { "type": "str", "required": true },
"zvm_user_default_password": { "type": "str", "required": true },
"zvm_user_default_privilege": { "type": "str", "required": true },
"zvm_reachable_timeout": { "type": "int", "required": true },
"zvm_config_drive_inject_password": { "type": "bool", "required": true },
"zvm_xcat_ssh_key": { "type": "str", "required": true }
}
Expand Down
21 changes: 21 additions & 0 deletions crowbar_framework/app/models/nova_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,18 @@ def apply_role_pre_chef_call(old_role, role, all_nodes)
neutron["attributes"]["neutron"]["use_dvr"])
end unless all_nodes.nil?

# Allocate IP for xcat_management network for z/VM nodes, if we're
# configured to use something else than the "admin" network for it.
zvm_compute_nodes = role.override_attributes["nova"]["elements"]["nova-compute-zvm"]
unless zvm_compute_nodes.nil? || zvm_compute_nodes.empty?
zvm_xcat_network = role.default_attributes["nova"]["zvm"]["zvm_xcat_network"]
unless zvm_xcat_network == "admin"
zvm_compute_nodes.each do |n|
net_svc.allocate_ip("default", zvm_xcat_network, "host", n)
end
end
end

@logger.debug("Nova apply_role_pre_chef_call: leaving")
end

Expand All @@ -331,6 +343,15 @@ def validate_proposal_after_save proposal
validation_error I18n.t("barclamp.#{@bc_name}.validation.hyperv_support")
end

unless elements["nova-compute-zvm"].nil? || elements["nova-compute-zvm"].empty?
unless network_present? proposal["attributes"][@bc_name]["zvm"]["zvm_xcat_network"]
validation_error I18n.t(
"barclamp.#{@bc_name}.validation.invalid_zvm_xcat_network",
network: proposal["attributes"][@bc_name]["zvm"]["zvm_xcat_network"]
)
end
end

elements["nova-compute-docker"].each do |n|
nodes[n] += 1
end unless elements["nova-compute-docker"].nil?
Expand Down
1 change: 1 addition & 0 deletions crowbar_framework/config/locales/nova/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -90,3 +90,4 @@ en:
assigned_node: 'Node %{key} has been assigned to a nova-compute role more than once.'
assigned_remotes: 'Remotes %{key} has been assigned to a nova-compute role more than once.'
assigned_node_and_remote: 'Node %{node} has been assigned to a nova-compute role as individual node and as remote node of cluster %{cluster}.'
invalid_zvm_xcat_network: 'Network "%{network}" configured for zvm xcat access is not defined in the configuration of the network barclamp.'