[Users] Creating Logical Network issue - API

Tejesh M tejeshmk at gmail.com
Mon Feb 24 11:18:53 UTC 2014


The example updates the existing Network (i.e. if the Logical Network is
already mapped to eth1). But what i'm looking for is how to map Logical
Network "ApiNetWork" to "eth1", please refer screenshot.


On Mon, Feb 24, 2014 at 4:11 PM, Moti Asayag <masayag at redhat.com> wrote:

> ----- Original Message -----
> > From: "Tejesh M" <tejeshmk at gmail.com>
> > To: "Moti Asayag" <masayag at redhat.com>
> > Cc: "users at oVirt.org" <users at ovirt.org>
> > Sent: Monday, February 24, 2014 11:59:42 AM
> > Subject: Re: [Users] Creating Logical Network issue - API
> >
> > While setting Logical Network, it fails with below error:
> > code  : 400
> > reason: Bad Request
> > detail: Previous network name is required.
>
> See an example in the following post:
>
>
> https://motiasayag.wordpress.com/2014/02/24/network-configuration-using-ovirt-engine-java-sdk/
>
> >
> > Code:
> >           String nw_name="ApiNetWork";
> >           org.ovirt.engine.sdk.decorators.Host hst =
> > api.getHosts().get("rhevhost");
> >
> > hst.getHostNics().get("eth1").setNetwork(api.getNetworks().get(nw_name));
> >           //hst.getHostNics().get("eth1").setCheckConnectivity(true);
> >           //hst.getHostNics().get("eth1").setOverrideConfiguration(true);
> >           hst.getHostNics().get("eth1").update();
> >
> >
> >
> > On Mon, Feb 24, 2014 at 2:30 PM, Tejesh M <tejeshmk at gmail.com> wrote:
> >
> > > Can you tel me how do i assign Logical Network(s) to one of the
> Physical
> > > Nic on the Host.
> > >
> > >
> > > On Fri, Feb 21, 2014 at 1:37 PM, Moti Asayag <masayag at redhat.com>
> wrote:
> > >
> > >> h
> > >>
> > >> ----- Original Message -----
> > >> > From: "Tejesh M" <tejeshmk at gmail.com>
> > >> > To: "users at oVirt.org" <users at ovirt.org>
> > >> > Sent: Thursday, February 20, 2014 11:48:56 AM
> > >> > Subject: [Users] Creating Logical Network issue - API
> > >> >
> > >> > Hi ,
> > >> >
> > >> > I'm trying to create Logical Network and assign it to cluster &
> want to
> > >> bond
> > >> > this to one of the Network Interface on Host. so that i can isolate
> my
> > >> VM
> > >> > from other networks.
> > >> >
> > >> > The issue is even if i set Cluster while creating Logical Network,
> it
> > >> is not
> > >> > setting the cluster. In Web Admin it is in unset state.
> > >> >
> > >> > Also, let me know how do i bind this Logical network on Host
> Interface.
> > >> >
> > >> > Java code:
> > >> >
> > >> > Network nw1=new Network();
> > >> > VLAN vlan = new VLAN();
> > >> > vlan.setId(2000);
> > >> > nw1.setVlan(vlan);
> > >> > IP ip = new IP();
> > >> > ip.setAddress("192.168.1.151");
> > >> > ip.setGateway("192.168.1.1");
> > >> > ip.setNetmask("255.255.255.0");
> > >>
> > >> Note that the stated IP above will not be used to set the address on
> the
> > >> host itself.
> > >> In order to do so you should use either the 'setup networks' api on
> > >> host's nics level.
> > >> (Alternately, you can send POST request to /hosts/{host:id}/nics which
> > >> utilize the
> > >> former api (it is a bit simpler than using the setup networks api).
> > >>
> > >> Should look like:
> > >>     Host host = api.getHosts().get("host_name");
> > >>     Action action = new Action();
> > >>     action.setCheckConnectivity(true); //required for rollback in
> case of
> > >> configuration failure
> > >>     action.setHostNics(...); // should contain the target
> configuration
> > >>     host.getHostNics().setupnetworks(action);
> > >>
> > >> where the action should contain the entire desired network
> configuration.
> > >>
> > >> You can find various python-sdk example for setup networks on my blog
> [1]
> > >> I'll post few examples using the java sdk earlier next week.
> > >>
> > >> [1] https://motiasayag.wordpress.com/
> > >>
> > >> > nw1.setIp(ip);
> > >> > nw1.setName("apiNetwork");
> > >> >
> > >> > nw1.setDataCenter(api.getDataCenters().get("testDC"));
> > >> > nw1.setCluster(api.getClusters().get("testCluster"));
> > >> >
> > >> > org.ovirt.engine.sdk.decorators.Network nw2 =
> > >> api.getNetworks().add(nw1);
> > >> >
> > >> > --
> > >> > Thanks & Regards
> > >> > Tejesh
> > >> >
> > >> > _______________________________________________
> > >> > Users mailing list
> > >> > Users at ovirt.org
> > >> > http://lists.ovirt.org/mailman/listinfo/users
> > >> >
> > >>
> > >
> > >
> > >
> > > --
> > > Thanks & Regards
> > > Tejesh
> > >
> >
> >
> >
> > --
> > Thanks & Regards
> > Tejesh
> >
>



-- 
Thanks & Regards
Tejesh
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ovirt.org/pipermail/users/attachments/20140224/dc9b1fe0/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: LogicalNetwork Map.png
Type: image/png
Size: 55404 bytes
Desc: not available
URL: <http://lists.ovirt.org/pipermail/users/attachments/20140224/dc9b1fe0/attachment-0001.png>


More information about the Users mailing list