POST /ovirt-engine/api/hosts/123/commitnetconfig
public class HostServiceImpl extends MeasurableServiceImpl implements HostService
HostService.ActivateRequest, HostService.ActivateResponse, HostService.ApproveRequest, HostService.ApproveResponse, HostService.ApproveUsingRootPasswordRequest, HostService.ApproveUsingRootPasswordResponse, HostService.ApproveUsingSshRequest, HostService.ApproveUsingSshResponse, HostService.CommitNetConfigRequest, HostService.CommitNetConfigResponse, HostService.DeactivateRequest, HostService.DeactivateResponse, 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 and Description |
---|
HostServiceImpl(HttpConnection connection,
String path) |
Modifier and Type | Method and 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()
Approve the specified host to be added to the engine by using the root password (deprecated verb).
|
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.DeactivateRequest |
deactivate()
Deactivates the host to perform maintenance tasks.
|
HostDevicesService |
devicesService()
A reference to the host devices service.
|
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()
Discovers iSCSI targets on the host, using the initiator details.
|
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:
|
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.
|
checkAction, checkFault, getConnection, getPath, throwError
public HostServiceImpl(HttpConnection connection, String path)
public HostService.ActivateRequest activate()
HostService
Activates the host for use, for example to run virtual machines.
activate
in interface HostService
public HostService.ApproveRequest approve()
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.
approve
in interface HostService
public HostService.CommitNetConfigRequest commitNetConfig()
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:
POST /ovirt-engine/api/hosts/123/commitnetconfig
With a request body like this:
<action/>
commitNetConfig
in interface HostService
public HostService.DeactivateRequest deactivate()
HostService
Deactivates the host to perform maintenance tasks.
deactivate
in interface HostService
public HostService.EnrollCertificateRequest enrollCertificate()
HostService
Enrolls the certificate of the host. Useful in case you get a warning that it is about to expire or has already expired.
enrollCertificate
in interface HostService
public HostService.FenceRequest fence()
HostService
Controls the host’s power management device.
For example, to start the host. This can be done via:
#!/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 '
<action>
<fence_type>start</fence_type>
</action>
' \
"${url}/hosts/123/fence"
fence
in interface HostService
public HostService.ForceSelectSpmRequest forceSelectSpm()
HostService
To manually set a host as the storage pool manager (SPM).
POST /ovirt-engine/api/hosts/123/forceselectspm
With a request body like this:
<action/>
forceSelectSpm
in interface HostService
public HostService.GetRequest get()
HostService
Gets the host details.
GET /ovirt-engine/api/hosts/123
get
in interface HostService
public HostService.InstallRequest install()
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:
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:
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"
}
' \
"https://engine.example.com/ovirt-engine/api/hosts/123?deploy_hosted_engine=true"
Important
|
Since version 4.1.2 of the engine when a host is reinstalled we override the host firewall definitions by default. |
install
in interface HostService
public HostService.IscsiDiscoverRequest iscsiDiscover()
HostService
Discovers iSCSI targets on the host, using the initiator details.
For example, to discover iSCSI targets available in myiscsi.example.com
,
from host 123
, send a request like this:
POST /ovirt-engine/api/hosts/123/iscsidiscover
With a request body like this:
<action>
<iscsi>
<address>myiscsi.example.com</address>
</iscsi>
</action>
The result will be like this:
<discovered_targets>
<iscsi_details>
<address>10.35.1.72</address>
<port>3260</port>
<portal>10.35.1.72:3260,1</portal>
<target>iqn.2015-08.com.tgt:444</target>
</iscsi_details>
</discovered_targets>
iscsiDiscover
in interface HostService
public HostService.IscsiLoginRequest iscsiLogin()
HostService
Login to iSCSI targets on the host, using the target details.
iscsiLogin
in interface HostService
public HostService.RefreshRequest refresh()
HostService
Refresh the host devices and capabilities.
refresh
in interface HostService
public HostService.RemoveRequest remove()
HostService
Remove the host from the system.
#!/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"
remove
in interface HostService
public HostService.SetupNetworksRequest setupNetworks()
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:
#!/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 '
<action>
<modified_bonds>
<host_nic>
<name>bond0</name>
<bonding>
<options>
<option>
<name>mode</name>
<value>4</value>
</option>
<option>
<name>miimon</name>
<value>100</value>
</option>
</options>
<slaves>
<host_nic>
<name>eth1</name>
</host_nic>
<host_nic>
<name>eth2</name>
</host_nic>
</slaves>
</bonding>
</host_nic>
</modified_bonds>
<modified_network_attachments>
<network_attachment>
<network>
<name>myvlan</name>
</network>
<host_nic>
<name>bond0</name>
</host_nic>
<ip_address_assignments>
<assignment_method>static</assignment_method>
<ip_address_assignment>
<ip>
<address>192.168.122.10</address>
<netmask>255.255.255.0</netmask>
</ip>
</ip_address_assignment>
</ip_address_assignments>
<dns_resolver_configuration>
<name_servers>
<name_server>1.1.1.1</name_server>
<name_server>2.2.2.2</name_server>
</name_servers>
</dns_resolver_configuration>
</network_attachment>
</modified_network_attachments>
</action>
' \
"${url}/hosts/1ff7a191-2f3b-4eff-812b-9f91a30c3acc/setupnetworks"
Note
|
This is valid for version 4 of the API. In previous versions some elements were represented as XML
attributes instead of XML elements. In particular the options and ip elements were represented as follows:
|
<options name="mode" value="4"/>
<options name="miimon" value="100"/>
<ip address="192.168.122.10" netmask="255.255.255.0"/>
Using the Python SDK the same can be done with the following code:
# 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 commitnetconfig. |
setupNetworks
in interface HostService
public HostService.SyncAllNetworksRequest syncAllNetworks()
HostService
To synchronize all networks on the host, send a request like this:
POST /ovirt-engine/api/hosts/123/syncallnetworks
With a request body like this:
<action/>
syncAllNetworks
in interface HostService
public HostService.UnregisteredStorageDomainsDiscoverRequest unregisteredStorageDomainsDiscover()
HostService
Discovers the block Storage Domains which are candidates to be imported to the setup. For FCP no arguments are required.
unregisteredStorageDomainsDiscover
in interface HostService
public HostService.UpdateRequest update()
HostService
Update the host properties.
For example, to update a the kernel command line of a host send a request like this:
PUT /ovirt-engine/api/hosts/123
With request body like this:
<host>
<os>
<custom_kernel_cmdline>vfio_iommu_type1.allow_unsafe_interrupts=1</custom_kernel_cmdline>
</os>
</host>
update
in interface HostService
public HostService.UpgradeRequest upgrade()
HostService
Upgrades VDSM and selected software on the host.
upgrade
in interface HostService
public HostService.UpgradeCheckRequest upgradeCheck()
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 upgrade host action.
upgradeCheck
in interface HostService
public HostService.ApproveUsingRootPasswordRequest approveUsingRootPassword()
HostService
Approve the specified host to be added to the engine by using the root password (deprecated verb). This occurs when the host registers itself with the engine.
approveUsingRootPassword
in interface HostService
public HostService.InstallUsingRootPasswordRequest installUsingRootPassword()
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.
installUsingRootPassword
in interface HostService
public HostService.UpdateUsingRootPasswordRequest updateUsingRootPassword()
HostService
Update the specified host in the system. This is deprecated and is provided only for backwards compatibility.
updateUsingRootPassword
in interface HostService
public HostService.ApproveUsingSshRequest approveUsingSsh()
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.
approveUsingSsh
in interface HostService
public HostService.InstallUsingSshRequest installUsingSsh()
HostService
Install VDSM and other packages required to get the host ready to be used in the engine providing the SSH password.
installUsingSsh
in interface HostService
public HostService.UpdateUsingSshRequest updateUsingSsh()
HostService
Updates the specified host in the system.
updateUsingSsh
in interface HostService
public AssignedAffinityLabelsService affinityLabelsService()
HostService
List of scheduling labels assigned to this host.
affinityLabelsService
in interface HostService
public HostDevicesService devicesService()
HostService
A reference to the host devices service. Use this service to view the devices of the host object.
devicesService
in interface HostService
public ExternalNetworkProviderConfigurationsService externalNetworkProviderConfigurationsService()
HostService
External network providers provisioned by the system on the host.
externalNetworkProviderConfigurationsService
in interface HostService
public FenceAgentsService fenceAgentsService()
HostService
A reference to the fence agents service. Use this service to manage fence and power management agents on the host object.
fenceAgentsService
in interface HostService
public HostHooksService hooksService()
HostService
A reference to the host hooks service. Use this service to view the hooks available in the host object.
hooksService
in interface HostService
public KatelloErrataService katelloErrataService()
HostService
A reference to the service that can show the applicable errata available on the host. This information is taken from Katello.
katelloErrataService
in interface HostService
public NetworkAttachmentsService networkAttachmentsService()
HostService
A reference to the network attachments service. You can use this service to attach Logical networks to host interfaces.
networkAttachmentsService
in interface HostService
public HostNicsService nicsService()
HostService
A reference to the service that manages the network interface devices on the host.
nicsService
in interface HostService
public HostNumaNodesService numaNodesService()
HostService
A reference to the service that manage NUMA nodes for the host.
numaNodesService
in interface HostService
public AssignedPermissionsService permissionsService()
HostService
A reference to the host permission service. Use this service to manage permissions on the host object.
permissionsService
in interface HostService
public StatisticsService statisticsService()
statisticsService
in interface MeasurableService
statisticsService
in class MeasurableServiceImpl
public HostStorageService storageService()
HostService
A reference to the service that manages the host’s storage.
storageService
in interface HostService
public StorageServerConnectionExtensionsService storageConnectionExtensionsService()
HostService
A reference to storage connection extensions.
storageConnectionExtensionsService
in interface HostService
public AssignedTagsService tagsService()
HostService
A reference to the host tags service. Use this service to manage tags on the host object.
tagsService
in interface HostService
public UnmanagedNetworksService unmanagedNetworksService()
HostService
A reference to unmanaged networks.
unmanagedNetworksService
in interface HostService
public Service service(String path)
MeasurableService
Service locator method, returns individual service on which the URI is dispatched.
service
in interface HostService
service
in interface MeasurableService
service
in class MeasurableServiceImpl
public String toString()
toString
in class MeasurableServiceImpl
Copyright © 2018. All rights reserved.