Hi all,
I've added setupNetworks command to vdsClient
http://gerrit.ovirt.org/#/c/14132/ and I
want to show you some example of how to use it.
Syntax is following:
setupNetworks
[connectivityCheck=False(default)|True] [connectivityTimeout=<seconds>]
[<option>=<value>]
[networks='{<bridge>:{nic:<nic>,vlan:<number>,bonding:<bond>,...}}']
[bondings='{<bond>:{nics:<nic>[+<nic>],..}}']
Note that quotation marks "'" in networks='...' and
bongings='...' are important, if they would not be there shell would make brace
expansion and the arguments would not be in the form we want.
Example of usage:
# vdsClient 0 setupNetworks
networks='{red:{bonding:bond4,STP:no,bridged:True},black:{nic:eth3,vlan:5,STP:no,bridged:true}}'
bondings='{bond4:{nics:eth1+eth2,options:mode=4}}'
Here I created two networks: red with bond4, no STP and bridge, black on nic eth3, vlan 5,
with no STP and bridged. I also created bonding over nics eth1 and eth2 with mode 4.
# vdsClient 0 setupNetworks networks='{red:{remove:true},black:{remove:true}}'
bondings='{bond4:{remove:true}}'
And here I've destroyed all created networks and bond.
vdsClient setupNetworks command calls configNetwork.setupNetworks, that can be called with
following parameters so you can use it:
Add/Edit/Remove configuration for networks and bondings.
Params:
networks - dict of key=network, value=attributes
where 'attributes' is a dict with the following optional items:
vlan=<id>
bonding="<name>" | nic="<name>"
(bonding and nics are mutually exclusive)
ipaddr="<ip>"
netmask="<ip>"
gateway="<ip>"
bootproto="..."
delay="..."
onboot="yes"|"no"
(other options will be passed to the config file AS-IS)
-- OR --
remove=True (other attributes can't be specified)
bondings - dict of key=bonding, value=attributes
where 'attributes' is a dict with the following optional items:
nics=["<nic1>" , "<nic2>", ...]
options="<bonding-options>"
-- OR --
remove=True (other attributes can't be specified)
options - dict of options, such as:
force=0|1
connectivityCheck=0|1
connectivityTimeout=<int>
Notes:
When you edit a network that is attached to a bonding, it's not
necessary to re-specify the bonding (you need only to note
the attachment in the network's attributes). Similarly, if you edit
a bonding, it's not necessary to specify its networks.
Regards,
Petr.