On Thu, Nov 7, 2019 at 2:02 PM Jamie Holohan <james.holohan@oracle.com> wrote:
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?


Hi,
AFAIK the operation that you are trying to do it is not possible even through UI. We do not allow attachment of network directly to bond slaves only to the bonds.

Regards,
Ales
 
_______________________________________________
Devel mailing list -- devel@ovirt.org
To unsubscribe send an email to devel-leave@ovirt.org
Privacy Statement: https://www.ovirt.org/site/privacy-policy/
oVirt Code of Conduct: https://www.ovirt.org/community/about/community-guidelines/
List Archives: https://lists.ovirt.org/archives/list/devel@ovirt.org/message/S6F6RMGE4ODIYQEDKQ7VIPVAHJH4LZHC/


--

Ales Musil

Associate Software Engineer - RHV Network

Red Hat EMEA

amusil@redhat.com    IM: amusil