Class: XClarityClient::NodeManagement

Inherits:
Services::XClarityService show all
Includes:
Services::PowerActionSenderMixin
Defined in:
lib/xclarity_client/services/node_management.rb

Overview

Node Management class

Instance Method Summary collapse

Methods included from Services::PowerActionSenderMixin

#send_led_state_request, #send_power_request, #set_loc_led_state, #set_power_state

Methods inherited from Services::XClarityService

#fetch_all, #get_headers_with_opts, #get_object, #get_object_with_id, #get_object_with_opts, #initialize

Methods included from Services::ResponseBuilderMixin

#build_response_with_resource_list

Methods included from Services::ListNameInterpreterMixin

#add_listname_on_body

Constructor Details

This class inherits a constructor from XClarityClient::Services::XClarityService

Instance Method Details

#disable_media_mount_support(uuid) ⇒ Object



35
36
37
38
39
# File 'lib/xclarity_client/services/node_management.rb', line 35

def disable_media_mount_support(uuid)
  uri = Node::BASE_URI + "/#{uuid}/" + 'mediaMount'
  req_body = JSON.generate(:action => 'disableMountMedia')
  @connection.do_put(uri, req_body)
end

#enable_media_mount_support(uuid) ⇒ Object



29
30
31
32
33
# File 'lib/xclarity_client/services/node_management.rb', line 29

def enable_media_mount_support(uuid)
  uri = Node::BASE_URI + "/#{uuid}/" + 'mediaMount'
  req_body = JSON.generate(:action => 'enableMountMedia')
  @connection.do_put(uri, req_body)
end

#mount_media(uuid, opts) ⇒ Object



47
48
49
50
51
52
# File 'lib/xclarity_client/services/node_management.rb', line 47

def mount_media(uuid, opts)
  uri = Node::BASE_URI + "/#{uuid}/" + 'mediaMount'
  opts[:action] = 'mount'
  req_body = JSON.generate(opts)
  @connection.do_put(uri, req_body)
end

#remove_all_mounted_medias(uuid) ⇒ Object



41
42
43
44
45
# File 'lib/xclarity_client/services/node_management.rb', line 41

def remove_all_mounted_medias(uuid)
  uri = Node::BASE_URI + "/#{uuid}/" + 'mediaMount'
  req_body = JSON.generate(:action => 'reset')
  @connection.do_put(uri, req_body)
end

#retrieve_mounted_media_details(uuid) ⇒ Object



24
25
26
27
# File 'lib/xclarity_client/services/node_management.rb', line 24

def retrieve_mounted_media_details(uuid)
  uri = Node::BASE_URI + "/#{uuid}/" + 'mediaMount'
  @connection.do_get(uri)
end

#set_bmc_power_state(uuid, requested_state = nil) ⇒ Object



13
14
15
16
17
18
19
20
21
22
# File 'lib/xclarity_client/services/node_management.rb', line 13

def set_bmc_power_state(uuid, requested_state = nil)
  if [uuid, requested_state].any? { |item| item.nil? }
    error = 'Invalid target or power state requested'
    source = 'XClarity::NodeManagement set_bmc_power_state'
    $lxca_log.info source, error
    raise ArgumentError, error
  end

  send_power_request(managed_resource::BASE_URI + '/' + uuid + '/bmc', requested_state)
end

#unmount_media_thinkserver(uuid, media_type) ⇒ Object



54
55
56
57
58
59
60
# File 'lib/xclarity_client/services/node_management.rb', line 54

def unmount_media_thinkserver(uuid, media_type)
  uri = Node::BASE_URI + "/#{uuid}/" + 'mediaMount'
  opts = { :action    => 'unmount',
           :mediaType => media_type }
  req_body = JSON.generate(opts)
  @connection.do_put(uri, req_body)
end

#unmount_media_thinksystem(uuid, media_uid) ⇒ Object



62
63
64
65
66
67
68
# File 'lib/xclarity_client/services/node_management.rb', line 62

def unmount_media_thinksystem(uuid, media_uid)
  uri = Node::BASE_URI + "/#{uuid}/" + 'mediaMount'
  opts = { :action => 'unmount',
           :UID    => media_uid }
  req_body = JSON.generate(opts)
  @connection.do_put(uri, req_body)
end