NOTE: uncommenting this should be treated as api-change! def self.not_found_class
Fog::Baremetal::OpenStack::NotFound
end
# File lib/fog/baremetal/openstack.rb, line 256 def initialize(options = {}) initialize_identity options @openstack_service_type = options[:openstack_service_type] || ['baremetal'] @openstack_service_name = options[:openstack_service_name] @connection_options = options[:connection_options] || {} authenticate set_api_path @persistent = options[:persistent] || false @connection = Fog::Core::Connection.new("#{@scheme}://#{@host}:#{@port}", @persistent, @connection_options) end
Create a new chassis
description = Free text description of the chassis extra = Record arbitrary key/value metadata. Can be specified multiple times
# File lib/fog/baremetal/openstack/requests/create_chassis.rb, line 10 def create_chassis(attributes) desired_options = [ :description, :extra ] # Filter only allowed creation attributes data = attributes.select { |key, _value| desired_options.include?(key.to_sym) } request( :body => Fog::JSON.encode(data), :expects => [200, 201], :method => 'POST', :path => 'chassis' ) end
Create a new node
chassis_uuid = UUID of the chassis that this node belongs to driver = Driver used to control the node [REQUIRED] driver_info = Key/value pairs used by the driver, such as out-of-band management credentials. Can be
specified multiple times
extra = Record arbitrary key/value metadata. Can be specified multiple times uuid = Unique UUID for the node properties = Key/value pairs describing the physical characteristics of the node. This is exported to
Nova and used by the scheduler. Can be specified multiple times
# File lib/fog/baremetal/openstack/requests/create_node.rb, line 16 def create_node(attributes) desired_options = [ :chassis_uuid, :driver, :driver_info, :extra, :uuid, :properties ] # Filter only allowed creation attributes data = attributes.select { |key, _value| desired_options.include?(key.to_sym) } request( :body => Fog::JSON.encode(data), :expects => [200, 201], :method => 'POST', :path => 'nodes' ) end
Create a new port
address = MAC Address for this port extra = Record arbitrary key/value metadata. Can be specified multiple times node_uuid = UUID of the node that this port belongs to
# File lib/fog/baremetal/openstack/requests/create_port.rb, line 11 def create_port(attributes) desired_options = [ :address, :extra, :node_uuid ] # Filter only allowed creation attributes data = attributes.select { |key, _value| desired_options.include?(key.to_sym) } request( :body => Fog::JSON.encode(data), :expects => [200, 201], :method => 'POST', :path => 'ports' ) end
# File lib/fog/baremetal/openstack/requests/delete_chassis.rb, line 5 def delete_chassis(chassis_uuid) data = {:chassis_uuid => chassis_uuid} request( :body => Fog::JSON.encode(data), :expects => [200, 204], :method => 'DELETE', :path => 'chassis' ) end
# File lib/fog/baremetal/openstack/requests/delete_node.rb, line 5 def delete_node(node_uuid) data = {:node_ident => node_uuid} request( :body => Fog::JSON.encode(data), :expects => [200, 204], :method => 'DELETE', :path => 'nodes' ) end
# File lib/fog/baremetal/openstack/requests/delete_port.rb, line 5 def delete_port(port_uuid) data = {:port_uuid => port_uuid} request( :body => Fog::JSON.encode(data), :expects => [200, 204], :method => 'DELETE', :path => 'ports' ) end
# File lib/fog/baremetal/openstack/requests/get_chassis.rb, line 5 def get_chassis(chassis_uuid) request( :expects => [200, 204], :method => 'GET', :path => "chassis/#{chassis_uuid}" ) end
# File lib/fog/baremetal/openstack/requests/get_driver.rb, line 5 def get_driver(driver_name) request( :expects => [200, 204], :method => 'GET', :path => "drivers/#{driver_name}" ) end
# File lib/fog/baremetal/openstack/requests/get_driver_properties.rb, line 5 def get_driver_properties(driver_name) data = {:driver_name => driver_name} request( :body => Fog::JSON.encode(data), :expects => [200, 204], :method => 'GET', :path => "drivers/properties" ) end
# File lib/fog/baremetal/openstack/requests/get_node.rb, line 5 def get_node(node_id) request( :expects => [200, 204], :method => 'GET', :path => "nodes/#{node_id}" ) end
# File lib/fog/baremetal/openstack/requests/get_port.rb, line 5 def get_port(port_id) request( :expects => [200, 204], :method => 'GET', :path => "ports/#{port_id}" ) end
# File lib/fog/baremetal/openstack/requests/list_chassis.rb, line 5 def list_chassis(options = {}) request( :expects => [200, 204], :method => 'GET', :path => 'chassis', :query => options ) end
# File lib/fog/baremetal/openstack/requests/list_chassis_detailed.rb, line 5 def list_chassis_detailed(options = {}) request( :expects => [200, 204], :method => 'GET', :path => 'chassis/detail', :query => options ) end
# File lib/fog/baremetal/openstack/requests/list_drivers.rb, line 5 def list_drivers(options = {}) request( :expects => [200, 204], :method => 'GET', :path => 'drivers', :query => options ) end
# File lib/fog/baremetal/openstack/requests/list_nodes.rb, line 5 def list_nodes(options = {}) request( :expects => [200, 204], :method => 'GET', :path => 'nodes', :query => options ) end
# File lib/fog/baremetal/openstack/requests/list_nodes_detailed.rb, line 5 def list_nodes_detailed(options = {}) request( :expects => [200, 204], :method => 'GET', :path => 'nodes/detail', :query => options ) end
# File lib/fog/baremetal/openstack/requests/list_ports.rb, line 5 def list_ports(options = {}) request( :expects => [200, 204], :method => 'GET', :path => 'ports', :query => options ) end
# File lib/fog/baremetal/openstack/requests/list_ports_detailed.rb, line 5 def list_ports_detailed(options = {}) request( :expects => [200, 204], :method => 'GET', :path => 'ports/detail', :query => options ) end
Patch a chassis
parameter example:
op = Operations: 'add', 'replace' or 'remove' path = Attributes to add/replace or remove (only PATH is necessary on remove),
e.g. /extra/placement
value = Value to set
# File lib/fog/baremetal/openstack/requests/patch_chassis.rb, line 15 def patch_chassis(chassis_uuid, patch) request( :body => Fog::JSON.encode(patch), :expects => 200, :method => 'PATCH', :path => "chassis/#{chassis_uuid}" ) end
Patch a node
parameter example:
op = Operations: 'add', 'replace' or 'remove' path = Attributes to add/replace or remove (only PATH is necessary on remove),
e.g. /driver_info/ipmi_address
value = Value to set
# File lib/fog/baremetal/openstack/requests/patch_node.rb, line 15 def patch_node(node_uuid, patch) request( :body => Fog::JSON.encode(patch), :expects => 200, :method => 'PATCH', :path => "nodes/#{node_uuid}" ) end
Patch a port
parameter example:
op = Operations: 'add', 'replace' or 'remove' path = Attributes to add/replace or remove (only PATH is necessary on remove),
e.g. /driver_info/ipmi_address
value = Value to set
# File lib/fog/baremetal/openstack/requests/patch_port.rb, line 15 def patch_port(port_uuid, patch) request( :body => Fog::JSON.encode(patch), :expects => 200, :method => 'PATCH', :path => "ports/#{port_uuid}" ) end
# File lib/fog/baremetal/openstack/requests/set_node_maintenance.rb, line 5 def set_node_maintenance(node_uuid, parameters = nil) request( :expects => [200, 202, 204], :method => 'PUT', :path => "nodes/#{node_uuid}/maintenance", :query => parameters ) end
# File lib/fog/baremetal/openstack/requests/set_node_power_state.rb, line 5 def set_node_power_state(node_id, power_state) data = { 'target' => power_state } request( :body => Fog::JSON.encode(data), :expects => 202, :method => 'PUT', :path => "nodes/#{node_id}/states/power" ) end
# File lib/fog/baremetal/openstack/requests/set_node_provision_state.rb, line 5 def set_node_provision_state(node_id, provision_state) data = { 'target' => provision_state } request( :body => Fog::JSON.encode(data), :expects => 202, :method => 'PUT', :path => "nodes/#{node_id}/states/provision", :headers => { :'X-OpenStack-Ironic-API-Version' => 'latest' } ) end
# File lib/fog/baremetal/openstack/requests/unset_node_maintenance.rb, line 5 def unset_node_maintenance(node_uuid, parameters = nil) request( :expects => [200, 202, 204], :method => 'DELETE', :path => "nodes/#{node_uuid}/maintenance", :query => parameters ) end
# File lib/fog/baremetal/openstack.rb, line 273 def set_api_path unless @path.match(SUPPORTED_VERSIONS) @path = "/" + Fog::OpenStack.get_supported_version(SUPPORTED_VERSIONS, @openstack_management_uri, @auth_token, @connection_options) end end