[Users] Creating Logical Network issue - API

Tejesh M tejeshmk at gmail.com
Fri Feb 21 08:29:52 UTC 2014


Thanks, can you post sample on Assigning Multiple Logical Network to
Physical Network in Java?

I have create the Logical Network and attached to Cluster. Now i want to
Assign or Map this to Physical Network?

Also, How to Bond Two Physical NICs and Map or Assign Multiple Logical
Networks.


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ovirt.org/pipermail/users/attachments/20140221/ed07a909/attachment-0001.html>


More information about the Users mailing list