<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>&nbsp;</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:&quot;Arial&quot;,&quot;sans-serif&quot;"
            lang="HE"><o:p></o:p></span></p>
        <p class="MsoNormal"
          style="text-align:left;direction:ltr;unicode-bidi:embed"><o:p>&nbsp;</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>&nbsp;</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:&quot;Courrier
            New&quot;">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:&quot;Courrier
            New&quot;">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:&quot;Courrier
            New&quot;">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:&quot;Courrier
            New&quot;">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:&quot;Courrier
            New&quot;">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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</o:p></p>
        <p class="MsoNormal"
          style="text-align:left;direction:ltr;unicode-bidi:embed"><span
            style="font-size:10.0pt;font-family:&quot;Courrier
            New&quot;">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>&nbsp;</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>&nbsp;</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>
    &lt;action&gt;<br>
    &nbsp; &lt;host_nic&gt;<br>
    &nbsp;&nbsp;&nbsp; &lt;name&gt;eth0&lt;/name&gt;<br>
    &nbsp; &lt;/host_nic&gt;<br>
    &lt;/action&gt;<br>
  </body>
</html>