<div dir="ltr">Ok got it..<br>I just observed that my setup network is not getting saved, after attaching my logical network to host nic.<br></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, Mar 3, 2014 at 7:34 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"><br>
<br>
----- 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, March 3, 2014 3:46:14 PM<br>
> Subject: Re: [Users] Creating Logical Network issue - API<br>
><br>
> Thanks, I'm able to create logical network & attached the same to host.<br>
><br>
> Now I tried to change the network for a VM nic from rhevm to VLAN1189, but<br>
> it is not working. any suggestion?<br>
><br>
><br>
> api.getVMs().get(vmName).getNics().get("nic1").setNetwork(api.getNetworks().get("VLAN1189"));<br>
> api.getVMs().get(vmName).getNics().get("nic1").update();<br>
><br>
<br>
This snippet is wrong: You attempt to modify a newly fetched<br>
vnic than the one that was just modified in the first line.<br>
<br>
I'd try:<br>
VMNIC vnic = api.getVMs().get(vmName).getNics().get("nic1");<br>
vnic.setNetwork(api.getNetworks().get("VLAN1189"));<br>
vnic.update();<br>
<br>
If this doesn't work - keep reading :-)<br>
<br>
There has been a recent bug in this regards [1].<br>
<br>
You can by pass it by nullifying the vnic-profile value until getting the<br>
next stable version (or using the 3.4 rc build).<br>
<br>
You can read more about the vnic profile and see python examples here [2]<br>
<br>
[1] <a href="https://bugzilla.redhat.com/show_bug.cgi?id=1047887" target="_blank">https://bugzilla.redhat.com/show_bug.cgi?id=1047887</a><br>
Bug 1047887 - Update vnic_profile fails for VM vnic<br>
<br>
[2] <a href="https://motiasayag.wordpress.com/2014/02/02/vnic-profiles/" target="_blank">https://motiasayag.wordpress.com/2014/02/02/vnic-profiles/</a><br>
<br>
><br>
><br>
><br>
> On Mon, Feb 24, 2014 at 5:23 PM, Moti Asayag <<a href="mailto:masayag@redhat.com">masayag@redhat.com</a>> wrote:<br>
><br>
> ><br>
> ><br>
> > ----- 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 1:18:53 PM<br>
> > > Subject: Re: [Users] Creating Logical Network issue - API<br>
> > ><br>
> > > The example updates the existing Network (i.e. if the Logical Network is<br>
> > > already mapped to eth1). But what i'm looking for is how to map Logical<br>
> > > Network "ApiNetWork" to "eth1", please refer screenshot.<br>
> > ><br>
> ><br>
> > Please check the last example named "AddNetworkToNic" from<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>
> > It should achieve what you're aiming for.<br>
> ><br>
> > ><br>
> > > On Mon, Feb 24, 2014 at 4:11 PM, Moti Asayag <<a href="mailto:masayag@redhat.com">masayag@redhat.com</a>> wrote:<br>
> > ><br>
> > > > ----- 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>
> > > ><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>
> > > > ><br>
> > hst.getHostNics().get("eth1").setNetwork(api.getNetworks().get(nw_name));<br>
> > > > > //hst.getHostNics().get("eth1").setCheckConnectivity(true);<br>
> > > > ><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>><br>
> > wrote:<br>
> > > > ><br>
> > > > > > Can you tel me how do i assign Logical Network(s) to one of the<br>
> > > > 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>><br>
> > > > 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 &<br>
> > > > want to<br>
> > > > > >> bond<br>
> > > > > >> > this to one of the Network Interface on Host. so that i can<br>
> > isolate<br>
> > > > my<br>
> > > > > >> VM<br>
> > > > > >> > from other networks.<br>
> > > > > >> ><br>
> > > > > >> > The issue is even if i set Cluster while creating Logical<br>
> > Network,<br>
> > > > 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<br>
> > > > 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<br>
> > on<br>
> > > > the<br>
> > > > > >> host itself.<br>
> > > > > >> In order to do so you should use either the 'setup networks' api<br>
> > on<br>
> > > > > >> host's nics level.<br>
> > > > > >> (Alternately, you can send POST request to /hosts/{host:id}/nics<br>
> > which<br>
> > > > > >> utilize the<br>
> > > > > >> former api (it is a bit simpler than using the setup networks<br>
> > 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<br>
> > > > case of<br>
> > > > > >> configuration failure<br>
> > > > > >> action.setHostNics(...); // should contain the target<br>
> > > > configuration<br>
> > > > > >> host.getHostNics().setupnetworks(action);<br>
> > > > > >><br>
> > > > > >> where the action should contain the entire desired network<br>
> > > > configuration.<br>
> > > > > >><br>
> > > > > >> You can find various python-sdk example for setup networks on my<br>
> > blog<br>
> > > > [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>
> > > > ><br>
> > > > > --<br>
> > > > > Thanks & Regards<br>
> > > > > Tejesh<br>
> > > > ><br>
> > > ><br>
> > ><br>
> > ><br>
> > ><br>
> > > --<br>
> > > Thanks & Regards<br>
> > > Tejesh<br>
> > ><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>