Class: OvirtSDK4::StorageDomainService

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

#disk_profiles_serviceAssignedDiskProfilesService

Locates the disk_profiles service.

Returns:



22650
22651
22652
# File 'lib/ovirtsdk4/services.rb', line 22650

def disk_profiles_service
  @disk_profiles_service ||= AssignedDiskProfilesService.new(self, 'diskprofiles')
end

#disk_snapshots_serviceDiskSnapshotsService

Locates the disk_snapshots service.

Returns:



22659
22660
22661
# File 'lib/ovirtsdk4/services.rb', line 22659

def disk_snapshots_service
  @disk_snapshots_service ||= DiskSnapshotsService.new(self, 'disksnapshots')
end

#disks_serviceStorageDomainDisksService

Reference to the service that manages the disks available in the storage domain.

Returns:



22668
22669
22670
# File 'lib/ovirtsdk4/services.rb', line 22668

def disks_service
  @disks_service ||= StorageDomainDisksService.new(self, 'disks')
end

#files_serviceFilesService

Returns a reference to the service that manages the files available in the storage domain.

Returns:



22677
22678
22679
# File 'lib/ovirtsdk4/services.rb', line 22677

def files_service
  @files_service ||= FilesService.new(self, 'files')
end

#get(opts = {}) ⇒ StorageDomain

Retrieves the description of the storage domain.

Parameters:

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

    Additional options.

Options Hash (opts):

  • :filter (Boolean)

    Indicates if the results should be filtered according to the permissions of the user.

  • :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.

  • :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:



22342
22343
22344
# File 'lib/ovirtsdk4/services.rb', line 22342

def get(opts = {})
  internal_get(GET, opts)
end

#images_serviceImagesService

Locates the images service.

Returns:



22686
22687
22688
# File 'lib/ovirtsdk4/services.rb', line 22686

def images_service
  @images_service ||= ImagesService.new(self, 'images')
end

#is_attached(opts = {}) ⇒ Object

Used for querying if the storage domain is already attached to a data center using the is_attached boolean field, which is part of the storage server. IMPORTANT: Executing this API will cause the host to disconnect from the storage domain.

Parameters:

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

    Additional options.

Options Hash (opts):

  • :async (Boolean)

    Indicates if the action should be performed asynchronously.

  • :host (Host)

    Indicates the data center’s host.

  • :is_attached (Boolean)

    Indicates whether the storage domain is attached to the data center.

  • :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.



22375
22376
22377
# File 'lib/ovirtsdk4/services.rb', line 22375

def is_attached(opts = {})
  internal_action(:isattached, :is_attached, IS_ATTACHED, opts)
end

#permissions_serviceAssignedPermissionsService

Locates the permissions service.

Returns:



22695
22696
22697
# File 'lib/ovirtsdk4/services.rb', line 22695

def permissions_service
  @permissions_service ||= AssignedPermissionsService.new(self, 'permissions')
end

#reduce_luns(opts = {}) ⇒ Object

This operation reduces logical units from the storage domain.

In order to do so the data stored on the provided logical units will be moved to other logical units of the storage domain and only then they will be reduced from the storage domain.

For example, in order to reduce two logical units from a storage domain send a request like this:

POST /ovirt-engine/api/storageDomains/123/reduceluns

With a request body like this:

 <action>
   <logical_units>
     <logical_unit id="1IET_00010001"/>
     <logical_unit id="1IET_00010002"/>
   </logical_units>
 </action>
Note that this operation is only applicable to block storage domains (i.e., storage domains with the
xref:types-storage_type[storage type] of iSCSI or FCP).

Parameters:

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

    Additional options.

Options Hash (opts):

  • :logical_units (Array<LogicalUnit>)

    The logical units that need to be reduced from the storage domain.

  • :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.



22426
22427
22428
# File 'lib/ovirtsdk4/services.rb', line 22426

