<html dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style id="owaParaStyle" type="text/css"></style>
</head>
<body ocsi="0" fpstyle="1" bgcolor="#FFFFFF">
<div style="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] (http--0.0.0.0-8080-4) failed to execute: org.ovirt.engine.api.restapi.resource.BaseBackendResource$WebFaultException<br>
at org.ovirt.engine.api.restapi.resource.BaseBackendResource.handleError(BaseBackendResource.java:207) [restapi-jaxrs-3.0.0-0001.jar:]<br>
at org.ovirt.engine.api.restapi.resource.BaseBackendResource.handleError(BaseBackendResource.java:183) [restapi-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) [restapi-jaxrs-3.0.0-0001.jar:]<br>
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [:1.6.0_24]<br>
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [:1.6.0_24]<br>
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [:1.6.0_24]<br>
at java.lang.reflect.Method.invoke(Method.java:616) [:1.6.0_24]<br>
<br>
Please advise,<br>
Itzik<br>
<br>
<div style="font-family: Times New Roman; color: #000000; font-size: 16px">
<hr tabindex="-1">
<div style="direction: ltr;" id="divRpF595604"><font color="#000000" face="Tahoma" size="2"><b>From:</b> engine-devel-bounces@ovirt.org [engine-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 interface using ovirt-sdk<br>
</font><br>
</div>
<div></div>
<div>On 03/22/2012 10:43 AM, Itzik Brown wrote:
<blockquote type="cite"><style>
<!--
@font-face
        {font-family:"Cambria Math"}
@font-face
        {font-family:Calibri}
@font-face
        {font-family:"Courrier New"}
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
        {color:blue;
        text-decoration:underline}
a:visited, span.MsoHyperlinkFollowed
        {color:purple;
        text-decoration:underline}
span.EmailStyle17
        {font-family:"Calibri","sans-serif";
        color:windowtext}
.MsoChpDefault
        {font-family:"Calibri","sans-serif"}
@page WordSection1
        {margin:72.0pt 90.0pt 72.0pt 90.0pt}
-->
BODY {direction: ltr;font-family: Tahoma;color: #000000;font-size: 10pt;}P {margin-top:0;margin-bottom:0;}</style>
<div class="WordSection1">
<p class="MsoNormal" style="text-align:left; direction:ltr; unicode-bidi:embed">Hi,</p>
<p class="MsoNormal" style="text-align:left; direction:ltr; unicode-bidi:embed"> </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.</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"></span></p>
<p class="MsoNormal" style="text-align:left; direction:ltr; unicode-bidi:embed"> </p>
<p class="MsoNormal" style="text-align:left; direction:ltr; unicode-bidi:embed">1.Detach the network from the cluster through the GUI.</p>
<p class="MsoNormal" style="text-align:left; direction:ltr; unicode-bidi:embed">2.Remove the network from the datacenter through the GUI.</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:</p>
<p class="MsoNormal" style="text-align:left; direction:ltr; unicode-bidi:embed"> </p>
<p class="MsoNormal" style="text-align:left; text-autospace:none; direction:ltr; unicode-bidi:embed">
<span style="">nic = api.hosts.get(name=host).nics.get(name=if_name)<span style="color:#404040; background:gray"></span></span></p>
<p class="MsoNormal" style="text-align:left; text-autospace:none; direction:ltr; unicode-bidi:embed">
<span style="">net = params.Network(name=net_name)<span style="color:#404040; background:gray"></span></span></p>
<p class="MsoNormal" style="text-align:left; text-autospace:none; direction:ltr; unicode-bidi:embed">
<span style="">act = params.Action(network=net)<span style="color:#404040; background:gray"></span></span></p>
<p class="MsoNormal" style="text-align:left; text-autospace:none; direction:ltr; unicode-bidi:embed">
<span style="">nic.detach(act)<span style="color:#404040; background:gray"></span></span></p>
<p class="MsoNormal" style="text-align:left; text-autospace:none; direction:ltr; unicode-bidi:embed">
<span style="">api.hosts.get(name=host).commitnetconfig()<span style="color:#404040; background:gray"></span></span></p>
<p class="MsoNormal" style="text-align:left; direction:ltr; unicode-bidi:embed"> </p>
<p class="MsoNormal" style="text-align:left; direction:ltr; unicode-bidi:embed">Then I get the error:</p>
<p class="MsoNormal" style="text-align:left; direction:ltr; unicode-bidi:embed"><a href="http://pastebin.com/3Md07huE" target="_blank">http://pastebin.com/3Md07huE</a></p>
<p class="MsoNormal" style="text-align:left; direction:ltr; unicode-bidi:embed"> </p>
<p class="MsoNormal" style="text-align:left; direction:ltr; unicode-bidi:embed">The same flow using the GUI works fine.</p>
<p class="MsoNormal" style="text-align:left; direction:ltr; unicode-bidi:embed"> </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.</p>
<p class="MsoNormal" style="text-align:left; direction:ltr; unicode-bidi:embed"> </p>
<p class="MsoNormal" style="text-align:left; direction:ltr; unicode-bidi:embed">I use the following components:</p>
<p class="MsoNormal" style="text-align:left; direction:ltr; unicode-bidi:embed"> </p>
<p class="MsoNormal" style="text-align:left; direction:ltr; unicode-bidi:embed"><span style="">rhevm-3.0.2_0001-2</span></p>
<p class="MsoNormal" style="text-align:left; direction:ltr; unicode-bidi:embed">ovirt-sdk (Using the latest from git repository)</p>
<p class="MsoNormal" style="text-align:left; direction:ltr; unicode-bidi:embed"> </p>
<p class="MsoNormal" style="text-align:left; direction:ltr; unicode-bidi:embed">Please advise how to proceed.</p>
<p class="MsoNormal" style="text-align:left; direction:ltr; unicode-bidi:embed"> </p>
<p class="MsoNormal" style="text-align:left; direction:ltr; unicode-bidi:embed">Thanks,</p>
<p class="MsoNormal" style="text-align:left; direction:ltr; unicode-bidi:embed">Itzik</p>
</div>
<br>
<fieldset class="mimeAttachmentHeader" target="_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 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/" target="_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>