[Engine-devel] Problem with detachment of host interface using ovirt-sdk

--_000_4488206DC085244C886DBC9E7038B68918D382CEMTRDAG01mtlcom_ Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hi, I'm using ovirt-sdk to attach and detach a network to a host's Interface. Once the network is attached to the interface I try to detach the network f= rom the interface using the following steps: 1.Detach the network from the cluster through the GUI. 2.Remove the network from the datacenter through the GUI. 3.Detach the network from the host's interface using the SDK: nic =3D api.hosts.get(name=3Dhost).nics.get(name=3Dif_name) net =3D params.Network(name=3Dnet_name) act =3D params.Action(network=3Dnet) nic.detach(act) api.hosts.get(name=3Dhost).commitnetconfig() Then I get the error: http://pastebin.com/3Md07huE The same flow using the GUI works fine. Network removal from the Datacenter is a trigger for me to run the detachme= nt operation therefore I use this flow. I use the following components: rhevm-3.0.2_0001-2 ovirt-sdk (Using the latest from git repository) Please advise how to proceed. Thanks, Itzik --_000_4488206DC085244C886DBC9E7038B68918D382CEMTRDAG01mtlcom_ Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable <html xmlns:v=3D"urn:schemas-microsoft-com:vml" xmlns:o=3D"urn:schemas-micr= osoft-com:office:office" xmlns:w=3D"urn:schemas-microsoft-com:office:word" = xmlns:m=3D"http://schemas.microsoft.com/office/2004/12/omml" xmlns=3D"http:= //www.w3.org/TR/REC-html40"> <head> <meta http-equiv=3D"Content-Type" content=3D"text/html; charset=3Dus-ascii"=
<meta name=3D"Generator" content=3D"Microsoft Word 14 (filtered medium)"> <style><!-- /* Font Definitions */ @font-face {font-family:"Cambria Math"; panose-1:2 4 5 3 5 4 6 3 2 4;} @font-face {font-family:Calibri; panose-1:2 15 5 2 2 2 4 3 2 4;} @font-face {font-family:"Courrier New"; panose-1:0 0 0 0 0 0 0 0 0 0;} /* Style Definitions */ p.MsoNormal, li.MsoNormal, div.MsoNormal {margin:0cm; margin-bottom:.0001pt; text-align:right; direction:rtl; unicode-bidi:embed; font-size:11.0pt; font-family:"Calibri","sans-serif";} a:link, span.MsoHyperlink {mso-style-priority:99; color:blue; text-decoration:underline;} a:visited, span.MsoHyperlinkFollowed {mso-style-priority:99; color:purple; text-decoration:underline;} span.EmailStyle17 {mso-style-type:personal-compose; font-family:"Calibri","sans-serif"; color:windowtext;} .MsoChpDefault {mso-style-type:export-only; font-family:"Calibri","sans-serif";} @page WordSection1 {size:612.0pt 792.0pt; margin:72.0pt 90.0pt 72.0pt 90.0pt;} div.WordSection1 {page:WordSection1;} --></style><!--[if gte mso 9]><xml> <o:shapedefaults v:ext=3D"edit" spidmax=3D"1026" /> </xml><![endif]--><!--[if gte mso 9]><xml> <o:shapelayout v:ext=3D"edit"> <o:idmap v:ext=3D"edit" data=3D"1" /> </o:shapelayout></xml><![endif]--> </head> <body lang=3D"EN-US" link=3D"blue" vlink=3D"purple"> <div class=3D"WordSection1"> <p class=3D"MsoNormal" style=3D"text-align:left;direction:ltr;unicode-bidi:= embed">Hi,<o:p></o:p></p> <p class=3D"MsoNormal" style=3D"text-align:left;direction:ltr;unicode-bidi:= embed"><o:p> </o:p></p> <p class=3D"MsoNormal" style=3D"text-align:left;direction:ltr;unicode-bidi:= embed">I'm using ovirt-sdk to attach and detach a network to a host's Inter= face.<o:p></o:p></p> <p class=3D"MsoNormal" style=3D"text-align:left;direction:ltr;unicode-bidi:= embed">Once the network is attached to the interface I try to detach the ne= twork from the interface using the following steps:<span lang=3D"HE" dir=3D= "RTL" style=3D"font-family:"Arial","sans-serif""><o:p><= /o:p></span></p> <p class=3D"MsoNormal" style=3D"text-align:left;direction:ltr;unicode-bidi:= embed"><o:p> </o:p></p> <p class=3D"MsoNormal" style=3D"text-align:left;direction:ltr;unicode-bidi:= embed">1.Detach the network from the cluster through the GUI.<o:p></o:p></p=
<p class=3D"MsoNormal" style=3D"text-align:left;direction:ltr;unicode-bidi:= embed">2.Remove the network from the datacenter through the GUI.<o:p></o:p>= </p> <p class=3D"MsoNormal" style=3D"text-align:left;direction:ltr;unicode-bidi:= embed">3.Detach the network from the host's interface using the SDK:<o:p></= o:p></p> <p class=3D"MsoNormal" style=3D"text-align:left;direction:ltr;unicode-bidi:= embed"><o:p> </o:p></p> <p class=3D"MsoNormal" style=3D"text-align:left;text-autospace:none;directi= on:ltr;unicode-bidi:embed"> <span style=3D"font-size:10.0pt;font-family:"Courrier New"">nic = =3D api.hosts.get(name=3Dhost).nics.get(name=3Dif_name)<span style=3D"color= :#404040;background:gray;mso-highlight:gray"><o:p></o:p></span></span></p> <p class=3D"MsoNormal" style=3D"text-align:left;text-autospace:none;directi= on:ltr;unicode-bidi:embed"> <span style=3D"font-size:10.0pt;font-family:"Courrier New"">net = =3D params.Network(name=3Dnet_name)<span style=3D"color:#404040;background:= gray;mso-highlight:gray"><o:p></o:p></span></span></p> <p class=3D"MsoNormal" style=3D"text-align:left;text-autospace:none;directi= on:ltr;unicode-bidi:embed"> <span style=3D"font-size:10.0pt;font-family:"Courrier New"">act = =3D params.Action(network=3Dnet)<span style=3D"color:#404040;background:gra= y;mso-highlight:gray"><o:p></o:p></span></span></p> <p class=3D"MsoNormal" style=3D"text-align:left;text-autospace:none;directi= on:ltr;unicode-bidi:embed"> <span style=3D"font-size:10.0pt;font-family:"Courrier New"">nic.d= etach(act)<span style=3D"color:#404040;background:gray;mso-highlight:gray">= <o:p></o:p></span></span></p> <p class=3D"MsoNormal" style=3D"text-align:left;text-autospace:none;directi= on:ltr;unicode-bidi:embed"> <span style=3D"font-size:10.0pt;font-family:"Courrier New"">api.h= osts.get(name=3Dhost).commitnetconfig()<span style=3D"color:#404040;backgro= und:gray;mso-highlight:gray"><o:p></o:p></span></span></p> <p class=3D"MsoNormal" style=3D"text-align:left;direction:ltr;unicode-bidi:= embed"><o:p> </o:p></p> <p class=3D"MsoNormal" style=3D"text-align:left;direction:ltr;unicode-bidi:= embed">Then I get the error:<o:p></o:p></p> <p class=3D"MsoNormal" style=3D"text-align:left;direction:ltr;unicode-bidi:= embed"><a href=3D"http://pastebin.com/3Md07huE">http://pastebin.com/3Md07hu= E</a><o:p></o:p></p> <p class=3D"MsoNormal" style=3D"text-align:left;direction:ltr;unicode-bidi:= embed"><o:p> </o:p></p> <p class=3D"MsoNormal" style=3D"text-align:left;direction:ltr;unicode-bidi:= embed">The same flow using the GUI works fine.<o:p></o:p></p> <p class=3D"MsoNormal" style=3D"text-align:left;direction:ltr;unicode-bidi:= embed"><o:p> </o:p></p> <p class=3D"MsoNormal" style=3D"text-align:left;direction:ltr;unicode-bidi:= embed">Network removal from the Datacenter is a trigger for me to run the d= etachment operation therefore I use this flow.<o:p></o:p></p> <p class=3D"MsoNormal" style=3D"text-align:left;direction:ltr;unicode-bidi:= embed"><o:p> </o:p></p> <p class=3D"MsoNormal" style=3D"text-align:left;direction:ltr;unicode-bidi:= embed">I use the following components:<o:p></o:p></p> <p class=3D"MsoNormal" style=3D"text-align:left;direction:ltr;unicode-bidi:= embed"><o:p> </o:p></p> <p class=3D"MsoNormal" style=3D"text-align:left;direction:ltr;unicode-bidi:= embed"><span style=3D"font-size:10.0pt;font-family:"Courrier New"= ">rhevm-3.0.2_0001-2</span><o:p></o:p></p> <p class=3D"MsoNormal" style=3D"text-align:left;direction:ltr;unicode-bidi:= embed">ovirt-sdk (Using the latest from git repository)<o:p></o:p></p> <p class=3D"MsoNormal" style=3D"text-align:left;direction:ltr;unicode-bidi:= embed"><o:p> </o:p></p> <p class=3D"MsoNormal" style=3D"text-align:left;direction:ltr;unicode-bidi:= embed">Please advise how to proceed.<o:p></o:p></p> <p class=3D"MsoNormal" style=3D"text-align:left;direction:ltr;unicode-bidi:= embed"><o:p> </o:p></p> <p class=3D"MsoNormal" style=3D"text-align:left;direction:ltr;unicode-bidi:= embed">Thanks,<o:p></o:p></p> <p class=3D"MsoNormal" style=3D"text-align:left;direction:ltr;unicode-bidi:= embed">Itzik<o:p></o:p></p> </div> </body> </html> --_000_4488206DC085244C886DBC9E7038B68918D382CEMTRDAG01mtlcom_--

