I am trying to complete a task using the Java SDK which involves attaching networks to an
interface, and then bonding another interface to the attached one. This can be done using
the OVM UI in one step.
The SDK requires you to remove any attached networks from the interfaces before bonding
them. The issue I am having comes after this part, where I try to reattach the networks to
the interface which is a slave of the bond that was created. The specific error is as
follows:
Fault reason is "Operation Failed". Fault detail is "[Interface already in
use]". HTTP response code is "400". HTTP response message is "Bad
Request"
To create the bond I am using the setpNetworks() function, where the interfaces are
supplied in a list (nics), as follows:
Option bondOptionBuilder = new
OptionBuilder().name("mode").value("4").build();
Option miimonOptionBuilder = new
OptionBuilder().name(""miimon).value("100").build();
List<Option> options = new ArrayList<>();
options.add(bondOptionBuilder);
options.add(miimonOptionBuilder);
BondingBuilder bondingBuilder = new BondingBuilder().options(options).slaves(nics);
HostNicBuilder hostNicBuilder = new
HostNicBuilder().name("bond0").bonding(bondingBuilder);
hostService.setupNetworks().modifiedBonds(hostNicBuilder).send();
To reattach the networks (supplied by netAttachmentsToAdd) to the interface, I use the
setupNetworks function as follows:
hostService.setupNetworks().modifiedNetworkAttachments(netAttachmentsToAdd).send();
I am wondering how I can assign networks to NICs which are slaves of a bond using the SDK.
Can I attach them to the interfaces directly or is this the wrong approach?