[Users] Delete & Detach Logical Network

Tejesh M tejeshmk at gmail.com
Tue Mar 11 00:23:18 UTC 2014


Hi Moti,

"rhevhost" is the Host name & logical network is sent as variable nw_name,
in the code 1.


On Mon, Mar 10, 2014 at 6:54 PM, Moti Asayag <masayag at redhat.com> wrote:

>
>
> ----- Original Message -----
> > From: "Tejesh M" <tejeshmk at gmail.com>
> > To: "Moti Asayag" <masayag at redhat.com>, "users at oVirt.org" <
> users at ovirt.org>
> > Sent: Monday, March 10, 2014 1:22:08 PM
> > Subject: Delete & Detach Logical Network
> >
> > Hi,
> >
> > I'm able to delete the logical network but this logical network after
> > deletion shows as unmanaged network in "Setup Host Networks" against the
> > hostnic.
> >
> > I tried with this code to detach the logical network.
> >
> > *Code 1:*
> > HostNIC nic = api.getHosts().get("rhevhost").getHostNics().get("eth1");
> > Action action = new Action();
> > action.setNetwork(api.getNetworks().get(nw_name));
> > action.setDetach(true);
> > action.setCheckConnectivity(false);
> > nic.detach(action);
> >
> > *Returns*:
> > code  : 409
> > reason: Conflict
> > detail: Network Interface is not attached to Logical Network.
> >
>
> I can guess by the error message that the logical network 'rhevhost' is
> vlan,
> so the proper interface should be the vlan device.
>
>
> > *Code 2:*
> > HostNIC nic =
> api.getHosts().get("rhevhost").getHostNics().get("eth1.1345");
> > Action action = new Action();
> > action.setNetwork(api.getNetworks().get(nw_name));
> > action.setDetach(true);
> > action.setCheckConnectivity(false);
> > nic.detach(action);
> >
> > *Returns*:
> > code  : 409
> > reason: Conflict
> > detail: Cannot edit Network while Host is Active, change the Host to
> > Maintenance mode and try again.
> >
>
> This is the 3.0 api which required the host to be in maintenance for
> network
> operations on the host. You could use setup networks instead which is the
> recommended api and doesn't require the host to be in maintenance.
>
> you can modify the example from [1] and set null for the network name you
> wish to detach from the specific interface.
>
> Try by replacing only lines 28-41 with:
> HostNIC nic = nicsByNames.get("eth1.1345");
> nic.setNetwork(null);
>
> [1]
> https://motiasayag.wordpress.com/2014/02/24/invoke-setup-networks-from-the-java-sdk/
>
> >
> > --
> > Thanks & Regards
> > Tejesh
> >
>



-- 
Thanks & Regards
Tejesh
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ovirt.org/pipermail/users/attachments/20140311/dfa0eb16/attachment-0001.html>


More information about the Users mailing list