This is a multi-part message in MIME format. --------------090806000008060006080602 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit On 03/22/2012 10:43 AM, Itzik Brown wrote:
Hi,
I'm using ovirt-sdk to attach and detach a network to a host's Interface.
Once the network is attached to the interface I try to detach the network from the interface using the following steps:
1.Detach the network from the cluster through the GUI.
2.Remove the network from the datacenter through the GUI.
3.Detach the network from the host's interface using the SDK:
nic = api.hosts.get(name=host).nics.get(name=if_name)
net = params.Network(name=net_name)
act = params.Action(network=net)
nic.detach(act)
api.hosts.get(name=host).commitnetconfig()
Then I get the error:
The same flow using the GUI works fine.
Network removal from the Datacenter is a trigger for me to run the detachment operation therefore I use this flow.
I use the following components:
rhevm-3.0.2_0001-2
ovirt-sdk (Using the latest from git repository)
Please advise how to proceed.
Thanks,
Itzik
This body part will be downloaded on demand.
Ovirt-sdk and rhevm don't comply (ovirt-sdk is based on the upstream version of rhevm) Use the REST api instead: curl -X POST user@domain:password -H "Content-Type: application/xml" -d@/path/to/file.xml https://rhevm:8843/api/hosts/{host-id}/nics/{nic-id}/detach file.xml: <action> <host_nic> <name>eth0</name> </host_nic> </action> --------------090806000008060006080602 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit <html> <head> <meta content="text/html; charset=ISO-8859-1" http-equiv="Content-Type"> </head> <body bgcolor="#FFFFFF" text="#000000"> On 03/22/2012 10:43 AM, Itzik Brown wrote: <blockquote cite="mid:4488206DC085244C886DBC9E7038B68918D382CE@MTRDAG01.mtl.com" type="cite"> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> <meta name="Generator" content="Microsoft Word 14 (filtered medium)"> <style><!-- /* Font Definitions */ @font-face {font-family:"Cambria Math"; panose-1:2 4 5 3 5 4 6 3 2 4;} @font-face {font-family:Calibri; panose-1:2 15 5 2 2 2 4 3 2 4;} @font-face {font-family:"Courrier New"; panose-1:0 0 0 0 0 0 0 0 0 0;} /* Style Definitions */ p.MsoNormal, li.MsoNormal, div.MsoNormal {margin:0cm; margin-bottom:.0001pt; text-align:right; direction:rtl; unicode-bidi:embed; font-size:11.0pt; font-family:"Calibri","sans-serif";} a:link, span.MsoHyperlink {mso-style-priority:99; color:blue; text-decoration:underline;} a:visited, span.MsoHyperlinkFollowed {mso-style-priority:99; color:purple; text-decoration:underline;} span.EmailStyle17 {mso-style-type:personal-compose; font-family:"Calibri","sans-serif"; color:windowtext;} .MsoChpDefault {mso-style-type:export-only; font-family:"Calibri","sans-serif";} @page WordSection1 {size:612.0pt 792.0pt; margin:72.0pt 90.0pt 72.0pt 90.0pt;} div.WordSection1 {page:WordSection1;} --></style><!--[if gte mso 9]><xml> <o:shapedefaults v:ext="edit" spidmax="1026" /> </xml><![endif]--><!--[if gte mso 9]><xml> <o:shapelayout v:ext="edit"> <o:idmap v:ext="edit" data="1" /> </o:shapelayout></xml><![endif]--> <div class="WordSection1"> <p class="MsoNormal" style="text-align:left;direction:ltr;unicode-bidi:embed">Hi,<o:p></o:p></p> <p class="MsoNormal" style="text-align:left;direction:ltr;unicode-bidi:embed"><o:p> </o:p></p> <p class="MsoNormal" style="text-align:left;direction:ltr;unicode-bidi:embed">I'm using ovirt-sdk to attach and detach a network to a host's Interface.<o:p></o:p></p> <p class="MsoNormal" style="text-align:left;direction:ltr;unicode-bidi:embed">Once the network is attached to the interface I try to detach the network from the interface using the following steps:<span dir="RTL" style="font-family:"Arial","sans-serif"" lang="HE"><o:p></o:p></span></p> <p class="MsoNormal" style="text-align:left;direction:ltr;unicode-bidi:embed"><o:p> </o:p></p> <p class="MsoNormal" style="text-align:left;direction:ltr;unicode-bidi:embed">1.Detach the network from the cluster through the GUI.<o:p></o:p></p> <p class="MsoNormal" style="text-align:left;direction:ltr;unicode-bidi:embed">2.Remove the network from the datacenter through the GUI.<o:p></o:p></p> <p class="MsoNormal" style="text-align:left;direction:ltr;unicode-bidi:embed">3.Detach the network from the host's interface using the SDK:<o:p></o:p></p> <p class="MsoNormal" style="text-align:left;direction:ltr;unicode-bidi:embed"><o:p> </o:p></p> <p class="MsoNormal" style="text-align:left;text-autospace:none;direction:ltr;unicode-bidi:embed"><span style="font-size:10.0pt;font-family:"Courrier New"">nic = api.hosts.get(name=host).nics.get(name=if_name)<span style="color:#404040;background:gray;mso-highlight:gray"><o:p></o:p></span></span></p> <p class="MsoNormal" style="text-align:left;text-autospace:none;direction:ltr;unicode-bidi:embed"><span style="font-size:10.0pt;font-family:"Courrier New"">net = params.Network(name=net_name)<span style="color:#404040;background:gray;mso-highlight:gray"><o:p></o:p></span></span></p> <p class="MsoNormal" style="text-align:left;text-autospace:none;direction:ltr;unicode-bidi:embed"><span style="font-size:10.0pt;font-family:"Courrier New"">act = params.Action(network=net)<span style="color:#404040;background:gray;mso-highlight:gray"><o:p></o:p></span></span></p> <p class="MsoNormal" style="text-align:left;text-autospace:none;direction:ltr;unicode-bidi:embed"><span style="font-size:10.0pt;font-family:"Courrier New"">nic.detach(act)<span style="color:#404040;background:gray;mso-highlight:gray"><o:p></o:p></span></span></p> <p class="MsoNormal" style="text-align:left;text-autospace:none;direction:ltr;unicode-bidi:embed"><span style="font-size:10.0pt;font-family:"Courrier New"">api.hosts.get(name=host).commitnetconfig()<span style="color:#404040;background:gray;mso-highlight:gray"><o:p></o:p></span></span></p> <p class="MsoNormal" style="text-align:left;direction:ltr;unicode-bidi:embed"><o:p> </o:p></p> <p class="MsoNormal" style="text-align:left;direction:ltr;unicode-bidi:embed">Then I get the error:<o:p></o:p></p> <p class="MsoNormal" style="text-align:left;direction:ltr;unicode-bidi:embed"><a moz-do-not-send="true" href="http://pastebin.com/3Md07huE">http://pastebin.com/3Md07huE</a><o:p></o:p></p> <p class="MsoNormal" style="text-align:left;direction:ltr;unicode-bidi:embed"><o:p> </o:p></p> <p class="MsoNormal" style="text-align:left;direction:ltr;unicode-bidi:embed">The same flow using the GUI works fine.<o:p></o:p></p> <p class="MsoNormal" style="text-align:left;direction:ltr;unicode-bidi:embed"><o:p> </o:p></p> <p class="MsoNormal" style="text-align:left;direction:ltr;unicode-bidi:embed">Network removal from the Datacenter is a trigger for me to run the detachment operation therefore I use this flow.<o:p></o:p></p> <p class="MsoNormal" style="text-align:left;direction:ltr;unicode-bidi:embed"><o:p> </o:p></p> <p class="MsoNormal" style="text-align:left;direction:ltr;unicode-bidi:embed">I use the following components:<o:p></o:p></p> <p class="MsoNormal" style="text-align:left;direction:ltr;unicode-bidi:embed"><o:p> </o:p></p> <p class="MsoNormal" style="text-align:left;direction:ltr;unicode-bidi:embed"><span style="font-size:10.0pt;font-family:"Courrier New"">rhevm-3.0.2_0001-2</span><o:p></o:p></p> <p class="MsoNormal" style="text-align:left;direction:ltr;unicode-bidi:embed">ovirt-sdk (Using the latest from git repository)<o:p></o:p></p> <p class="MsoNormal" style="text-align:left;direction:ltr;unicode-bidi:embed"><o:p> </o:p></p> <p class="MsoNormal" style="text-align:left;direction:ltr;unicode-bidi:embed">Please advise how to proceed.<o:p></o:p></p> <p class="MsoNormal" style="text-align:left;direction:ltr;unicode-bidi:embed"><o:p> </o:p></p> <p class="MsoNormal" style="text-align:left;direction:ltr;unicode-bidi:embed">Thanks,<o:p></o:p></p> <p class="MsoNormal" style="text-align:left;direction:ltr;unicode-bidi:embed">Itzik<o:p></o:p></p> </div> <br> <fieldset class="mimeAttachmentHeader"></fieldset> <br> <pre wrap="">This body part will be downloaded on demand.</pre> </blockquote> Ovirt-sdk and rhevm don't comply (ovirt-sdk is based on the upstream version of rhevm)<br> <br> Use the REST api instead:<br> <br> curl -X POST user@domain:password -H "Content-Type: application/xml" -d@/path/to/file.xml <a class="moz-txt-link-freetext" href="https://rhevm:8843/api/hosts/">https://rhevm:8843/api/hosts/</a>{host-id}/nics/{nic-id}/detach<br> <br> file.xml:<br> <br> <action><br> <host_nic><br> <name>eth0</name><br> </host_nic><br> </action><br> </body> </html> --------------090806000008060006080602--

