Class HostServiceImpl
- java.lang.Object
-
- org.ovirt.engine.sdk4.internal.services.ServiceImpl
-
- org.ovirt.engine.sdk4.internal.services.MeasurableServiceImpl
-
- org.ovirt.engine.sdk4.internal.services.HostServiceImpl
-
- All Implemented Interfaces:
Service
,HostService
,MeasurableService
public class HostServiceImpl extends MeasurableServiceImpl implements HostService
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.ovirt.engine.sdk4.services.HostService
HostService.ActivateRequest, HostService.ActivateResponse, HostService.ApproveRequest, HostService.ApproveResponse, HostService.ApproveUsingRootPasswordRequest, HostService.ApproveUsingRootPasswordResponse, HostService.ApproveUsingSshRequest, HostService.ApproveUsingSshResponse, HostService.CommitNetConfigRequest, HostService.CommitNetConfigResponse, HostService.CopyHostNetworksRequest, HostService.CopyHostNetworksResponse, HostService.DeactivateRequest, HostService.DeactivateResponse, HostService.DiscoverIscsiRequest, HostService.DiscoverIscsiResponse, HostService.EnrollCertificateRequest, HostService.EnrollCertificateResponse, HostService.FenceRequest, HostService.FenceResponse, HostService.ForceSelectSpmRequest, HostService.ForceSelectSpmResponse, HostService.GetRequest, HostService.GetResponse, HostService.InstallRequest, HostService.InstallResponse, HostService.InstallUsingRootPasswordRequest, HostService.InstallUsingRootPasswordResponse, HostService.InstallUsingSshRequest, HostService.InstallUsingSshResponse, HostService.IscsiDiscoverRequest, HostService.IscsiDiscoverResponse, HostService.IscsiLoginRequest, HostService.IscsiLoginResponse, HostService.RefreshRequest, HostService.RefreshResponse, HostService.RemoveRequest, HostService.RemoveResponse, HostService.SetupNetworksRequest, HostService.SetupNetworksResponse, HostService.SyncAllNetworksRequest, HostService.SyncAllNetworksResponse, HostService.UnregisteredStorageDomainsDiscoverRequest, HostService.UnregisteredStorageDomainsDiscoverResponse, HostService.UpdateRequest, HostService.UpdateResponse, HostService.UpdateUsingRootPasswordRequest, HostService.UpdateUsingRootPasswordResponse, HostService.UpdateUsingSshRequest, HostService.UpdateUsingSshResponse, HostService.UpgradeCheckRequest, HostService.UpgradeCheckResponse, HostService.UpgradeRequest, HostService.UpgradeResponse
-
-
Constructor Summary
Constructors Constructor Description HostServiceImpl(HttpConnection connection, String path)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description HostService.ActivateRequest
activate()
Activates the host for use, for example to run virtual machines.AssignedAffinityLabelsService
affinityLabelsService()
List of scheduling labels assigned to this host.HostService.ApproveRequest
approve()
Approve a pre-installed Hypervisor host for usage in the virtualization environment.HostService.ApproveUsingRootPasswordRequest
approveUsingRootPassword()
HostService.ApproveUsingSshRequest
approveUsingSsh()
Approve the specified host to be added to the engine by using ssh authentication.HostService.CommitNetConfigRequest
commitNetConfig()
Marks the network configuration as good and persists it inside the host.HostService.CopyHostNetworksRequest
copyHostNetworks()
Copy the network configuration of the specified host to current host.HostService.DeactivateRequest
deactivate()
Deactivates the host to perform maintenance tasks.HostDevicesService
devicesService()
A reference to the host devices service.HostService.DiscoverIscsiRequest
discoverIscsi()
Discovers iSCSI targets on the host, using the initiator details.HostService.EnrollCertificateRequest
enrollCertificate()
Enrolls the certificate of the host.ExternalNetworkProviderConfigurationsService
externalNetworkProviderConfigurationsService()
External network providers provisioned by the system on the host.HostService.FenceRequest
fence()
Controls the host's power management device.FenceAgentsService
fenceAgentsService()
A reference to the fence agents service.HostService.ForceSelectSpmRequest
forceSelectSpm()
To manually set a host as the storage pool manager (SPM).HostService.GetRequest
get()
Gets the host details.HostHooksService
hooksService()
A reference to the host hooks service.HostService.InstallRequest
install()
Installs the latest version of VDSM and related software on the host.HostService.InstallUsingRootPasswordRequest
installUsingRootPassword()
Install VDSM and other packages required to get the host ready to be used in the engine providing the root password.HostService.InstallUsingSshRequest
installUsingSsh()
Install VDSM and other packages required to get the host ready to be used in the engine providing the SSH password.HostService.IscsiDiscoverRequest
iscsiDiscover()
This method has been deprecated since Engine version 4.4.6.HostService.IscsiLoginRequest
iscsiLogin()
Login to iSCSI targets on the host, using the target details.KatelloErrataService
katelloErrataService()
A reference to the service that can show the applicable errata available on the host.NetworkAttachmentsService
networkAttachmentsService()
A reference to the network attachments service.HostNicsService
nicsService()
A reference to the service that manages the network interface devices on the host.HostNumaNodesService
numaNodesService()
A reference to the service that manage NUMA nodes for the host.AssignedPermissionsService
permissionsService()
A reference to the host permission service.HostService.RefreshRequest
refresh()
Refresh the host devices and capabilities.HostService.RemoveRequest
remove()
Remove the host from the system.Service
service(String path)
Service locator method, returns individual service on which the URI is dispatched.HostService.SetupNetworksRequest
setupNetworks()
This method is used to change the configuration of the network interfaces of a host.StatisticsService
statisticsService()
StorageServerConnectionExtensionsService
storageConnectionExtensionsService()
A reference to storage connection extensions.HostStorageService
storageService()
A reference to the service that manages the host's storage.HostService.SyncAllNetworksRequest
syncAllNetworks()
To synchronize all networks on the host, send a request like this: [source] ---- POST /ovirt-engine/api/hosts/123/syncallnetworks ---- With a request body like this: [source,xml] -------- AssignedTagsService
tagsService()
A reference to the host tags service.String
toString()
UnmanagedNetworksService
unmanagedNetworksService()
A reference to unmanaged networks.HostService.UnregisteredStorageDomainsDiscoverRequest
unregisteredStorageDomainsDiscover()
Discovers the block Storage Domains which are candidates to be imported to the setup.HostService.UpdateRequest
update()
Update the host properties.HostService.UpdateUsingRootPasswordRequest
updateUsingRootPassword()
Update the specified host in the system.HostService.UpdateUsingSshRequest
updateUsingSsh()
Updates the specified host in the system.HostService.UpgradeRequest
upgrade()
Upgrades VDSM and selected software on the host.HostService.UpgradeCheckRequest
upgradeCheck()
Check if there are upgrades available for the host.-
Methods inherited from class org.ovirt.engine.sdk4.internal.services.ServiceImpl
checkAction, checkFault, getConnection, getPath, throwError
-
-
-
-
Constructor Detail
-
HostServiceImpl
public HostServiceImpl(HttpConnection connection, String path)
-
-
Method Detail
-
activate
public HostService.ActivateRequest activate()
Description copied from interface:HostService
Activates the host for use, for example to run virtual machines.- Specified by:
activate
in interfaceHostService
-
approve
public HostService.ApproveRequest approve()
Description copied from interface:HostService
Approve a pre-installed Hypervisor host for usage in the virtualization environment. This action also accepts an optional cluster element to define the target cluster for this host.- Specified by:
approve
in interfaceHostService
-
commitNetConfig
public HostService.CommitNetConfigRequest commitNetConfig()
Description copied from interface:HostService
Marks the network configuration as good and persists it inside the host. An API user commits the network configuration to persist a host network interface attachment or detachment, or persist the creation and deletion of a bonded interface. IMPORTANT: Networking configuration is only committed after the engine has established that host connectivity is not lost as a result of the configuration changes. If host connectivity is lost, the host requires a reboot and automatically reverts to the previous networking configuration. For example, to commit the network configuration of host with id `123` send a request like this: [source] ---- POST /ovirt-engine/api/hosts/123/commitnetconfig ---- With a request body like this: [source,xml] -------- IMPORTANT: Since {engine-name} 4.3, it is possible to also specify `commit_on_success` in the < > request, in which case the new configuration is automatically saved in the {hypervisor-name} upon completing the setup and re-establishing connectivity between the {hypervisor-name} and {engine-name}, and without waiting for a separate < > request. - Specified by:
commitNetConfig
in interfaceHostService
-
copyHostNetworks
public HostService.CopyHostNetworksRequest copyHostNetworks()
Description copied from interface:HostService
Copy the network configuration of the specified host to current host. IMPORTANT: Any network attachments that are not present on the source host will be erased from the target host by the copy operation. To copy networks from another host, send a request like this: [source] ---- POST /ovirt-engine/api/hosts/123/copyhostnetworks ---- With a request body like this: [source,xml] ----- Specified by:
copyHostNetworks
in interfaceHostService
-
deactivate
public HostService.DeactivateRequest deactivate()
Description copied from interface:HostService
Deactivates the host to perform maintenance tasks.- Specified by:
deactivate
in interfaceHostService
-
discoverIscsi
public HostService.DiscoverIscsiRequest discoverIscsi()
Description copied from interface:HostService
Discovers iSCSI targets on the host, using the initiator details. Returns a list of IscsiDetails objects containing the discovered data. For example, to discover iSCSI targets available in `myiscsi.example.com`, from host `123`, send a request like this: [source] ---- POST /ovirt-engine/api/hosts/123/discoveriscsi ---- With a request body like this: [source,xml] ----myiscsi.example.com 10.35.1.72 3260 10.35.1.72:3260,1 iqn.2015-08.com.tgt:444 - Specified by:
discoverIscsi
in interfaceHostService
-
enrollCertificate
public HostService.EnrollCertificateRequest enrollCertificate()
Description copied from interface:HostService
Enrolls the certificate of the host. Useful in case you get a warning that it is about to expire or has already expired.- Specified by:
enrollCertificate
in interfaceHostService
-
fence
public HostService.FenceRequest fence()
Description copied from interface:HostService
Controls the host's power management device. For example, to start the host. This can be done via: [source] ---- #!/bin/sh -ex url="https://engine.example.com/ovirt-engine/api" user="admin@internal" password="..." curl \ --verbose \ --cacert /etc/pki/ovirt-engine/ca.pem \ --user "${user}:${password}" \ --request POST \ --header "Version: 4" \ --header "Content-Type: application/xml" \ --header "Accept: application/xml" \ --data 'start - Specified by:
fence
in interfaceHostService
-
forceSelectSpm
public HostService.ForceSelectSpmRequest forceSelectSpm()
Description copied from interface:HostService
To manually set a host as the storage pool manager (SPM). [source] ---- POST /ovirt-engine/api/hosts/123/forceselectspm ---- With a request body like this: [source,xml] -------- - Specified by:
forceSelectSpm
in interfaceHostService
-
get
public HostService.GetRequest get()
Description copied from interface:HostService
Gets the host details. [source] ---- GET /ovirt-engine/api/hosts/123 ----- Specified by:
get
in interfaceHostService
-
install
public HostService.InstallRequest install()
Description copied from interface:HostService
Installs the latest version of VDSM and related software on the host. The action also performs every configuration steps on the host which is done during adding host to the engine: kdump configuration, hosted-engine deploy, kernel options changes, etc. The host type defines additional parameters for the action. Example of installing a host, using `curl` and JSON, plain: [source,bash] ---- curl \ --verbose \ --cacert /etc/pki/ovirt-engine/ca.pem \ --request PUT \ --header "Content-Type: application/json" \ --header "Accept: application/json" \ --header "Version: 4" \ --user "admin@internal:..." \ --data ' { "root_password": "myrootpassword" } ' \ "https://engine.example.com/ovirt-engine/api/hosts/123" ---- Example of installing a host using `curl` and JSON with hosted engine components: [source,bash] ---- curl \ curl \ --verbose \ --cacert /etc/pki/ovirt-engine/ca.pem \ --request PUT \ --header "Content-Type: application/json" \ --header "Accept: application/json" \ --header "Version: 4" \ --user "admin@internal:..." \ --data ' { "root_password": "myrootpassword" "deploy_hosted_engine" : "true" } ' \ "https://engine.example.com/ovirt-engine/api/hosts/123" ---- IMPORTANT: Since version 4.1.2 of the engine, when a host is reinstalled we override the host firewall definitions by default.- Specified by:
install
in interfaceHostService
-
iscsiDiscover
public HostService.IscsiDiscoverRequest iscsiDiscover()
Description copied from interface:HostService
This method has been deprecated since Engine version 4.4.6. DiscoverIscsi should be used instead. Discovers iSCSI targets on the host, using the initiator details. Returns an array of strings containing the discovered data. For example, to discover iSCSI targets available in `myiscsi.example.com`, from host `123`, send a request like this: [source] ---- POST /ovirt-engine/api/hosts/123/iscsidiscover ---- With a request body like this: [source,xml] ----myiscsi.example.com - Specified by:
iscsiDiscover
in interfaceHostService
-
iscsiLogin
public HostService.IscsiLoginRequest iscsiLogin()
Description copied from interface:HostService
Login to iSCSI targets on the host, using the target details. IMPORTANT: When using this method to log in, you must use the iscsi details from the discovered targets results in the discoveriscsi method.- Specified by:
iscsiLogin
in interfaceHostService
-
refresh
public HostService.RefreshRequest refresh()
Description copied from interface:HostService
Refresh the host devices and capabilities.- Specified by:
refresh
in interfaceHostService
-
remove
public HostService.RemoveRequest remove()
Description copied from interface:HostService
Remove the host from the system. [source] ---- #!/bin/sh -ex url="https://engine.example.com/ovirt-engine/api" user="admin@internal" password="..." curl \ --verbose \ --cacert /etc/pki/ovirt-engine/ca.pem \ --user "${user}:${password}" \ --request DELETE \ --header "Version: 4" \ "${url}/hosts/1ff7a191-2f3b-4eff-812b-9f91a30c3acc" ----- Specified by:
remove
in interfaceHostService
-
setupNetworks
public HostService.SetupNetworksRequest setupNetworks()
Description copied from interface:HostService
This method is used to change the configuration of the network interfaces of a host. For example, if you have a host with three network interfaces `eth0`, `eth1` and `eth2` and you want to configure a new bond using `eth0` and `eth1`, and put a VLAN on top of it. Using a simple shell script and the `curl` command line HTTP client that can be done as follows: [source] ---- #!/bin/sh -ex url="https://engine.example.com/ovirt-engine/api" user="admin@internal" password="..." curl \ --verbose \ --cacert /etc/pki/ovirt-engine/ca.pem \ --user "${user}:${password}" \ --request POST \ --header "Version: 4" \ --header "Content-Type: application/xml" \ --header "Accept: application/xml" \ --data 'bond0 eth1 eth2 myvlan bond0 static 192.168.122.10 255.255.255.0 1.1.1.1 2.2.2.2 ---- The same thing can be done using the Python SDK with the following code: [source,python] ---- # Find the service that manages the collection of hosts: hosts_service = connection.system_service().hosts_service() # Find the host: host = hosts_service.list(search='name=myhost')[0] # Find the service that manages the host: host_service = hosts_service.host_service(host.id) # Configure the network adding a bond with two slaves and attaching it to a # network with an static IP address: host_service.setup_networks( modified_bonds=[ types.HostNic( name='bond0', bonding=types.Bonding( options=[ types.Option( name='mode', value='4', ), types.Option( name='miimon', value='100', ), ], slaves=[ types.HostNic( name='eth1', ), types.HostNic( name='eth2', ), ], ), ), ], modified_network_attachments=[ types.NetworkAttachment( network=types.Network( name='myvlan', ), host_nic=types.HostNic( name='bond0', ), ip_address_assignments=[ types.IpAddressAssignment( assignment_method=types.BootProtocol.STATIC, ip=types.Ip( address='192.168.122.10', netmask='255.255.255.0', ), ), ], dns_resolver_configuration=types.DnsResolverConfiguration( name_servers=[ '1.1.1.1', '2.2.2.2', ], ), ), ], ) # After modifying the network configuration it is very important to make it # persistent: host_service.commit_net_config() ---- IMPORTANT: To make sure that the network configuration has been saved in the host, and that it will be applied when the host is rebooted, remember to call < >. IMPORTANT: Since {engine-name} 4.3, it is possible to also specify `commit_on_success` in the < > request, in which case the new configuration is automatically saved in the {hypervisor-name} upon completing the setup and re-establishing connectivity between the {hypervisor-name} and {engine-name}, and without waiting for a separate < > request. - Specified by:
setupNetworks
in interfaceHostService
-
syncAllNetworks
public HostService.SyncAllNetworksRequest syncAllNetworks()
Description copied from interface:HostService
To synchronize all networks on the host, send a request like this: [source] ---- POST /ovirt-engine/api/hosts/123/syncallnetworks ---- With a request body like this: [source,xml] -------- - Specified by:
syncAllNetworks
in interfaceHostService
-
unregisteredStorageDomainsDiscover
public HostService.UnregisteredStorageDomainsDiscoverRequest unregisteredStorageDomainsDiscover()
Description copied from interface:HostService
Discovers the block Storage Domains which are candidates to be imported to the setup. For FCP no arguments are required.- Specified by:
unregisteredStorageDomainsDiscover
in interfaceHostService
-
update
public HostService.UpdateRequest update()
Description copied from interface:HostService
Update the host properties. For example, to update a the kernel command line of a host send a request like this: [source] ---- PUT /ovirt-engine/api/hosts/123 ---- With request body like this: [source, xml] ----vfio_iommu_type1.allow_unsafe_interrupts=1 - Specified by:
update
in interfaceHostService
-
upgrade
public HostService.UpgradeRequest upgrade()
Description copied from interface:HostService
Upgrades VDSM and selected software on the host.- Specified by:
upgrade
in interfaceHostService
-
upgradeCheck
public HostService.UpgradeCheckRequest upgradeCheck()
Description copied from interface:HostService
Check if there are upgrades available for the host. If there are upgrades available an icon will be displayed next to host status icon in the Administration Portal. Audit log messages are also added to indicate the availability of upgrades. The upgrade can be started from the webadmin or by using the <> host action. - Specified by:
upgradeCheck
in interfaceHostService
-
approveUsingRootPassword
public HostService.ApproveUsingRootPasswordRequest approveUsingRootPassword()
- Specified by:
approveUsingRootPassword
in interfaceHostService
-
installUsingRootPassword
public HostService.InstallUsingRootPasswordRequest installUsingRootPassword()
Description copied from interface:HostService
Install VDSM and other packages required to get the host ready to be used in the engine providing the root password. This has been deprecated.- Specified by:
installUsingRootPassword
in interfaceHostService
-
updateUsingRootPassword
public HostService.UpdateUsingRootPasswordRequest updateUsingRootPassword()
Description copied from interface:HostService
Update the specified host in the system. This is deprecated and is provided only for backwards compatibility.- Specified by:
updateUsingRootPassword
in interfaceHostService
-
approveUsingSsh
public HostService.ApproveUsingSshRequest approveUsingSsh()
Description copied from interface:HostService
Approve the specified host to be added to the engine by using ssh authentication. This occurs when the host registers itself with the engine.- Specified by:
approveUsingSsh
in interfaceHostService
-
installUsingSsh
public HostService.InstallUsingSshRequest installUsingSsh()
Description copied from interface:HostService
Install VDSM and other packages required to get the host ready to be used in the engine providing the SSH password.- Specified by:
installUsingSsh
in interfaceHostService
-
updateUsingSsh
public HostService.UpdateUsingSshRequest updateUsingSsh()
Description copied from interface:HostService
Updates the specified host in the system.- Specified by:
updateUsingSsh
in interfaceHostService
-
affinityLabelsService
public AssignedAffinityLabelsService affinityLabelsService()
Description copied from interface:HostService
List of scheduling labels assigned to this host.- Specified by:
affinityLabelsService
in interfaceHostService
-
devicesService
public HostDevicesService devicesService()
Description copied from interface:HostService
A reference to the host devices service. Use this service to view the devices of the host object.- Specified by:
devicesService
in interfaceHostService
-
externalNetworkProviderConfigurationsService
public ExternalNetworkProviderConfigurationsService externalNetworkProviderConfigurationsService()
Description copied from interface:HostService
External network providers provisioned by the system on the host.- Specified by:
externalNetworkProviderConfigurationsService
in interfaceHostService
-
fenceAgentsService
public FenceAgentsService fenceAgentsService()
Description copied from interface:HostService
A reference to the fence agents service. Use this service to manage fence and power management agents on the host object.- Specified by:
fenceAgentsService
in interfaceHostService
-
hooksService
public HostHooksService hooksService()
Description copied from interface:HostService
A reference to the host hooks service. Use this service to view the hooks available in the host object.- Specified by:
hooksService
in interfaceHostService
-
katelloErrataService
public KatelloErrataService katelloErrataService()
Description copied from interface:HostService
A reference to the service that can show the applicable errata available on the host. This information is taken from Katello.- Specified by:
katelloErrataService
in interfaceHostService
-
networkAttachmentsService
public NetworkAttachmentsService networkAttachmentsService()
Description copied from interface:HostService
A reference to the network attachments service. You can use this service to attach Logical networks to host interfaces.- Specified by:
networkAttachmentsService
in interfaceHostService
-
nicsService
public HostNicsService nicsService()
Description copied from interface:HostService
A reference to the service that manages the network interface devices on the host.- Specified by:
nicsService
in interfaceHostService
-
numaNodesService
public HostNumaNodesService numaNodesService()
Description copied from interface:HostService
A reference to the service that manage NUMA nodes for the host.- Specified by:
numaNodesService
in interfaceHostService
-
permissionsService
public AssignedPermissionsService permissionsService()
Description copied from interface:HostService
A reference to the host permission service. Use this service to manage permissions on the host object.- Specified by:
permissionsService
in interfaceHostService
-
statisticsService
public StatisticsService statisticsService()
- Specified by:
statisticsService
in interfaceMeasurableService
- Overrides:
statisticsService
in classMeasurableServiceImpl
-
storageService
public HostStorageService storageService()
Description copied from interface:HostService
A reference to the service that manages the host's storage.- Specified by:
storageService
in interfaceHostService
-
storageConnectionExtensionsService
public StorageServerConnectionExtensionsService storageConnectionExtensionsService()
Description copied from interface:HostService
A reference to storage connection extensions.- Specified by:
storageConnectionExtensionsService
in interfaceHostService
-
tagsService
public AssignedTagsService tagsService()
Description copied from interface:HostService
A reference to the host tags service. Use this service to manage tags on the host object.- Specified by:
tagsService
in interfaceHostService
-
unmanagedNetworksService
public UnmanagedNetworksService unmanagedNetworksService()
Description copied from interface:HostService
A reference to unmanaged networks.- Specified by:
unmanagedNetworksService
in interfaceHostService
-
service
public Service service(String path)
Description copied from interface:MeasurableService
Service locator method, returns individual service on which the URI is dispatched.- Specified by:
service
in interfaceHostService
- Specified by:
service
in interfaceMeasurableService
- Overrides:
service
in classMeasurableServiceImpl
-
toString
public String toString()
- Overrides:
toString
in classMeasurableServiceImpl
-
-