using ovirt-shell to attach defind network to hosts

Hi, I would like to implement a script that would attach a newly created network to all hosts in cluster. Unfortunately I cannot find anything about that in documentation. Is it possible to attach network to host using CLI/REST API? Kind regards, Vladimir Pakhomov

--348076277-700747774-1412509025=:95644 Content-Type: text/plain; charset=us-ascii Hey Vladimir, Though there is no explicit documentation for the $subject, the concept is the same in api/cli/sdk, i.e: 1. fetch the host 2. access host's nics collection 3. get the nic 4. use attach() method to attach your network, in CLI you can use auto-completion for constructing commands and 'help action attach ...' to see action parameters, cli scripting wiki available here. also i'd suggest considering one of SDKs (python-sdk / java-sdk) for this matter. Michael Pasternak On Sunday, October 5, 2014 1:26 PM, Vladimir Pakhomov <pakhomov.vladimir@gmail.com> wrote: Hi, I would like to implement a script that would attach a newly created network to all hosts in cluster. Unfortunately I cannot find anything about that in documentation. Is it possible to attach network to host using CLI/REST API? Kind regards, Vladimir Pakhomov _______________________________________________ Users mailing list Users@ovirt.org http://lists.ovirt.org/mailman/listinfo/users --348076277-700747774-1412509025=:95644 Content-Type: text/html; charset=us-ascii <html><body><div style="color:#000; background-color:#fff; font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;font-size:16px"><div id="yiv4472805457"><div><div style="color:#000;background-color:#fff;font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;font-size:16px;"><div class="yiv4472805457" id="yiv4472805457yui_3_16_0_6_1412494424696_4" style=""><span class="yiv4472805457" id="yiv4472805457yui_3_16_0_6_1412494424696_13" style="">Hey Vladimir,</span></div><div class="yiv4472805457yui_3_16_0_6_1412494424696_19" id="yiv4472805457yui_3_16_0_6_1412494424696_15" style="color:rgb(0, 0, 0);font-size:16px;font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;background-color:transparent;font-style:normal;"><br style="" clear="none"><span class="yiv4472805457" id="yiv4472805457yui_3_16_0_6_1412494424696_13" style=""></span></div><div class="yiv4472805457yui_3_16_0_6_1412494424696_47" id="yiv4472805457yui_3_16_0_6_1412494424696_43" style="color:rgb(0, 0, 0);font-size:16px;font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;background-color:transparent;font-style:normal;"><span class="yiv4472805457" id="yiv4472805457yui_3_16_0_6_1412494424696_13" style="">Though there is no explicit documentation for the $subject, the concept<br>is the same in api/cli/sdk, i.e:<br><br>1. fetch the host<br>2. access host's nics collection<br>3. get the nic<br>4. use attach() method to attach your network,<br><br>in CLI you can use auto-completion for constructing commands<br>and 'help action attach ...' to see action parameters,</span> cli scripting<br>wiki available <a href="http://www.ovirt.org/CLI#Scripting">here</a>. <br><br></div><div id="yiv4472805457yui_3_16_0_6_1412494424696_43"> </div><div class="yiv4472805457yui_3_16_0_6_1412494424696_74" id="yiv4472805457yui_3_16_0_6_1412494424696_46" style="color:rgb(0, 0, 0);font-size:16px;font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;background-color:transparent;font-style:normal;"><span class="yiv4472805457" id="yiv4472805457yui_3_16_0_6_1412494424696_13" style="">also i'd suggest considering one of SDKs (<a rel="nofollow" shape="rect" class="yiv4472805457" id="yiv4472805457yui_3_16_0_1_1412494424696_50642" style="" target="_blank" href="http://www.ovirt.org/Python-sdk">python-sdk</a> / <a rel="nofollow" shape="rect" class="yiv4472805457" id="yiv4472805457yui_3_16_0_1_1412494424696_51266" style="" target="_blank" href="http://www.ovirt.org/Java-sdk">java-sdk</a>)<br></span><span class="yiv4472805457" id="yiv4472805457yui_3_16_0_6_1412494424696_13" style=""><span class="yiv4472805457" id="yiv4472805457yui_3_16_0_6_1412494424696_13" style="">for this matter.<br><br>Michael Pasternak<br></span></span></div><div class="yiv4472805457" id="yiv4472805457yui_3_16_0_6_1412494424696_22" style=""> </div> <div class="yiv4472805457yahoo_quoted" id="yiv4472805457yui_3_16_0_6_1412494424696_7" style="display: block;"> <div class="yiv4472805457yui_3_16_0_1_1412494424696_48869" style="font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;font-size:16px;"> <div class="yiv4472805457yui_3_16_0_1_1412494424696_48870" style="font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;font-size:16px;"> <div class="qtdSeparateBR"><br><br></div><div class="yiv4472805457yqt5602361119" id="yiv4472805457yqt35088"><div class="yiv4472805457" dir="ltr" style=""> <font class="yiv4472805457" style="" face="Arial" size="2"> On Sunday, October 5, 2014 1:26 PM, Vladimir Pakhomov <pakhomov.vladimir@gmail.com> wrote:<br class="yiv4472805457" style="" clear="none"> </font> </div> <br class="yiv4472805457" style="" clear="none"><br class="yiv4472805457" style="" clear="none"> <div class="yiv4472805457" style=""><div class="yiv4472805457" id="yiv4472805457" style=""><div class="yiv4472805457" dir="ltr" style="">Hi, <div class="yiv4472805457" style=""><br class="yiv4472805457" style="" clear="none"></div><div class="yiv4472805457" style="">I would like to implement a script that would attach a newly created network to all hosts in cluster. Unfortunately I cannot find anything about that in documentation. Is it possible to attach network to host using CLI/REST API?</div><div class="yiv4472805457" style=""><br class="yiv4472805457" style="" clear="none"></div><div class="yiv4472805457" style="">Kind regards,</div><div class="yiv4472805457" style="">Vladimir Pakhomov</div></div></div><br class="yiv4472805457" style="" clear="none">_______________________________________________<br class="yiv4472805457" style="" clear="none">Users mailing list<br class="yiv4472805457" style="" clear="none"><a rel="nofollow" shape="rect" class="yiv4472805457" style="" ymailto="mailto:Users@ovirt.org" target="_blank" href="mailto:Users@ovirt.org">Users@ovirt.org</a><br class="yiv4472805457" style="" clear="none"><a rel="nofollow" shape="rect" class="yiv4472805457" style="" target="_blank" href="http://lists.ovirt.org/mailman/listinfo/users">http://lists.ovirt.org/mailman/listinfo/users</a><br class="yiv4472805457" style="" clear="none"><br class="yiv4472805457" style="" clear="none"><br class="yiv4472805457" style="" clear="none"></div></div> </div> </div> </div> </div></div></div></div></body></html> --348076277-700747774-1412509025=:95644--