--_000_4488206DC085244C886DBC9E7038B6892516DF3Bmtrdag02mtlcom_ Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Hi, I tried using ovirt-sdk against ovirt-engine-3.0.0_0001-1.6. I still get the same result: 10:29:26,554 WARN [org.jboss.resteasy.core.SynchronousDispatcher] (http--0= .0.0.0-8080-4) failed to execute: org.ovirt.engine.api.restapi.resource.Bas= eBackendResource$WebFaultException at org.ovirt.engine.api.restapi.resource.BaseBackendResource.handle= Error(BaseBackendResource.java:207) [restapi-jaxrs-3.0.0-0001.jar:] at org.ovirt.engine.api.restapi.resource.BaseBackendResource.handle= Error(BaseBackendResource.java:183) [restapi-jaxrs-3.0.0-0001.jar:] at org.ovirt.engine.api.restapi.resource.BackendHostNicsResource.lo= okupNetwork(BackendHostNicsResource.java:242) [restapi-jaxrs-3.0.0-0001.jar= :] at org.ovirt.engine.api.restapi.resource.BackendHostNicResource.doA= ttachAction(BackendHostNicResource.java:56) [restapi-jaxrs-3.0.0-0001.jar:] at org.ovirt.engine.api.restapi.resource.BackendHostNicResource.det= ach(BackendHostNicResource.java:75) [restapi-jaxrs-3.0.0-0001.jar:] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [:1.= 6.0_24] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessor= Impl.java:57) [:1.6.0_24] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethod= AccessorImpl.java:43) [:1.6.0_24] at java.lang.reflect.Method.invoke(Method.java:616) [:1.6.0_24] Please advise, Itzik ________________________________ From: engine-devel-bounces@ovirt.org [engine-devel-bounces@ovirt.org] on be= half of Roy Golan [rgolan@redhat.com] Sent: Sunday, March 25, 2012 8:51 AM To: engine-devel@ovirt.org Subject: Re: [Engine-devel] Problem with detachment of host interface using= ovirt-sdk On 03/22/2012 10:43 AM, Itzik Brown wrote: Hi, I'm using ovirt-sdk to attach and detach a network to a host's Interface. Once the network is attached to the interface I try to detach the network f= rom the interface using the following steps: 1.Detach the network from the cluster through the GUI. 2.Remove the network from the datacenter through the GUI. 3.Detach the network from the host's interface using the SDK: nic =3D api.hosts.get(name=3Dhost).nics.get(name=3Dif_name) net =3D params.Network(name=3Dnet_name) act =3D params.Action(network=3Dnet) nic.detach(act) api.hosts.get(name=3Dhost).commitnetconfig() Then I get the error: http://pastebin.com/3Md07huE The same flow using the GUI works fine. Network removal from the Datacenter is a trigger for me to run the detachme= nt operation therefore I use this flow. I use the following components: rhevm-3.0.2_0001-2 ovirt-sdk (Using the latest from git repository) Please advise how to proceed. Thanks, Itzik This body part will be downloaded on demand. Ovirt-sdk and rhevm don't comply (ovirt-sdk is based on the upstream versio= n of rhevm) Use the REST api instead: curl -X POST user@domain:password -H "Content-Type: application/xml" -d@/pa= th/to/file.xml https://rhevm:8843/api/hosts/{host-id}/nics/{nic-id}/detach file.xml: <action> <host_nic> <name>eth0</name> </host_nic> </action> --_000_4488206DC085244C886DBC9E7038B6892516DF3Bmtrdag02mtlcom_ Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable <html dir=3D"ltr"> <head> <meta http-equiv=3D"Content-Type" content=3D"text/html; charset=3Diso-8859-= 1"> <style id=3D"owaParaStyle" type=3D"text/css"></style> </head> <body ocsi=3D"0" fpstyle=3D"1" bgcolor=3D"#FFFFFF"> <div style=3D"direction: ltr;font-family: Tahoma;color: #000000;font-size: = 10pt;">Hi,<br> <br> I tried using ovirt-sdk against ovirt-engine-3.0.0_0001-1.6.<br> I still get the same result:<br> <br> 10:29:26,554 WARN [org.jboss.resteasy.core.SynchronousDispatcher] (ht= tp--0.0.0.0-8080-4) failed to execute: org.ovirt.engine.api.restapi.resourc= e.BaseBackendResource$WebFaultException<br> at org.ovirt.engine.api.restapi.= resource.BaseBackendResource.handleError(BaseBackendResource.java:207) [res= tapi-jaxrs-3.0.0-0001.jar:]<br> at org.ovirt.engine.api.restapi.= resource.BaseBackendResource.handleError(BaseBackendResource.java:183) [res= tapi-jaxrs-3.0.0-0001.jar:]<br> at org.ovirt.engine.api.restapi.= resource.BackendHostNicsResource.lookupNetwork(BackendHostNicsResource.java= :242) [restapi-jaxrs-3.0.0-0001.jar:]<br> at org.ovirt.engine.api.restapi.= resource.BackendHostNicResource.doAttachAction(BackendHostNicResource.java:= 56) [restapi-jaxrs-3.0.0-0001.jar:]<br> at org.ovirt.engine.api.restapi.= resource.BackendHostNicResource.detach(BackendHostNicResource.java:75) [res= tapi-jaxrs-3.0.0-0001.jar:]<br> at sun.reflect.NativeMethodAcces= sorImpl.invoke0(Native Method) [:1.6.0_24]<br> at sun.reflect.NativeMethodAcces= sorImpl.invoke(NativeMethodAccessorImpl.java:57) [:1.6.0_24]<br> at sun.reflect.DelegatingMethodA= ccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [:1.6.0_24]<br> at java.lang.reflect.Method.invo= ke(Method.java:616) [:1.6.0_24]<br> <br> Please advise,<br> Itzik<br> <br> <div style=3D"font-family: Times New Roman; color: #000000; font-size: 16px= "> <hr tabindex=3D"-1"> <div style=3D"direction: ltr;" id=3D"divRpF595604"><font color=3D"#000000" = face=3D"Tahoma" size=3D"2"><b>From:</b> engine-devel-bounces@ovirt.org [eng= ine-devel-bounces@ovirt.org] on behalf of Roy Golan [rgolan@redhat.com]<br> <b>Sent:</b> Sunday, March 25, 2012 8:51 AM<br> <b>To:</b> engine-devel@ovirt.org<br> <b>Subject:</b> Re: [Engine-devel] Problem with detachment of host interfac= e using ovirt-sdk<br> </font><br> </div> <div></div> <div>On 03/22/2012 10:43 AM, Itzik Brown wrote: <blockquote type=3D"cite"><style>=0A= <!--=0A= @font-face=0A= {font-family:"Cambria Math"}=0A= @font-face=0A= {font-family:Calibri}=0A= @font-face=0A= {font-family:"Courrier New"}=0A= p.MsoNormal, li.MsoNormal, div.MsoNormal=0A= {margin:0cm;=0A= margin-bottom:.0001pt;=0A= text-align:right;=0A= direction:rtl;=0A= unicode-bidi:embed;=0A= font-size:11.0pt;=0A= font-family:"Calibri","sans-serif"}=0A= a:link, span.MsoHyperlink=0A= {color:blue;=0A= text-decoration:underline}=0A= a:visited, span.MsoHyperlinkFollowed=0A= {color:purple;=0A= text-decoration:underline}=0A= span.EmailStyle17=0A= {font-family:"Calibri","sans-serif";=0A= color:windowtext}=0A= .MsoChpDefault=0A= {font-family:"Calibri","sans-serif"}=0A= @page WordSection1=0A= {margin:72.0pt 90.0pt 72.0pt 90.0pt}=0A= -->=0A= BODY {direction: ltr;font-family: Tahoma;color: #000000;font-size: 10pt;}P = {margin-top:0;margin-bottom:0;}</style> <div class=3D"WordSection1"> <p class=3D"MsoNormal" style=3D"text-align:left; direction:ltr; unicode-bid= i:embed">Hi,</p> <p class=3D"MsoNormal" style=3D"text-align:left; direction:ltr; unicode-bid= i:embed"> </p> <p class=3D"MsoNormal" style=3D"text-align:left; direction:ltr; unicode-bid= i:embed">I'm using ovirt-sdk to attach and detach a network to a host's Int= erface.</p> <p class=3D"MsoNormal" style=3D"text-align:left; direction:ltr; unicode-bid= i:embed">Once the network is attached to the interface I try to detach the = network from the interface using the following steps:<span dir=3D"RTL" styl= e=3D"font-family:"Arial","sans-serif"" lang=3D"HE"></sp= an></p> <p class=3D"MsoNormal" style=3D"text-align:left; direction:ltr; unicode-bid= i:embed"> </p> <p class=3D"MsoNormal" style=3D"text-align:left; direction:ltr; unicode-bid= i:embed">1.Detach the network from the cluster through the GUI.</p> <p class=3D"MsoNormal" style=3D"text-align:left; direction:ltr; unicode-bid= i:embed">2.Remove the network from the datacenter through the GUI.</p> <p class=3D"MsoNormal" style=3D"text-align:left; direction:ltr; unicode-bid= i:embed">3.Detach the network from the host's interface using the SDK:</p> <p class=3D"MsoNormal" style=3D"text-align:left; direction:ltr; unicode-bid= i:embed"> </p> <p class=3D"MsoNormal" style=3D"text-align:left; text-autospace:none; direc= tion:ltr; unicode-bidi:embed"> <span style=3D"">nic =3D api.hosts.get(name=3Dhost).nics.get(name=3Dif_name= )<span style=3D"color:#404040; background:gray"></span></span></p> <p class=3D"MsoNormal" style=3D"text-align:left; text-autospace:none; direc= tion:ltr; unicode-bidi:embed"> <span style=3D"">net =3D params.Network(name=3Dnet_name)<span style=3D"colo= r:#404040; background:gray"></span></span></p> <p class=3D"MsoNormal" style=3D"text-align:left; text-autospace:none; direc= tion:ltr; unicode-bidi:embed"> <span style=3D"">act =3D params.Action(network=3Dnet)<span style=3D"color:#= 404040; background:gray"></span></span></p> <p class=3D"MsoNormal" style=3D"text-align:left; text-autospace:none; direc= tion:ltr; unicode-bidi:embed"> <span style=3D"">nic.detach(act)<span style=3D"color:#404040; background:gr= ay"></span></span></p> <p class=3D"MsoNormal" style=3D"text-align:left; text-autospace:none; direc= tion:ltr; unicode-bidi:embed"> <span style=3D"">api.hosts.get(name=3Dhost).commitnetconfig()<span style=3D= "color:#404040; background:gray"></span></span></p> <p class=3D"MsoNormal" style=3D"text-align:left; direction:ltr; unicode-bid= i:embed"> </p> <p class=3D"MsoNormal" style=3D"text-align:left; direction:ltr; unicode-bid= i:embed">Then I get the error:</p> <p class=3D"MsoNormal" style=3D"text-align:left; direction:ltr; unicode-bid= i:embed"><a href=3D"http://pastebin.com/3Md07huE" target=3D"_blank">http://= pastebin.com/3Md07huE</a></p> <p class=3D"MsoNormal" style=3D"text-align:left; direction:ltr; unicode-bid= i:embed"> </p> <p class=3D"MsoNormal" style=3D"text-align:left; direction:ltr; unicode-bid= i:embed">The same flow using the GUI works fine.</p> <p class=3D"MsoNormal" style=3D"text-align:left; direction:ltr; unicode-bid= i:embed"> </p> <p class=3D"MsoNormal" style=3D"text-align:left; direction:ltr; unicode-bid= i:embed">Network removal from the Datacenter is a trigger for me to run the= detachment operation therefore I use this flow.</p> <p class=3D"MsoNormal" style=3D"text-align:left; direction:ltr; unicode-bid= i:embed"> </p> <p class=3D"MsoNormal" style=3D"text-align:left; direction:ltr; unicode-bid= i:embed">I use the following components:</p> <p class=3D"MsoNormal" style=3D"text-align:left; direction:ltr; unicode-bid= i:embed"> </p> <p class=3D"MsoNormal" style=3D"text-align:left; direction:ltr; unicode-bid= i:embed"><span style=3D"">rhevm-3.0.2_0001-2</span></p> <p class=3D"MsoNormal" style=3D"text-align:left; direction:ltr; unicode-bid= i:embed">ovirt-sdk (Using the latest from git repository)</p> <p class=3D"MsoNormal" style=3D"text-align:left; direction:ltr; unicode-bid= i:embed"> </p> <p class=3D"MsoNormal" style=3D"text-align:left; direction:ltr; unicode-bid= i:embed">Please advise how to proceed.</p> <p class=3D"MsoNormal" style=3D"text-align:left; direction:ltr; unicode-bid= i:embed"> </p> <p class=3D"MsoNormal" style=3D"text-align:left; direction:ltr; unicode-bid= i:embed">Thanks,</p> <p class=3D"MsoNormal" style=3D"text-align:left; direction:ltr; unicode-bid= i:embed">Itzik</p> </div> <br> <fieldset class=3D"mimeAttachmentHeader" target=3D"_blank"></fieldset> <br> <pre>This body part will be downloaded on demand.</pre> </blockquote> Ovirt-sdk and rhevm don't comply (ovirt-sdk is based on the upstream versio= n of rhevm)<br> <br> Use the REST api instead:<br> <br> curl -X POST user@domain:password -H "Content-Type: application/xml&qu= ot; -d@/path/to/file.xml <a class=3D"moz-txt-link-freetext" href=3D"https://rhevm:8843/api/hosts/" t= arget=3D"_blank"> https://rhevm:8843/api/hosts/</a>{host-id}/nics/{nic-id}/detach<br> <br> file.xml:<br> <br> <action><br> <host_nic><br> <name>eth0</name><br> </host_nic><br> </action><br> </div> </div> </div> </body> </html> --_000_4488206DC085244C886DBC9E7038B6892516DF3Bmtrdag02mtlcom_--

