Class: OvirtSDK4::HostStorageService

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

Instance Method Summary collapse

Methods inherited from Service

#inspect, #to_s

Instance Method Details

#list(opts = {}) ⇒ Array<HostStorage>

Get list of storages.

GET /ovirt-engine/api/hosts/123/storage

The XML response you get will be like this one:

<host_storages>
  <host_storage id="123">
    ...
  </host_storage>
  ...
</host_storages>

The order of the returned list of storages isn’t guaranteed.

Parameters:

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

    Additional options.

Options Hash (opts):

  • :follow (String)

    Indicates which inner links should be followed. The objects referenced by these links will be fetched as part of the current request. See here for details.

  • :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="123">
      <logical_units>
        <logical_unit id="123">
          <lun_mapping>0</lun_mapping>
          <paths>1</paths>
          <product_id>lun0</product_id>
          <serial>123</serial>
          <size>10737418240</size>
          <status>used</status>
          <vendor_id>LIO-ORG</vendor_id>
          <volume_group_id>123</volume_group_id>
        </logical_unit>
      </logical_units>
      <type>iscsi</type>
      <host id="123"/>
    </host_storage>

    Here an example without the LUN status :

    <host_storage id="123">
      <logical_units>
        <logical_unit id="123">
          <lun_mapping>0</lun_mapping>
          <paths>1</paths>
          <product_id>lun0</product_id>
          <serial>123</serial>
          <size>10737418240</size>
          <vendor_id>LIO-ORG</vendor_id>
          <volume_group_id>123</volume_group_id>
        </logical_unit>
      </logical_units>
      <type>iscsi</type>
      <host id="123"/>
    </host_storage>
  • :headers (Hash) — default: {}

    Additional HTTP headers.

  • :query (Hash) — default: {}

    Additional URL query parameters.

  • :timeout (Integer) — default: nil

    The timeout for this request, in seconds. If no value is explicitly given then the timeout set globally for the connection will be used.

  • :wait (Boolean) — default: true

    If true wait for the response.

Returns:



12630
12631
12632
# File 'lib/ovirtsdk4/services.rb', line 12630

def list(opts = {})
  internal_get(LIST, opts)
end

#service(path) ⇒ Service

Locates the service corresponding to the given path.

Parameters:

  • path (String)

    The path of the service.

Returns:

  • (Service)

    A reference to the service.



12652
12653
12654
12655
12656
12657
12658
12659
12660
12661
# File 'lib/ovirtsdk4/services.rb', line 12652

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

#storage_service(id) ⇒ StorageService

Reference to a service managing the storage.

Parameters:

  • id (String)

    The identifier of the storage.

Returns:



12641
12642
12643
# File 'lib/ovirtsdk4/services.rb', line 12641

def storage_service(id)
  StorageService.new(self, id)
end