---262101065-825573605-1412509387=:16351 Content-Type: text/plain; charset=us-ascii probably using xml tags not such a good idea for ML archives/PT clients, [1] http://www.ovirt.org/CLI#Scripting [2] http://www.ovirt.org/Python-sdk [3] http://www.ovirt.org/Java-sdk On Sunday, October 5, 2014 2:37 PM, Maikl P <mishka8520@yahoo.com> wrote: Hey Vladimir, Though there is no explicit documentation for the $subject, the concept is the same in api/cli/sdk, i.e: 1. fetch the host 2. access host's nics collection 3. get the nic 4. use attach() method to attach your network, in CLI you can use auto-completion for constructing commands and 'help action attach ...' to see action parameters, cli scripting wiki available here. also i'd suggest considering one of SDKs (python-sdk / java-sdk) for this matter. Michael Pasternak On Sunday, October 5, 2014 1:26 PM, Vladimir Pakhomov <pakhomov.vladimir@gmail.com> wrote: Hi, I would like to implement a script that would attach a newly created network to all hosts in cluster. Unfortunately I cannot find anything about that in documentation. Is it possible to attach network to host using CLI/REST API? Kind regards, Vladimir Pakhomov _______________________________________________ Users mailing list Users@ovirt.org http://lists.ovirt.org/mailman/listinfo/users ---262101065-825573605-1412509387=:16351 Content-Type: text/html; charset=us-ascii <html><body><div style="color:#000; background-color:#fff; font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;font-size:16px"><div style="" class=""><span style="" class="">probably using xml tags not such a good idea for ML archives/PT clients,</span></div><div class="" style="color: rgb(0, 0, 0); font-size: 16px; font-family: HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif; background-color: transparent; font-style: normal;"><br style="" class=""><span style="" class=""></span></div><div class="" style="color: rgb(0, 0, 0); font-size: 16px; font-family: HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif; background-color: transparent; font-style: normal;"><span style="" class="">[1] <a style="" class="" href="http://www.ovirt.org/CLI#Scripting">http://www.ovirt.org/CLI#Scripting</a><br style="" class=""></span></div><div class="" style="color: rgb(0, 0, 0); font-size: 16px; font-family: HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif; background-color: transparent; font-style: normal;"><span style="" class="">[2] <a style="" class="" href="http://www.ovirt.org/Python-sdk">http://www.ovirt.org/Python-sdk</a><br style="" class=""></span></div><div class="" style="color: rgb(0, 0, 0); font-size: 16px; font-family: HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif; background-color: transparent; font-style: normal;"><span style="" class="">[3] <a style="" class="" href="http://www.ovirt.org/Java-sdk">http://www.ovirt.org/Java-sdk</a><br style="" class=""></span></div><div> </div> <div class="qtdSeparateBR"><br><br></div><div style="display: block;" class="yahoo_quoted"> <div class="" style="font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; font-size: 16px;"> <div class="" style="font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; font-size: 16px;"> <div style="" class="" dir="ltr"> <font style="" class="" face="Arial" size="2"> On Sunday, October 5, 2014 2:37 PM, Maikl P <mishka8520@yahoo.com> wrote:<br style="" class=""> </font> </div> <br style="" class=""><br style="" class=""> <div style="" class=""><div style="" class="" id="yiv3905295210"><div style="" class=""><div class="" style="color:#000;background-color:#fff;font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;font-size:16px;"><div style="" class="" id="yiv3905295210"><div style="" class=""><div class="" style="color:#000;background-color:#fff;font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;font-size:16px;"><div class="" id="yiv3905295210yui_3_16_0_6_1412494424696_4" style=""><span class="" id="yiv3905295210yui_3_16_0_6_1412494424696_13" style="">Hey Vladimir,</span></div><div class="" id="yiv3905295210yui_3_16_0_6_1412494424696_15" style="color:rgb(0, 0, 0);font-size:16px;font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;background-color:transparent;font-style:normal;"><br class="" style="" clear="none"><span class="" id="yiv3905295210yui_3_16_0_6_1412494424696_13" style=""></span></div><div class="" id="yiv3905295210yui_3_16_0_6_1412494424696_43" style="color:rgb(0, 0, 0);font-size:16px;font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;background-color:transparent;font-style:normal;"><span class="" id="yiv3905295210yui_3_16_0_6_1412494424696_13" style="">Though there is no explicit documentation for the $subject, the concept<br style="" class="" clear="none">is the same in api/cli/sdk, i.e:<br style="" class="" clear="none"><br style="" class="" clear="none">1. fetch the host<br style="" class="" clear="none">2. access host's nics collection<br style="" class="" clear="none">3. get the nic<br style="" class="" clear="none">4. use attach() method to attach your network,<br style="" class="" clear="none"><br style="" class="" clear="none">in CLI you can use auto-completion for constructing commands<br style="" class="" clear="none">and 'help action attach ...' to see action parameters,</span> cli scripting<br style="" class="" clear="none">wiki available <a style="" class="" rel="nofollow" shape="rect" target="_blank" href="http://www.ovirt.org/CLI#Scripting">here</a>. <br style="" class="" clear="none"><br style="" class="" clear="none"></div><div style="" class="" id="yiv3905295210yui_3_16_0_6_1412494424696_43"> </div><div class="" id="yiv3905295210yui_3_16_0_6_1412494424696_46" style="color:rgb(0, 0, 0);font-size:16px;font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;background-color:transparent;font-style:normal;"><span class="" id="yiv3905295210yui_3_16_0_6_1412494424696_13" style="">also i'd suggest considering one of SDKs (<a rel="nofollow" shape="rect" class="" id="yiv3905295210yui_3_16_0_1_1412494424696_50642" style="" target="_blank" href="http://www.ovirt.org/Python-sdk">python-sdk</a> / <a rel="nofollow" shape="rect" class="" id="yiv3905295210yui_3_16_0_1_1412494424696_51266" style="" target="_blank" href="http://www.ovirt.org/Java-sdk">java-sdk</a>)<br style="" class="" clear="none"></span><span class="" id="yiv3905295210yui_3_16_0_6_1412494424696_13" style=""><span class="" id="yiv3905295210yui_3_16_0_6_1412494424696_13" style="">for this matter.<br style="" class="" clear="none"><br style="" class="" clear="none">Michael Pasternak<br style="" class="" clear="none"></span></span></div><div class="" id="yiv3905295210yui_3_16_0_6_1412494424696_22" style=""> </div> <div class="" id="yiv3905295210yui_3_16_0_6_1412494424696_7" style="display:block;"> <div class="" style="font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;font-size:16px;"> <div class="" style="font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;font-size:16px;"> <div style="" class=""><br style="" class="" clear="none"><br style="" class="" clear="none"></div><div style="" class="" id="yiv3905295210yqt35088"><div style="" class="" id="yiv3905295210yqt96792"><div class="" dir="ltr" style=""> <font class="" style="" face="Arial" size="2"> On Sunday, October 5, 2014 1:26 PM, Vladimir Pakhomov <pakhomov.vladimir@gmail.com> wrote:<br class="" style="" clear="none"> </font> </div> <br class="" style="" clear="none"><br class="" style="" clear="none"> <div class="" style=""><div class="" id="yiv3905295210" style=""><div class="" dir="ltr" style="">Hi, <div class="" style=""><br class="" style="" clear="none"></div><div class="" style="">I would like to implement a script that would attach a newly created network to all hosts in cluster. Unfortunately I cannot find anything about that in documentation. Is it possible to attach network to host using CLI/REST API?</div><div class="" style=""><br class="" style="" clear="none"></div><div class="" style="">Kind regards,</div><div class="" style="">Vladimir Pakhomov</div></div></div><br class="" style="" clear="none">_______________________________________________<br class="" style="" clear="none">Users mailing list<br class="" style="" clear="none"><a rel="nofollow" shape="rect" class="" style="" ymailto="mailto:Users@ovirt.org" target="_blank" href="mailto:Users@ovirt.org">Users@ovirt.org</a><br class="" style="" clear="none"><a rel="nofollow" shape="rect" class="" style="" target="_blank" href="http://lists.ovirt.org/mailman/listinfo/users">http://lists.ovirt.org/mailman/listinfo/users</a><br class="" style="" clear="none"><br class="" style="" clear="none"><br class="" style="" clear="none"></div></div></div> </div> </div> </div> </div></div></div></div></div></div><br style="" class=""><br style="" class=""></div> </div> </div> </div> </div></body></html> ---262101065-825573605-1412509387=:16351--

