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:
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(a)/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/3Md0...
<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(a)/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--