<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Apr 6, 2017 at 4:49 PM, Fabrice Bacchella <span dir="ltr"><<a href="mailto:fabrice.bacchella@orange.fr" target="_blank">fabrice.bacchella@orange.fr</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div style="word-wrap:break-word"><span class="gmail-"><br><div><blockquote type="cite"><div>Le 6 avr. 2017 à 15:32, Yaniv Kaul <<a href="mailto:ykaul@redhat.com" target="_blank">ykaul@redhat.com</a>> a écrit :</div><br class="gmail-m_-6007873883923554742Apple-interchange-newline"><div><div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Apr 6, 2017 at 3:58 PM, Fabrice Bacchella <span dir="ltr"><<a href="mailto:fabrice.bacchella@orange.fr" target="_blank">fabrice.bacchella@orange.fr</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div style="word-wrap:break-word">Yes I'm starting to understand that thinking about migrating code is pointless.<div><br></div><div>The old skd3 code is just good to be thrown away. There is no hope thinking about "migrating code". And as it's just a thin layer around REST calls, it's up to us to try to make something usable around that. So I expect a lot of sweat and tears to adapt my existing code.</div></div></blockquote><div><br></div><div>Well, yes and no. Yes, it's not smooth, but once you 'get' the idea behind the v4 API philosophy, it's quite easy to write to (at least in Python).</div></div></div></div></div></blockquote><br></div></span><div>An example of code that I'm unhappy to write and that a good sdk should have provided:</div><div><br></div><div>searchfilter = "%s=%s" % (type, value)</div><div><span style="color:rgb(36,41,46);font-family:sfmono-regular,consolas,"liberation mono",menlo,courier,monospace;white-space:pre-wrap;background-color:rgb(255,255,255)">vm </span><span class="gmail-m_-6007873883923554742pl-k" style="box-sizing:border-box;color:rgb(167,29,93);font-family:sfmono-regular,consolas,"liberation mono",menlo,courier,monospace;white-space:pre-wrap">=</span><span style="color:rgb(36,41,46);font-family:sfmono-regular,consolas,"liberation mono",menlo,courier,monospace;white-space:pre-wrap;background-color:rgb(255,255,255)"> vms_service.list(</span><span class="gmail-m_-6007873883923554742pl-v" style="box-sizing:border-box;color:rgb(237,106,67);font-family:sfmono-regular,consolas,"liberation mono",menlo,courier,monospace;white-space:pre-wrap">search</span><span class="gmail-m_-6007873883923554742pl-k" style="box-sizing:border-box;color:rgb(167,29,93);font-family:sfmono-regular,consolas,"liberation mono",menlo,courier,monospace;white-space:pre-wrap">=</span> <wbr>searchfilter<span style="color:rgb(36,41,46);font-family:sfmono-regular,consolas,"liberation mono",menlo,courier,monospace;white-space:pre-wrap;background-color:rgb(255,255,255)">)[</span><span class="gmail-m_-6007873883923554742pl-c1" style="box-sizing:border-box;color:rgb(0,134,179);font-family:sfmono-regular,consolas,"liberation mono",menlo,courier,monospace;white-space:pre-wrap">0</span><span style="color:rgb(36,41,46);font-family:sfmono-regular,consolas,"liberation mono",menlo,courier,monospace;white-space:pre-wrap;background-color:rgb(255,255,255)">]</span></div><div><span style="color:rgb(36,41,46);font-family:sfmono-regular,consolas,"liberation mono",menlo,courier,monospace;white-space:pre-wrap;background-color:rgb(255,255,255)"><br></span></div><div><span style="color:rgb(36,41,46);font-family:sfmono-regular,consolas,"liberation mono",menlo,courier,monospace;white-space:pre-wrap;background-color:rgb(255,255,255)">instead of :</span></div><div><span style="color:rgb(36,41,46);font-family:sfmono-regular,consolas,"liberation mono",menlo,courier,monospace;white-space:pre-wrap;background-color:rgb(255,255,255)">vms_service.list(</span><span class="gmail-m_-6007873883923554742pl-v" style="box-sizing:border-box;color:rgb(237,106,67);font-family:sfmono-regular,consolas,"liberation mono",menlo,courier,monospace;white-space:pre-wrap">search</span><span class="gmail-m_-6007873883923554742pl-k" style="box-sizing:border-box;color:rgb(167,29,93);font-family:sfmono-regular,consolas,"liberation mono",menlo,courier,monospace;white-space:pre-wrap">=</span> {<wbr>type: value}<span style="color:rgb(36,41,46);font-family:sfmono-regular,consolas,"liberation mono",menlo,courier,monospace;white-space:pre-wrap;background-color:rgb(255,255,255)">)[</span><span class="gmail-m_-6007873883923554742pl-c1" style="box-sizing:border-box;color:rgb(0,134,179);font-family:sfmono-regular,consolas,"liberation mono",menlo,courier,monospace;white-space:pre-wrap">0</span><span style="color:rgb(36,41,46);font-family:sfmono-regular,consolas,"liberation mono",menlo,courier,monospace;white-space:pre-wrap;background-color:rgb(255,255,255)">]</span></div><div><span style="color:rgb(36,41,46);font-family:sfmono-regular,consolas,"liberation mono",menlo,courier,monospace;white-space:pre-wrap;background-color:rgb(255,255,255)"><br></span></div><div><span style="color:rgb(36,41,46);font-family:sfmono-regular,consolas,"liberation mono",menlo,courier,monospace;white-space:pre-wrap;background-color:rgb(255,255,255)">or even better:</span></div><div><span style="color:rgb(36,41,46);font-family:sfmono-regular,consolas,"liberation mono",menlo,courier,monospace;white-space:pre-wrap;background-color:rgb(255,255,255)">vms_service.get(**{type: value})</span></div></div></blockquote><div><br></div><div><br></div><div>Yes, I see what you mean. 100% more LoC are currently needed vs. your idea ;-)</div><div><br></div><div>Seriously though - perhaps you could borrow code from our Ansible module? See[1].</div><div><br></div><div>Y.</div><div><br></div><div>[1] <a href="https://github.com/ansible/ansible/blob/699df5824d36dab5cb46b3f7c63e8992bd778b27/lib/ansible/module_utils/ovirt.py#L220">https://github.com/ansible/ansible/blob/699df5824d36dab5cb46b3f7c63e8992bd778b27/lib/ansible/module_utils/ovirt.py#L220</a> </div></div><br></div></div>