Class: OvirtSDK4::StorageService

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

Instance Method Summary (collapse)

Instance Method Details

- (HostStorage) get(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:



18627
18628
18629
18630
18631
18632
18633
18634
18635
18636
18637
18638
18639
18640
18641
18642
18643
18644
18645
18646
18647
# File 'lib/ovirtsdk4/services.rb', line 18627

def get(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_one(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.

Raises:

  • (Error)


18656
18657
18658
18659
18660
18661
# File 'lib/ovirtsdk4/services.rb', line 18656

def service(path)
  if path.nil? || path == ''
    return self
  end
  raise Error.new("The path \"#{path}\" doesn't correspond to any service")
end

- (String) to_s

Returns an string representation of this service.

Returns:

  • (String)


18668
18669
18670
# File 'lib/ovirtsdk4/services.rb', line 18668

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