Itzik, can you provide the complete python script that is generating that fault? I will try to reproduce it in my environment. It will be also helpful to know the exact version of ovirt-engine-sdk that you are using. If you cloned the git repository just tell me what is the commit. On 04/02/2012 09:45 AM, Itzik Brown wrote:
Hi,
I tried using ovirt-sdk against ovirt-engine-3.0.0_0001-1.6. I still get the same result:
10:29:26,554 WARN [org.jboss.resteasy.core.SynchronousDispatcher] (http--0.0.0.0-8080-4) failed to execute: org.ovirt.engine.api.restapi.resource.BaseBackendResource$WebFaultException at org.ovirt.engine.api.restapi.resource.BaseBackendResource.handleError(BaseBackendResource.java:207) [restapi-jaxrs-3.0.0-0001.jar:] at org.ovirt.engine.api.restapi.resource.BaseBackendResource.handleError(BaseBackendResource.java:183) [restapi-jaxrs-3.0.0-0001.jar:] at org.ovirt.engine.api.restapi.resource.BackendHostNicsResource.lookupNetwork(BackendHostNicsResource.java:242) [restapi-jaxrs-3.0.0-0001.jar:] at org.ovirt.engine.api.restapi.resource.BackendHostNicResource.doAttachAction(BackendHostNicResource.java:56) [restapi-jaxrs-3.0.0-0001.jar:] at org.ovirt.engine.api.restapi.resource.BackendHostNicResource.detach(BackendHostNicResource.java:75) [restapi-jaxrs-3.0.0-0001.jar:] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [:1.6.0_24] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [:1.6.0_24] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [:1.6.0_24] at java.lang.reflect.Method.invoke(Method.java:616) [:1.6.0_24]
Please advise, Itzik
________________________________ From: engine-devel-bounces@ovirt.org [engine-devel-bounces@ovirt.org] on behalf of Roy Golan [rgolan@redhat.com] Sent: Sunday, March 25, 2012 8:51 AM To: engine-devel@ovirt.org Subject: Re: [Engine-devel] Problem with detachment of host interface using ovirt-sdk
On 03/22/2012 10:43 AM, Itzik Brown wrote: Hi,
I'm using ovirt-sdk to attach and detach a network to a host's Interface. Once the network is attached to the interface I try to detach the network from the interface using the following steps:
1.Detach the network from the cluster through the GUI. 2.Remove the network from the datacenter through the GUI. 3.Detach the network from the host's interface using the SDK:
nic = api.hosts.get(name=host).nics.get(name=if_name) net = params.Network(name=net_name) act = params.Action(network=net) nic.detach(act) api.hosts.get(name=host).commitnetconfig()
Then I get the error: http://pastebin.com/3Md07huE
The same flow using the GUI works fine.
Network removal from the Datacenter is a trigger for me to run the detachment operation therefore I use this flow.
I use the following components:
rhevm-3.0.2_0001-2 ovirt-sdk (Using the latest from git repository)
Please advise how to proceed.
Thanks, Itzik
This body part will be downloaded on demand.
Ovirt-sdk and rhevm don't comply (ovirt-sdk is based on the upstream version of rhevm)
Use the REST api instead:
curl -X POST user@domain:password -H "Content-Type: application/xml" -d@/path/to/file.xml https://rhevm:8843/api/hosts/{host-id}/nics/{nic-id}/detach
file.xml:
<action> <host_nic> <name>eth0</name> </host_nic> </action>
_______________________________________________ Engine-devel mailing list Engine-devel@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-devel
-- Dirección Comercial: C/Jose Bardasano Baos, 9, Edif. Gorbea 3, planta 3ºD, 28016 Madrid, Spain Inscrita en el Reg. Mercantil de Madrid – C.I.F. B82657941 - Red Hat S.L.
participants (3)
-
Itzik Brown
-
Juan Hernandez
-
Roy Golan