-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 05.10.2014 12:26, Vladimir Pakhomov wrote:
Hi,
I would like to implement a script that would attach a newly created network to all hosts in cluster. Unfortunately I cannot find anything about that in documentation. Is it possible to attach network to host using CLI/REST API?
Kind regards, Vladimir Pakhomov
See this guide: https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Virtualizat... you can basically suplement rhev with ovirt, there is no ovirt guide yet. I don't know why there is no dev guide for 3.4 and 3.5 though. HTH Sven -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQGcBAEBAgAGBQJUMT7kAAoJEAq0kGAWDrqliPEL/jS8XwSBQ1da+XRWAGxfXbcp t90uv2b6fV7uaEBEqR/xVkayCB+hWvwluH4rdI/MHCEslBSSTkb7J7oTzUIL311B RVMNAOWTXBuJIAQ4ywlJiuzXzcQfrmqD6EqowjJCEQDWDgYihQgDUVketJPe5+dj NwEV/HeOdIfq86LqbOnjSS+FKIp2+J+PfLA9Qb4FpFK2b5uOYlKbGw26+UGjr7Yb b2OoXYzHNFFb5WU1ir8hidyjYZskPCMiqNjgai5Pn2yN+dr5JFv0VHuAwx1AZ5Ga DKOsIm/gTOI2tNG4bV4frF38yMTRi3qVkAo/rId29/0EzxC0rAiMy+xIypjkQmw/ Ce6arH+UCzMfmXtL8A70gmnB0F75wdweQvdMno3K6P4LyauPy0ybluJJAPl53TLH TC3D1ul7JA7CDe7lA0+HWINxcfkR5gfJcs2AfquWvfSlbFrldteMly1HC+ODpHST tQMZ8JIiL9krYONM+H0ikSBDTyb2s76l9AHYgC2m6g== =1r1a -----END PGP SIGNATURE-----

