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