POST /ovirt-engine/api/hosts/123/commitnetconfig
public class HostServiceImpl extends ServiceImpl implements HostService
HostService.ActivateRequest, HostService.ActivateResponse, HostService.ApproveRequest, HostService.ApproveResponse, 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.IscsiDiscoverRequest, HostService.IscsiDiscoverResponse, HostService.IscsiLoginRequest, HostService.IscsiLoginResponse, HostService.RefreshRequest, HostService.RefreshResponse, HostService.RemoveRequest, HostService.RemoveResponse, HostService.SetupNetworksRequest, HostService.SetupNetworksResponse, HostService.UnregisteredStorageDomainsDiscoverRequest, HostService.UnregisteredStorageDomainsDiscoverResponse, HostService.UpdateRequest, HostService.UpdateResponse, HostService.UpgradeRequest, HostService.UpgradeResponse
Constructor and Description |
---|
HostServiceImpl(HttpConnection connection,
String path) |
checkAction, checkFault, getConnection, getPath, throwError
public HostServiceImpl(HttpConnection connection, String path)
public HostService.ActivateRequest activate()
HostService
Activate the host for use, such as running 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
Deactivate the host to perform maintenance tasks.
deactivate
in interface HostService
public HostService.EnrollCertificateRequest enrollCertificate()
HostService
Enroll certificate of the host. Useful in case you get a warning that it is about to, or already expired.
enrollCertificate
in interface HostService
public HostService.FenceRequest fence()
HostService
Controls host’s power management device.
For example, let’s assume you want 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
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
Get the host details.
get
in interface HostService
public HostService.InstallRequest install()
HostService
Install VDSM and related software on the host. 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"
install
in interface HostService
public HostService.IscsiDiscoverRequest iscsiDiscover()
iscsiDiscover
in interface HostService
public HostService.IscsiLoginRequest iscsiLogin()
iscsiLogin
in interface HostService
public HostService.RefreshRequest refresh()
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, lets assume that you have a host with three network interfaces eth0
, eth1
and eth2
and that
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>
</network_attachment>
</modified_network_attachments>
</action>
' \
"${url}/hosts/1ff7a191-2f3b-4eff-812b-9f91a30c3acc/setupnetworks"
Note that 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:
host.setupnetworks(
params.Action(
modified_bonds=params.HostNics(
host_nic=[
params.HostNIC(
name="bond0",
bonding=params.Bonding(
options=params.Options(
option=[
params.Option(name="mode", value="4"),
params.Option(name="miimon", value="100"),
],
),
slaves=params.Slaves(
host_nic=[
params.HostNIC(name="eth1"),
params.HostNIC(name="eth2"),
],
),
),
),
],
),
modified_network_attachments=params.NetworkAttachments(
network_attachment=[
params.NetworkAttachment(
network=params.Network(name="myvlan"),
host_nic=params.HostNIC(name="bond0"),
ip_address_assignments=params.IpAddressAssignments(
ip_address_assignment=[
params.IpAddressAssignment(
assignment_method="static",
ip=params.IP(
address="192.168.122.10",
netmask="255.255.255.0",
),
),
],
),
),
],
),
),
)
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.UnregisteredStorageDomainsDiscoverRequest unregisteredStorageDomainsDiscover()
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
Upgrade VDSM and selected software on the host.
upgrade
in interface HostService
public AssignedAffinityLabelsService affinityLabelsService()
HostService
List of scheduling labels assigned to this host.
affinityLabelsService
in interface HostService
public HostDevicesService devicesService()
devicesService
in interface HostService
public FenceAgentsService fenceAgentsService()
fenceAgentsService
in interface HostService
public HostHooksService hooksService()
hooksService
in interface HostService
public KatelloErrataService katelloErrataService()
katelloErrataService
in interface HostService
public NetworkAttachmentsService networkAttachmentsService()
networkAttachmentsService
in interface HostService
public HostNicsService nicsService()
HostService
Reference to the service that manages the network interface devices on the host.
nicsService
in interface HostService
public HostNumaNodesService numaNodesService()
numaNodesService
in interface HostService
public AssignedPermissionsService permissionsService()
permissionsService
in interface HostService
public StatisticsService statisticsService()
public HostStorageService storageService()
storageService
in interface HostService
public StorageServerConnectionExtensionsService storageConnectionExtensionsService()
storageConnectionExtensionsService
in interface HostService
public AssignedTagsService tagsService()
tagsService
in interface HostService
public UnmanagedNetworksService unmanagedNetworksService()
unmanagedNetworksService
in interface HostService
public Service service(String path)
HostService
Service locator method, returns individual service on which the URI is dispatched.
service
in interface HostService
Copyright © 2016. All rights reserved.