def reduce_luns(opts = {})
  internal_action(:reduceluns, nil, REDUCE_LUNS, opts)
end

#refresh_luns(opts = {}) ⇒ Object

This operation refreshes the LUN size.

After increasing the size of the underlying LUN on the storage server, the user can refresh the LUN size. This action forces a rescan of the provided LUNs and updates the database with the new size, if required.

For example, in order to refresh the size of two LUNs send a request like this:

POST /ovirt-engine/api/storageDomains/262b056b-aede-40f1-9666-b883eff59d40/refreshluns

With a request body like this:

 <action>
   <logical_units>
     <logical_unit id="1IET_00010001"/>
     <logical_unit id="1IET_00010002"/>
   </logical_units>
 </action>

Parameters:

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

    Additional options.

Options Hash (opts):

  • :async (Boolean)

    Indicates if the refresh should be performed asynchronously.

  • :logical_units (Array<LogicalUnit>)

    The LUNs that need to be refreshed.

  • :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.



22479
22480
22481
# File 'lib/ovirtsdk4/services.rb', line 22479

def refresh_luns(opts = {})
  internal_action(:refreshluns, nil, REFRESH_LUNS, opts)
end

#remove(opts = {}) ⇒ Object

Removes the storage domain.

Without any special parameters, the storage domain is detached from the system and removed from the database. The storage domain can then be imported to the same or to a different setup, with all the data on it. If the storage is not accessible the operation will fail.

If the destroy parameter is true then the operation will always succeed, even if the storage is not accessible, the failure is just ignored and the storage domain is removed from the database anyway.

If the format parameter is true then the actual storage is formatted, and the metadata is removed from the LUN or directory, so it can no longer be imported to the same or to a different setup.

Parameters:

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

    Additional options.

Options Hash (opts):

  • :async (Boolean)

    Indicates if the remove should be performed asynchronously.

  • :destroy (Boolean)

    Indicates if the operation should succeed, and the storage domain removed from the database, even if the storage is not accessible.

    DELETE /ovirt-engine/api/storageDomains/123?destroy=true

    This parameter is optional, and the default value is false. When the value of destroy is true the host parameter will be ignored.

  • :format (Boolean)

    Indicates if the actual storage should be formatted, removing all the metadata from the underlying LUN or directory:

    DELETE /ovirt-engine/api/storageDomains/123?format=true

    This parameter is optional, and the default value is false.

  • :host (String)

    Indicates which host should be used to remove the storage domain.

    This parameter is mandatory, except if the destroy parameter is included and its value is true, in that case the host parameter will be ignored.

    The value should contain the name or the identifier of the host. For example, to use the host named myhost to remove the storage domain with identifier 123 send a request like this:

    DELETE /ovirt-engine/api/storageDomains/123?host=myhost
  • :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.



22548
22549
22550
# File 'lib/ovirtsdk4/services.rb', line 22548