----- Original Message -----
From: "Vladimir Pakhomov" <pakhomov.vladimir@gmail.com> To: users@ovirt.org Sent: Sunday, October 5, 2014 1:26:12 PM Subject: [ovirt-users] using ovirt-shell to attach defind network to hosts
Hi,
I would like to implement a script that would attach a newly created network to all hosts in cluster. Unfortunately I cannot find anything about that in documentation. Is it possible to attach network to host using CLI/REST API?
If the case is for attaching a network to all of the hosts on the cluster, you can use the 'network labels' feature in which you label the host nics with a label, and once you mark a network with the same label, it will be auto-configured on the hosts. This will allow you just to label networks in order to configure them on the hosts without a need to access the hosts. http://www.ovirt.org/Features/NetworkLabels#REST https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Virtualizat... For configuring networks manually on the host you can use the setupnetworks api, which allows you to configure the destination network topology for the host. See "Configure bond with several networks" example from: http://www.ovirt.org/Testing/PythonApi#Networking I've also added several more examples here: https://motiasayag.wordpress.com/category/ovirt/ovirt-engine-sdk-python/setu...
Kind regards, Vladimir Pakhomov
_______________________________________________ Users mailing list Users@ovirt.org http://lists.ovirt.org/mailman/listinfo/users

Thank you!! Thanks to Maikl P I find the solution: action nic $IF_NAME --host-identifier $HOST_ID attach --network-name $NET_NAME Moti Asayag, thank you for links provided. Kind regards, Vladimir Pakhomov 2014-10-05 17:19 GMT+04:00 Moti Asayag <masayag@redhat.com>:
----- Original Message -----
From: "Vladimir Pakhomov" <pakhomov.vladimir@gmail.com> To: users@ovirt.org Sent: Sunday, October 5, 2014 1:26:12 PM Subject: [ovirt-users] using ovirt-shell to attach defind network to hosts
Hi,
I would like to implement a script that would attach a newly created network to all hosts in cluster. Unfortunately I cannot find anything about that in documentation. Is it possible to attach network to host using CLI/REST API?
If the case is for attaching a network to all of the hosts on the cluster, you can use the 'network labels' feature in which you label the host nics with a label, and once you mark a network with the same label, it will be auto-configured on the hosts. This will allow you just to label networks in order to configure them on the hosts without a need to access the hosts.
http://www.ovirt.org/Features/NetworkLabels#REST
https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Virtualizat...
For configuring networks manually on the host you can use the setupnetworks api, which allows you to configure the destination network topology for the host. See "Configure bond with several networks" example from: http://www.ovirt.org/Testing/PythonApi#Networking
I've also added several more examples here:
https://motiasayag.wordpress.com/category/ovirt/ovirt-engine-sdk-python/setu...
Kind regards, Vladimir Pakhomov
_______________________________________________ Users mailing list Users@ovirt.org http://lists.ovirt.org/mailman/listinfo/users
participants (4)
-
Maikl P
-
Moti Asayag
-
Sven Kieske
-
Vladimir Pakhomov