class OvirtSDK4::DataCenterService

Constants

GET
REMOVE
UPDATE

Public Instance Methods

clusters_service() click to toggle source

Locates the `clusters` service.

@return [ClustersService] A reference to `clusters` service.

# File lib/ovirtsdk4/services.rb, line 4957
def clusters_service
  ClustersService.new(@connection, "#{@path}/clusters")
end
get(opts = {}) click to toggle source

Get a data center.

An example of getting a data center:

source

GET /ovirt-engine/api/datacenters/123


source,xml

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


@param opts [Hash] Additional options.

@option opts [Boolean] :filter Indicates if the results should be filtered according to the permissions of the user.

@option opts [Hash] :headers ({}) Additional HTTP headers.

@option opts [Hash] :query ({}) Additional URL query parameters.

@option opts [Integer] :timeout (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.

@option opts [Boolean] :wait (true) If `true` wait for the response.

@return [DataCenter]

# File lib/ovirtsdk4/services.rb, line 4858
def get(opts = {})
  internal_get(GET, opts)
end
iscsi_bonds_service() click to toggle source

Reference to the iSCSI bonds service.

@return [IscsiBondsService] A reference to `iscsi_bonds` service.

# File lib/ovirtsdk4/services.rb, line 4966
def iscsi_bonds_service
  IscsiBondsService.new(@connection, "#{@path}/iscsibonds")
end
networks_service() click to toggle source

Returns a reference to the service, that manages the networks, that are associated with the data center.

@return [DataCenterNetworksService] A reference to `networks` service.

# File lib/ovirtsdk4/services.rb, line 4975
def networks_service
  DataCenterNetworksService.new(@connection, "#{@path}/networks")
end
permissions_service() click to toggle source

Reference to the permissions service.

@return [AssignedPermissionsService] A reference to `permissions` service.

# File lib/ovirtsdk4/services.rb, line 4984
def permissions_service
  AssignedPermissionsService.new(@connection, "#{@path}/permissions")
end
qoss_service() click to toggle source

Reference to the QOSs service.

@return [QossService] A reference to `qoss` service.

# File lib/ovirtsdk4/services.rb, line 4993
def qoss_service
  QossService.new(@connection, "#{@path}/qoss")
end
quotas_service() click to toggle source

Reference to the quotas service.

@return [QuotasService] A reference to `quotas` service.

# File lib/ovirtsdk4/services.rb, line 5002
def quotas_service
  QuotasService.new(@connection, "#{@path}/quotas")
end
remove(opts = {}) click to toggle source

Removes the data center.

source

DELETE /ovirt-engine/api/datacenters/123


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.

@param opts [Hash] Additional options.

@option opts [Boolean] :async Indicates if the remove should be performed asynchronously. @option opts [Boolean] :force Indicates if the operation should succeed, and the storage domain removed from the database, even if

something fails during the operation.

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

@option opts [Hash] :headers ({}) Additional HTTP headers.

@option opts [Hash] :query ({}) Additional URL query parameters.

@option opts [Integer] :timeout (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.

@option opts [Boolean] :wait (true) If `true` wait for the response.

# File lib/ovirtsdk4/services.rb, line 4901
def remove(opts = {})
  internal_remove(REMOVE, opts)
end
service(path) click to toggle source

Locates the service corresponding to the given path.

@param path [String] The path of the service.

@return [Service] A reference to the service.

# File lib/ovirtsdk4/services.rb, line 5045
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 permissions_service
  end
  if path.start_with?('permissions/')
    return permissions_service.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
storage_domains_service() click to toggle source

Attach and detach storage domains to and from a data center.

For attaching a single storage domain we should use the following POST request:

source

POST /ovirt-engine/api/datacenters/123/storagedomains


With a request body like this:

source,xml

<storage_domain>

<name>data1</name>

</storage_domain>


For detaching a single storage domain we should use the following DELETE request:

source

DELETE /ovirt-engine/api/datacenters/123/storagedomains/123


@return [AttachedStorageDomainsService] A reference to `storage_domains` service.

# File lib/ovirtsdk4/services.rb, line 5034
def storage_domains_service
  AttachedStorageDomainsService.new(@connection, "#{@path}/storagedomains")
end
to_s() click to toggle source

Returns an string representation of this service.

@return [String]

# File lib/ovirtsdk4/services.rb, line 5099
def to_s
  "#<#{DataCenterService}:#{@path}>"
end
update(data_center, opts = {}) click to toggle source

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:

source

PUT /ovirt-engine/api/datacenters/123


With a request body like this:

source,xml

<data_center>

<name>myupdatedname</name>
<description>An updated description for the data center</description>

</data_center>


@param data_center [DataCenter] The data center that is being updated. @param opts [Hash] Additional options.

@option opts [Boolean] :async Indicates if the update should be performed asynchronously.

@option opts [Hash] :headers ({}) Additional HTTP headers.

@option opts [Hash] :query ({}) Additional URL query parameters.

@option opts [Integer] :timeout (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.

@option opts [Boolean] :wait (true) If `true` wait for the response.

@return [DataCenter]

# File lib/ovirtsdk4/services.rb, line 4948
def update(data_center, opts = {})
  internal_update(data_center, DataCenter, UPDATE, opts)
end