def remove(opts = {})
  internal_remove(REMOVE, 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.

Raises:



22733
22734
22735
22736
22737
22738
22739
22740
22741
22742
22743
22744
22745
22746
22747
22748
22749
22750
22751
22752
22753
22754
22755
22756
22757
22758
22759
22760
22761
22762
22763
22764
22765
22766
22767
22768
22769
22770
22771
22772
22773
22774
22775
22776
22777
22778
22779
22780
22781
22782
22783
22784
22785
22786
22787
22788
22789
22790
22791
22792
# File 'lib/ovirtsdk4/services.rb', line 22733

def service(path)
  if path.nil? || path == ''
    return self
  end
  if path == 'diskprofiles'
    return disk_profiles_service
  end
  if path.start_with?('diskprofiles/')
    return disk_profiles_service.service(path[13..-1])
  end
  if path == 'disksnapshots'
    return disk_snapshots_service
  end
  if path.start_with?('disksnapshots/')
    return disk_snapshots_service.service(path[14..-1])
  end
  if path == 'disks'
    return disks_service
  end
  if path.start_with?('disks/')
    return disks_service.service(path[6..-1])
  end
  if path == 'files'
    return files_service
  end
  if path.start_with?('files/')
    return files_service.service(path[6..-1])
  end
  if path == 'images'
    return images_service
  end
  if path.start_with?('images/')
    return images_service.service(path[7..-1])
  end
  if path == 'permissions'
    return permissions_service
  end
  if path.start_with?('permissions/')
    return permissions_service.service(path[12..-1])
  end
  if path == 'storageconnections'
    return storage_connections_service
  end
  if path.start_with?('storageconnections/')
    return storage_connections_service.service(path[19..-1])
  end
  if path == 'templates'
    return templates_service
  end
  if path.start_with?('templates/')
    return templates_service.service(path[10..-1])
  end
  if path == 'vms'
    return vms_service
  end
  if path.start_with?('vms/')
    return vms_service.service(path[4..-1])
  end
  raise Error.new("The path \"#{path}\" doesn't correspond to any service")
end

#storage_connections_serviceStorageDomainServerConnectionsService

Returns a reference to the service that manages the storage connections.

Returns:



22704
22705
22706
# File 'lib/ovirtsdk4/services.rb', line 22704

def storage_connections_service
  @storage_connections_service ||= StorageDomainServerConnectionsService.new(self, 'storageconnections')
end

#templates_serviceStorageDomainTemplatesService

Locates the templates service.

Returns:



22713
22714
22715
# File 'lib/ovirtsdk4/services.rb', line 22713

def templates_service
  @templates_service ||= StorageDomainTemplatesService.new(self, 'templates')
end

#update(storage_domain, opts = {}) ⇒ StorageDomain

Updates a storage domain.

Not all of the StorageDomain's attributes are updatable after creation. Those that can be updated are: name, description, comment, warning_low_space_indicator, critical_space_action_blocker and wipe_after_delete. (Note that changing the wipe_after_delete attribute will not change the wipe after delete property of disks that already exist).

To update the name and wipe_after_delete attributes of a storage domain with an identifier 123, send a request as follows:

PUT /ovirt-engine/api/storageDomains/123

With a request body as follows:

<storage_domain>
  <name>data2</name>
  <wipe_after_delete>true</wipe_after_delete>
</storage_domain>

Parameters:

  • storage_domain (StorageDomain)

    The updated storage domain.

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

    Additional options.

Options Hash (opts):

  • :async (Boolean)

    Indicates if the update should be performed asynchronously.

  • :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:



22600
22601
22602
# File 'lib/ovirtsdk4/services.rb', line 22600

def update(storage_domain, opts = {})
  internal_update(storage_domain, StorageDomain, UPDATE, opts)
end

#update_ovf_store(opts = {}) ⇒ Object

This operation forces the update of the OVF_STORE of this storage domain.

The OVF_STORE is a disk image that contains the metadata of virtual machines and disks that reside in the storage domain. This metadata is used in case the domain is imported or exported to or from a different data center or a different installation.

By default the OVF_STORE is updated periodically (set by default to 60 minutes) but users might want to force an update after an important change, or when the they believe the OVF_STORE is corrupt.

When initiated by the user, OVF_STORE update will be performed whether an update is needed or not.

Parameters:

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

    Additional options.

Options Hash (opts):

  • :async (Boolean)

    Indicates if the OVF_STORE update should be performed asynchronously.

  • :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.



22641
22642
22643
# File 'lib/ovirtsdk4/services.rb', line 22641

def update_ovf_store(opts = {})
  internal_action(:updateovfstore, nil, UPDATE_OVF_STORE, opts)
end

#vms_serviceStorageDomainVmsService

Locates the vms service.

Returns:



22722
22723
22724
# File 'lib/ovirtsdk4/services.rb', line 22722

def vms_service
  @vms_service ||= StorageDomainVmsService.new(self, 'vms')
end