Package org.ovirt.engine.sdk4.services
Interface HostService.SetupNetworksRequest
-
- All Superinterfaces:
Request<HostService.SetupNetworksRequest,HostService.SetupNetworksResponse>
- Enclosing interface:
- HostService
public static interface HostService.SetupNetworksRequest extends Request<HostService.SetupNetworksRequest,HostService.SetupNetworksResponse>
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.
-
-
Method Summary
-
-
-
Method Detail
-
async
HostService.SetupNetworksRequest async(Boolean async)
Indicates if the action should be performed asynchronously.
-
checkConnectivity
HostService.SetupNetworksRequest checkConnectivity(Boolean checkConnectivity)
-
commitOnSuccess
HostService.SetupNetworksRequest commitOnSuccess(Boolean commitOnSuccess)
Specifies whether to automatically save the configuration 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. The default value is `false`, which means that the configuration will not be saved automatically.
-
connectivityTimeout
HostService.SetupNetworksRequest connectivityTimeout(Integer connectivityTimeout)
-
connectivityTimeout
HostService.SetupNetworksRequest connectivityTimeout(Long connectivityTimeout)
-
connectivityTimeout
HostService.SetupNetworksRequest connectivityTimeout(BigInteger connectivityTimeout)
-
modifiedBonds
HostService.SetupNetworksRequest modifiedBonds(List<HostNic> modifiedBonds)
-
modifiedBonds
HostService.SetupNetworksRequest modifiedBonds(HostNic... modifiedBonds)
-
modifiedBonds
HostService.SetupNetworksRequest modifiedBonds(HostNicBuilder... modifiedBonds)
-
modifiedLabels
HostService.SetupNetworksRequest modifiedLabels(List<NetworkLabel> modifiedLabels)
-
modifiedLabels
HostService.SetupNetworksRequest modifiedLabels(NetworkLabel... modifiedLabels)
-
modifiedLabels
HostService.SetupNetworksRequest modifiedLabels(NetworkLabelBuilder... modifiedLabels)
-
modifiedNetworkAttachments
HostService.SetupNetworksRequest modifiedNetworkAttachments(List<NetworkAttachment> modifiedNetworkAttachments)
-
modifiedNetworkAttachments
HostService.SetupNetworksRequest modifiedNetworkAttachments(NetworkAttachment... modifiedNetworkAttachments)
-
modifiedNetworkAttachments
HostService.SetupNetworksRequest modifiedNetworkAttachments(NetworkAttachmentBuilder... modifiedNetworkAttachments)
-
removedBonds
HostService.SetupNetworksRequest removedBonds(List<HostNic> removedBonds)
-
removedBonds
HostService.SetupNetworksRequest removedBonds(HostNic... removedBonds)
-
removedBonds
HostService.SetupNetworksRequest removedBonds(HostNicBuilder... removedBonds)
-
removedLabels
HostService.SetupNetworksRequest removedLabels(List<NetworkLabel> removedLabels)
-
removedLabels
HostService.SetupNetworksRequest removedLabels(NetworkLabel... removedLabels)
-
removedLabels
HostService.SetupNetworksRequest removedLabels(NetworkLabelBuilder... removedLabels)
-
removedNetworkAttachments
HostService.SetupNetworksRequest removedNetworkAttachments(List<NetworkAttachment> removedNetworkAttachments)
-
removedNetworkAttachments
HostService.SetupNetworksRequest removedNetworkAttachments(NetworkAttachment... removedNetworkAttachments)
-
removedNetworkAttachments
HostService.SetupNetworksRequest removedNetworkAttachments(NetworkAttachmentBuilder... removedNetworkAttachments)
-
synchronizedNetworkAttachments
HostService.SetupNetworksRequest synchronizedNetworkAttachments(List<NetworkAttachment> synchronizedNetworkAttachments)
-
synchronizedNetworkAttachments
HostService.SetupNetworksRequest synchronizedNetworkAttachments(NetworkAttachment... synchronizedNetworkAttachments)
A list of network attachments that will be synchronized.
-
synchronizedNetworkAttachments
HostService.SetupNetworksRequest synchronizedNetworkAttachments(NetworkAttachmentBuilder... synchronizedNetworkAttachments)
A list of network attachments that will be synchronized.
-
-