Class: OvirtSDK4::HostStorageService

Inherits:
Service
  • Object
show all
Defined in:
lib/ovirtsdk4/services.rb,
lib/ovirtsdk4/services.rb

Instance Method Summary (collapse)

Instance Method Details

- (Array<HostStorage>) list(opts = {})

Returns the representation of the object managed by this service.

Parameters:

  • opts (Hash) (defaults to: {})

    Additional options.

Options Hash (opts):

  • :report_status (Boolean)

    Indicates if the status of the LUNs in the storage should be checked. Checking the status of the LUN is an heavy weight operation and this data is not always needed by the user. This parameter will give the option to not perform the status check of the LUNs.

    The default is true for backward compatibility.

    Here an example with the LUN status :

    <host_storage id="360014051136c20574f743bdbd28177fd">
      <logical_units>
        <logical_unit id="360014051136c20574f743bdbd28177fd">
          <lun_mapping>0</lun_mapping>
          <paths>1</paths>
          <product_id>lun0</product_id>
          <serial>SLIO-ORG_lun0_1136c205-74f7-43bd-bd28-177fd5ce6993</serial>
          <size>10737418240</size>
          <status>used</status>
          <vendor_id>LIO-ORG</vendor_id>
          <volume_group_id>O9Du7I-RahN-ECe1-dZ1w-nh0b-64io-MNzIBZ</volume_group_id>
        </logical_unit>
      </logical_units>
      <type>iscsi</type>
      <host id="8bb5ade5-e988-4000-8b93-dbfc6717fe50"/>
    </host_storage>

    Here an example without the LUN status :

    <host_storage id="360014051136c20574f743bdbd28177fd">
      <logical_units>
        <logical_unit id="360014051136c20574f743bdbd28177fd">
          <lun_mapping>0</lun_mapping>
          <paths>1</paths>
          <product_id>lun0</product_id>
          <serial>SLIO-ORG_lun0_1136c205-74f7-43bd-bd28-177fd5ce6993</serial>
          <size>10737418240</size>
          <vendor_id>LIO-ORG</vendor_id>
          <volume_group_id>O9Du7I-RahN-ECe1-dZ1w-nh0b-64io-MNzIBZ</volume_group_id>
        </logical_unit>
      </logical_units>
      <type>iscsi</type>
      <host id="8bb5ade5-e988-4000-8b93-dbfc6717fe50"/>
    </host_storage>

Returns:



10029
10030
10031
10032
10033
10034
10035
10036
10037
10038
10039
10040
10041
10042
10043
10044
10045
10046
10047
10048
10049
# File 'lib/ovirtsdk4/services.rb', line 10029

def list(opts = {})
  query = {}
  value = opts[:report_status]
  unless value.nil?
    value = Writer.render_boolean(value)
    query['report_status'] = value
  end
  request = Request.new(:method => :GET, :path => @path, :query => query)
  response = @connection.send(request)
  case response.code
  when 200
    begin
      reader = XmlReader.new(response.body)
      return HostStorageReader.read_many(reader)
    ensure
      reader.close
    end
  else
    check_fault(response)
  end
end

- (Service) service(path)

Locates the service corresponding to the given path.

Parameters:

  • path (String)

    The path of the service.

Returns:

  • (Service)

    A reference to the service.



10069
10070
10071
10072
10073
10074
10075
10076
10077
10078
# File 'lib/ovirtsdk4/services.rb', line 10069

def service(path)
  if path.nil? || path == ''
    return self
  end
  index = path.index('/')
  if index.nil?
    return storage_service(path)
  end
  return storage_service(path[0..(index - 1)]).service(path[(index +1)..-1])
end

- (StorageService) storage_service(id)

Locates the storage service.

Parameters:

  • id (String)

    The identifier of the storage.

Returns:



10058
10059
10060
# File 'lib/ovirtsdk4/services.rb', line 10058

def storage_service(id)
  return StorageService.new(@connection, "#{@path}/#{id}")
end

- (String) to_s

Returns an string representation of this service.

Returns:

  • (String)


10085
10086
10087
# File 'lib/ovirtsdk4/services.rb', line 10085

def to_s
  return "#<#{HostStorageService}:#{@path}>"
end