Class: OvirtSDK4::DataCenterService
- Defined in:
- lib/ovirtsdk4/services.rb,
lib/ovirtsdk4/services.rb
Instance Method Summary collapse
-
#clean_finished_tasks(opts = {}) ⇒ Object
Currently, the storage pool manager (SPM) fails to switch to another host if the SPM has uncleared tasks.
-
#clusters_service ⇒ ClustersService
Locates the
clustersservice. -
#get(opts = {}) ⇒ DataCenter
Get a data center.
-
#iscsi_bonds_service ⇒ IscsiBondsService
Reference to the iSCSI bonds service.
-
#networks_service ⇒ DataCenterNetworksService
Returns a reference to the service, that manages the networks, that are associated with the data center.
-
#permissions_service ⇒ AssignedPermissionsService
Reference to the permissions service.
-
#qoss_service ⇒ QossService
Reference to the QOSs service.
-
#quotas_service ⇒ QuotasService
Reference to the quotas service.
-
#remove(opts = {}) ⇒ Object
Removes the data center.
-
#service(path) ⇒ Service
Locates the service corresponding to the given path.
-
#set_master(opts = {}) ⇒ Object
Used for manually setting a storage domain in the data center as a master.
-
#storage_domains_service ⇒ AttachedStorageDomainsService
Attach and detach storage domains to and from a data center.
-
#update(data_center, opts = {}) ⇒ DataCenter
Updates the data center.
Methods inherited from Service
Instance Method Details
#clean_finished_tasks(opts = {}) ⇒ Object
Currently, the storage pool manager (SPM) fails to switch to another host if the SPM has uncleared tasks. Clearing all finished tasks enables the SPM switching.
For example, to clean all the finished tasks on a data center with ID 123 send a request like this:
POST /ovirt-engine/api/datacenters/123/cleanfinishedtasks HTTP/1.1
With a request body like this:
<action/>
6273 6274 6275 |
# File 'lib/ovirtsdk4/services.rb', line 6273 def clean_finished_tasks(opts = {}) internal_action(:cleanfinishedtasks, nil, CLEAN_FINISHED_TASKS, opts) end |
#clusters_service ⇒ ClustersService
Locates the clusters service.
6481 6482 6483 |
# File 'lib/ovirtsdk4/services.rb', line 6481 def clusters_service @clusters_service ||= ClustersService.new(self, 'clusters') end |
#get(opts = {}) ⇒ DataCenter
Get a data center.
An example of getting a data center:
GET /ovirt-engine/api/datacenters/123 HTTP/1.1
<data_center href="/ovirt-engine/api/datacenters/123" id="123">
<name>Default</name>
<description>The default Data Center</description>
<link href="/ovirt-engine/api/datacenters/123/clusters" rel="clusters"/>
<link href="/ovirt-engine/api/datacenters/123/storagedomains" rel="storagedomains"/>
<link href="/ovirt-engine/api/datacenters/123/permissions" rel="permissions"/>
<link href="/ovirt-engine/api/datacenters/123/networks" rel="networks"/>
<link href="/ovirt-engine/api/datacenters/123/quotas" rel="quotas"/>
<link href="/ovirt-engine/api/datacenters/123/qoss" rel="qoss"/>
<link href="/ovirt-engine/api/datacenters/123/iscsibonds" rel="iscsibonds"/>
<local>false</local>
<quota_mode>disabled</quota_mode>
<status>up</status>
<storage_format>v3</storage_format>
<supported_versions>
<version>
<major>4</major>
<minor>0</minor>
</version>
</supported_versions>
<version>
<major>4</major>
<minor>0</minor>
</version>
<mac_pool href="/ovirt-engine/api/macpools/456" id="456"/>
</data_center>
6340 6341 6342 |
# File 'lib/ovirtsdk4/services.rb', line 6340 def get(opts = {}) internal_get(GET, opts) end |
#iscsi_bonds_service ⇒ IscsiBondsService
Reference to the iSCSI bonds service.
6490 6491 6492 |
# File 'lib/ovirtsdk4/services.rb', line 6490 def iscsi_bonds_service @iscsi_bonds_service ||= IscsiBondsService.new(self, 'iscsibonds') end |
#networks_service ⇒ DataCenterNetworksService
Returns a reference to the service, that manages the networks, that are associated with the data center.
6499 6500 6501 |
# File 'lib/ovirtsdk4/services.rb', line 6499 def networks_service @networks_service ||= DataCenterNetworksService.new(self, 'networks') end |
#permissions_service ⇒ AssignedPermissionsService
Reference to the permissions service.
6508 6509 6510 |
# File 'lib/ovirtsdk4/services.rb', line 6508 def @permissions_service ||= AssignedPermissionsService.new(self, 'permissions') end |
#qoss_service ⇒ QossService
Reference to the QOSs service.
6517 6518 6519 |
# File 'lib/ovirtsdk4/services.rb', line 6517 def qoss_service @qoss_service ||= QossService.new(self, 'qoss') end |
#quotas_service ⇒ QuotasService
Reference to the quotas service.
6526 6527 6528 |
# File 'lib/ovirtsdk4/services.rb', line 6526 def quotas_service @quotas_service ||= QuotasService.new(self, 'quotas') end |
#remove(opts = {}) ⇒ Object
Removes the data center.
DELETE /ovirt-engine/api/datacenters/123 HTTP/1.1
Without any special parameters, the storage domains attached to the data center are detached and then removed from the storage. If something fails when performing this operation, for example if there is no host available to remove the storage domains from the storage, the complete operation will fail.
If the force parameter is true then the operation will always succeed, even if something fails while removing
one storage domain, for example. The failure is just ignored and the data center is removed from the database
anyway.
6382 6383 6384 |
# File 'lib/ovirtsdk4/services.rb', line 6382 def remove(opts = {}) internal_remove(REMOVE, opts) end |
#service(path) ⇒ Service
Locates the service corresponding to the given path.
6566 6567 6568 6569 6570 6571 6572 6573 6574 6575 6576 6577 6578 6579 6580 6581 6582 6583 6584 6585 6586 6587 6588 6589 6590 6591 6592 6593 6594 6595 6596 6597 6598 6599 6600 6601 6602 6603 6604 6605 6606 6607 6608 6609 6610 6611 6612 6613 |
# File 'lib/ovirtsdk4/services.rb', line 6566 def service(path) if path.nil? || path == '' return self end if path == 'clusters' return clusters_service end if path.start_with?('clusters/') return clusters_service.service(path[9..-1]) end if path == 'iscsibonds' return iscsi_bonds_service end if path.start_with?('iscsibonds/') return iscsi_bonds_service.service(path[11..-1]) end if path == 'networks' return networks_service end if path.start_with?('networks/') return networks_service.service(path[9..-1]) end if path == 'permissions' return end if path.start_with?('permissions/') return .service(path[12..-1]) end if path == 'qoss' return qoss_service end if path.start_with?('qoss/') return qoss_service.service(path[5..-1]) end if path == 'quotas' return quotas_service end if path.start_with?('quotas/') return quotas_service.service(path[7..-1]) end if path == 'storagedomains' return storage_domains_service end if path.start_with?('storagedomains/') return storage_domains_service.service(path[15..-1]) end raise Error.new("The path \"#{path}\" doesn't correspond to any service") end |
#set_master(opts = {}) ⇒ Object
Used for manually setting a storage domain in the data center as a master. For example, for setting a storage domain with ID '456' as a master on a data center with ID '123', send a request like this:
POST /ovirt-engine/api/datacenters/123/setmaster HTTP/1.1
With a request body like this:
<action>
<storage_domain id="456"/>
</action>
The new master storage domain can be also specified by its name.
6427 6428 6429 |
# File 'lib/ovirtsdk4/services.rb', line 6427 def set_master(opts = {}) internal_action(:setmaster, nil, SET_MASTER, opts) end |
#storage_domains_service ⇒ AttachedStorageDomainsService
Attach and detach storage domains to and from a data center.
For attaching a single storage domain we should use the following POST request:
POST /ovirt-engine/api/datacenters/123/storagedomains HTTP/1.1
With a request body like this:
<storage_domain>
<name>data1</name>
</storage_domain>
For detaching a single storage domain we should use the following DELETE request:
DELETE /ovirt-engine/api/datacenters/123/storagedomains/123 HTTP/1.1
6555 6556 6557 |
# File 'lib/ovirtsdk4/services.rb', line 6555 def storage_domains_service @storage_domains_service ||= AttachedStorageDomainsService.new(self, 'storagedomains') end |
#update(data_center, opts = {}) ⇒ DataCenter
Updates the data center.
The name, description, storage_type, version, storage_format and mac_pool elements are updatable
post-creation. For example, to change the name and description of data center 123 send a request like this:
PUT /ovirt-engine/api/datacenters/123 HTTP/1.1
With a request body like this:
<data_center>
<name>myupdatedname</name>
<description>An updated description for the data center</description>
</data_center>
6472 6473 6474 |
# File 'lib/ovirtsdk4/services.rb', line 6472 def update(data_center, opts = {}) internal_update(data_center, DataCenter, UPDATE, opts) end |