Ovirt 4, the missing python sdk

--Apple-Mail=_F30DEBD8-5156-4EC2-BE2E-C421F2B60768 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii I have started to write a custom sdk/cli in python for Ovirt 4. It = provides helpers and wrapper for the rather raw level sdk4 provided. It's still a work in progress, but a big improvement from my previous = version, made for ovirt 3. It allows to write simple commands on shell : $ ./ovcmd host -n hostname maintenance $ ./ovcmd host -n hostname activate It also allows to do fine exports: $ ./ovcmd vm -n vmname export os type rhel_6x64 $ ./ovcmd capabilities -n 4.1 export cpu_types name Intel Conroe Family Intel Penryn Family Intel Nehalem Family Intel Westmere Family Intel SandyBridge Family Intel Haswell-noTSX Family Intel Haswell Family Intel Broadwell-noTSX Family Intel Broadwell Family Intel Skylake Family AMD Opteron G1 AMD Opteron G2 AMD Opteron G3 AMD Opteron G4 AMD Opteron G5 IBM POWER8 Or to get a display console on a mac os: $open $(./ovcmd vm -n vmname console ) It can be found at https://github.com/fbacchella/ovirtcmd/tree/sdk4 It's still works in progress, I need to finish to remove sdk3 code. Some example of object written to sdk4 can be found at: https://github.com/fbacchella/ovirtcmd/blob/sdk4/ovlib/vms/__init__.py= --Apple-Mail=_F30DEBD8-5156-4EC2-BE2E-C421F2B60768 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=us-ascii <html><head><meta http-equiv=3D"Content-Type" content=3D"text/html = charset=3Dus-ascii"></head><body style=3D"word-wrap: break-word; = -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" = class=3D"">I have started to write a custom sdk/cli in python for Ovirt = 4. It provides helpers and wrapper for the rather raw level sdk4 = provided.<div class=3D""><br class=3D""></div><div class=3D"">It's still = a work in progress, but a big improvement from my previous version, made = for ovirt 3.</div><div class=3D""><br class=3D""></div><div class=3D"">It = allows to write simple commands on shell :</div><div class=3D""><br = class=3D""></div><div class=3D""><div style=3D"margin: 0px; font-size: = 11px; line-height: normal; font-family: Menlo;" class=3D""><span = style=3D"font-variant-ligatures: no-common-ligatures" class=3D"">$ = ./ovcmd host -n hostname maintenance</span></div></div><div = style=3D"margin: 0px; font-size: 11px; line-height: normal; font-family: = Menlo;" class=3D""><span style=3D"font-variant-ligatures: = no-common-ligatures" class=3D"">$ ./ovcmd host = -n hostname activate</span></div><div style=3D"margin: 0px; = font-size: 11px; line-height: normal; font-family: Menlo;" = class=3D""><span style=3D"font-variant-ligatures: no-common-ligatures" = class=3D""><br class=3D""></span></div><div style=3D"margin: 0px; = font-size: 11px; line-height: normal; font-family: Menlo;" = class=3D""><span style=3D"font-variant-ligatures: no-common-ligatures" = class=3D"">It also allows to do fine exports:</span></div><div = style=3D"margin: 0px; font-size: 11px; line-height: normal; font-family: = Menlo;" class=3D""><span style=3D"font-variant-ligatures: = no-common-ligatures" class=3D""><br class=3D""></span></div><div = style=3D"margin: 0px; font-size: 11px; line-height: normal; font-family: = Menlo;" class=3D""><span style=3D"font-variant-ligatures: = no-common-ligatures" class=3D"">$ ./ovcmd vm -n vmname export = os type</span></div><div style=3D"margin: 0px; font-size: 11px; = line-height: normal; font-family: Menlo;" class=3D""><span = style=3D"font-variant-ligatures: no-common-ligatures" = class=3D"">rhel_6x64</span></div><div style=3D"margin: 0px; font-size: = 11px; line-height: normal; font-family: Menlo;" class=3D""><span = style=3D"font-variant-ligatures: no-common-ligatures" class=3D""><br = class=3D""></span></div><div style=3D"margin: 0px; font-size: 11px; = line-height: normal; font-family: Menlo;" class=3D""><span = style=3D"font-variant-ligatures: no-common-ligatures" = class=3D"">$ </span>./ovcmd capabilities -n 4.1 export cpu_types = name</div><div style=3D"margin: 0px; line-height: normal;" class=3D""><div= style=3D"font-family: Menlo; font-size: 11px; margin: 0px; line-height: = normal;" class=3D""><span style=3D"font-variant-ligatures: = no-common-ligatures" class=3D"">Intel Conroe Family</span></div><div = style=3D"font-family: Menlo; font-size: 11px; margin: 0px; line-height: = normal;" class=3D""><span style=3D"font-variant-ligatures: = no-common-ligatures" class=3D"">Intel Penryn Family</span></div><div = style=3D"font-family: Menlo; font-size: 11px; margin: 0px; line-height: = normal;" class=3D""><span style=3D"font-variant-ligatures: = no-common-ligatures" class=3D"">Intel Nehalem Family</span></div><div = style=3D"font-family: Menlo; font-size: 11px; margin: 0px; line-height: = normal;" class=3D""><span style=3D"font-variant-ligatures: = no-common-ligatures" class=3D"">Intel Westmere Family</span></div><div = style=3D"font-family: Menlo; font-size: 11px; margin: 0px; line-height: = normal;" class=3D""><span style=3D"font-variant-ligatures: = no-common-ligatures" class=3D"">Intel SandyBridge = Family</span></div><div style=3D"font-family: Menlo; font-size: 11px; = margin: 0px; line-height: normal;" class=3D""><span = style=3D"font-variant-ligatures: no-common-ligatures" class=3D"">Intel = Haswell-noTSX Family</span></div><div style=3D"font-family: Menlo; = font-size: 11px; margin: 0px; line-height: normal;" class=3D""><span = style=3D"font-variant-ligatures: no-common-ligatures" class=3D"">Intel = Haswell Family</span></div><div style=3D"font-family: Menlo; font-size: = 11px; margin: 0px; line-height: normal;" class=3D""><span = style=3D"font-variant-ligatures: no-common-ligatures" class=3D"">Intel = Broadwell-noTSX Family</span></div><div style=3D"font-family: Menlo; = font-size: 11px; margin: 0px; line-height: normal;" class=3D""><span = style=3D"font-variant-ligatures: no-common-ligatures" class=3D"">Intel = Broadwell Family</span></div><div style=3D"font-family: Menlo; = font-size: 11px; margin: 0px; line-height: normal;" class=3D""><span = style=3D"font-variant-ligatures: no-common-ligatures" class=3D"">Intel = Skylake Family</span></div><div style=3D"font-family: Menlo; font-size: = 11px; margin: 0px; line-height: normal;" class=3D""><span = style=3D"font-variant-ligatures: no-common-ligatures" class=3D"">AMD = Opteron G1</span></div><div style=3D"font-family: Menlo; font-size: = 11px; margin: 0px; line-height: normal;" class=3D""><span = style=3D"font-variant-ligatures: no-common-ligatures" class=3D"">AMD = Opteron G2</span></div><div style=3D"font-family: Menlo; font-size: = 11px; margin: 0px; line-height: normal;" class=3D""><span = style=3D"font-variant-ligatures: no-common-ligatures" class=3D"">AMD = Opteron G3</span></div><div style=3D"font-family: Menlo; font-size: = 11px; margin: 0px; line-height: normal;" class=3D""><span = style=3D"font-variant-ligatures: no-common-ligatures" class=3D"">AMD = Opteron G4</span></div><div style=3D"font-family: Menlo; font-size: = 11px; margin: 0px; line-height: normal;" class=3D""><span = style=3D"font-variant-ligatures: no-common-ligatures" class=3D"">AMD = Opteron G5</span></div><div style=3D"font-family: Menlo; font-size: = 11px; margin: 0px; line-height: normal;" class=3D""><span = style=3D"font-variant-ligatures: no-common-ligatures" class=3D"">IBM = POWER8</span></div><div style=3D"font-family: Menlo; font-size: 11px; = margin: 0px; line-height: normal;" class=3D""><span = style=3D"font-variant-ligatures: no-common-ligatures" class=3D""><br = class=3D""></span></div><div style=3D"font-family: Menlo; font-size: = 11px; margin: 0px; line-height: normal;" class=3D""><span = style=3D"font-variant-ligatures: no-common-ligatures" class=3D"">Or to = get a display console on a mac os:</span></div><div style=3D"font-family: = Menlo; font-size: 11px; margin: 0px; line-height: normal;" = class=3D""><span style=3D"font-variant-ligatures: no-common-ligatures" = class=3D""><br class=3D""></span></div><div style=3D"font-family: Menlo; = font-size: 11px; margin: 0px; line-height: normal;" class=3D""><span = style=3D"font-variant-ligatures: no-common-ligatures" class=3D"">$open = $(./ovcmd vm -n vmname console )</span></div><div style=3D"font-family: = Menlo; font-size: 11px; margin: 0px; line-height: normal;" = class=3D""><span style=3D"font-variant-ligatures: no-common-ligatures" = class=3D""><br class=3D""></span></div><div style=3D"font-family: Menlo; = font-size: 11px;" class=3D""><span style=3D"font-variant-ligatures: = no-common-ligatures" class=3D""><br class=3D""></span></div><div = style=3D"font-family: Menlo; font-size: 11px;" class=3D""><span = style=3D"font-variant-ligatures: no-common-ligatures" class=3D"">It can = be found at <a = href=3D"https://github.com/fbacchella/ovirtcmd/tree/sdk4" = class=3D"">https://github.com/fbacchella/ovirtcmd/tree/sdk4</a></span></di= v><div style=3D"font-family: Menlo; font-size: 11px;" class=3D"">It's = still works in progress, I need to finish to remove sdk3 code.</div><div = style=3D"font-family: Menlo; font-size: 11px;" class=3D""><br = class=3D""></div><div style=3D"font-family: Menlo; font-size: 11px;" = class=3D"">Some example of object written to sdk4 can be found = at:</div><div style=3D"font-family: Menlo; font-size: 11px;" = class=3D""><br class=3D""></div><div class=3D""><span = style=3D"font-variant-ligatures: no-common-ligatures; font-size: 11px;" = class=3D""><font face=3D"Menlo" class=3D""><a = href=3D"https://github.com/fbacchella/ovirtcmd/blob/sdk4/ovlib/vms/__init_= _.py" = class=3D"">https://github.com/fbacchella/ovirtcmd/blob/sdk4/ovlib/vms/__in= it__.py</a></font></span></div></div></body></html>= --Apple-Mail=_F30DEBD8-5156-4EC2-BE2E-C421F2B60768--

does ovirt have a restful api? On 28 April 2017 at 13:43, Fabrice Bacchella <fabrice.bacchella@orange.fr> wrote:
I have started to write a custom sdk/cli in python for Ovirt 4. It provides helpers and wrapper for the rather raw level sdk4 provided.
It's still a work in progress, but a big improvement from my previous version, made for ovirt 3.
It allows to write simple commands on shell :
$ ./ovcmd host -n hostname maintenance $ ./ovcmd host -n hostname activate
It also allows to do fine exports:
$ ./ovcmd vm -n vmname export os type rhel_6x64
$ ./ovcmd capabilities -n 4.1 export cpu_types name Intel Conroe Family Intel Penryn Family Intel Nehalem Family Intel Westmere Family Intel SandyBridge Family Intel Haswell-noTSX Family Intel Haswell Family Intel Broadwell-noTSX Family Intel Broadwell Family Intel Skylake Family AMD Opteron G1 AMD Opteron G2 AMD Opteron G3 AMD Opteron G4 AMD Opteron G5 IBM POWER8
Or to get a display console on a mac os:
$open $(./ovcmd vm -n vmname console )
It can be found at https://github.com/fbacchella/ovirtcmd/tree/sdk4 It's still works in progress, I need to finish to remove sdk3 code.
Some example of object written to sdk4 can be found at:
https://github.com/fbacchella/ovirtcmd/blob/sdk4/ovlib/vms/__init__.py
_______________________________________________ Users mailing list Users@ovirt.org http://lists.ovirt.org/mailman/listinfo/users

On Friday, April 28, 2017 11:41:03 AM EDT Ben De Luca wrote:
does ovirt have a restful api?
Yes, Its available at https://<engine_url>/ovirt-engine/api In fact the python/java/ruby sdk are just wrappers to calling this api.
On 28 April 2017 at 13:43, Fabrice Bacchella <fabrice.bacchella@orange.fr>
wrote:
I have started to write a custom sdk/cli in python for Ovirt 4. It provides helpers and wrapper for the rather raw level sdk4 provided.
It's still a work in progress, but a big improvement from my previous version, made for ovirt 3.
It allows to write simple commands on shell :
$ ./ovcmd host -n hostname maintenance $ ./ovcmd host -n hostname activate
It also allows to do fine exports:
$ ./ovcmd vm -n vmname export os type rhel_6x64
$ ./ovcmd capabilities -n 4.1 export cpu_types name Intel Conroe Family Intel Penryn Family Intel Nehalem Family Intel Westmere Family Intel SandyBridge Family Intel Haswell-noTSX Family Intel Haswell Family Intel Broadwell-noTSX Family Intel Broadwell Family Intel Skylake Family AMD Opteron G1 AMD Opteron G2 AMD Opteron G3 AMD Opteron G4 AMD Opteron G5 IBM POWER8
Or to get a display console on a mac os:
$open $(./ovcmd vm -n vmname console )
It can be found at https://github.com/fbacchella/ovirtcmd/tree/sdk4 It's still works in progress, I need to finish to remove sdk3 code.
Some example of object written to sdk4 can be found at:
https://github.com/fbacchella/ovirtcmd/blob/sdk4/ovlib/vms/__init__.py
_______________________________________________ Users mailing list Users@ovirt.org http://lists.ovirt.org/mailman/listinfo/users

before people go writing yet another api client wouldn't it make sense to just define the api client in terms of some thing like swagger ? http://swagger.io/ On 28 April 2017 at 18:57, Alexander Wels <awels@redhat.com> wrote:
On Friday, April 28, 2017 11:41:03 AM EDT Ben De Luca wrote:
does ovirt have a restful api?
Yes,
Its available at https://<engine_url>/ovirt-engine/api
In fact the python/java/ruby sdk are just wrappers to calling this api.
On 28 April 2017 at 13:43, Fabrice Bacchella < fabrice.bacchella@orange.fr>
wrote:
I have started to write a custom sdk/cli in python for Ovirt 4. It provides helpers and wrapper for the rather raw level sdk4 provided.
It's still a work in progress, but a big improvement from my previous version, made for ovirt 3.
It allows to write simple commands on shell :
$ ./ovcmd host -n hostname maintenance $ ./ovcmd host -n hostname activate
It also allows to do fine exports:
$ ./ovcmd vm -n vmname export os type rhel_6x64
$ ./ovcmd capabilities -n 4.1 export cpu_types name Intel Conroe Family Intel Penryn Family Intel Nehalem Family Intel Westmere Family Intel SandyBridge Family Intel Haswell-noTSX Family Intel Haswell Family Intel Broadwell-noTSX Family Intel Broadwell Family Intel Skylake Family AMD Opteron G1 AMD Opteron G2 AMD Opteron G3 AMD Opteron G4 AMD Opteron G5 IBM POWER8
Or to get a display console on a mac os:
$open $(./ovcmd vm -n vmname console )
It can be found at https://github.com/fbacchella/ovirtcmd/tree/sdk4 It's still works in progress, I need to finish to remove sdk3 code.
Some example of object written to sdk4 can be found at:
https://github.com/fbacchella/ovirtcmd/blob/sdk4/ovlib/vms/__init__.py
_______________________________________________ Users mailing list Users@ovirt.org http://lists.ovirt.org/mailman/listinfo/users

On 04/28/2017 06:00 PM, Ben De Luca wrote:
before people go writing yet another api client wouldn't it make sense to just define the api client in terms of some thing like swagger ? http://swagger.io/
The oVirt API has a formal specification, defined in this project: https://github.com/oVirt/ovirt-engine-api-model The skeleton of the server, the documentation, and the SDKs are automatically generated from that specification. There is also an experimental Swagger/OpenAPI specification, available here: https://jhernand.fedorapeople.org/ovirt-engine-api-model/swagger.json However this seems to be too big for Swagger tools (1 MiB, 17000 lines). Every time I tried to load it into Swagger editor or Swagger UI it just burns the CPU of the browser and never finishes loading. If you have some Swagger expertise would be nice if you can take a look and pinpoint what is the problem.
On 28 April 2017 at 18:57, Alexander Wels <awels@redhat.com <mailto:awels@redhat.com>> wrote:
On Friday, April 28, 2017 11:41:03 AM EDT Ben De Luca wrote: > does ovirt have a restful api? >
Yes,
Its available at https://<engine_url>/ovirt-engine/api
In fact the python/java/ruby sdk are just wrappers to calling this api.
> On 28 April 2017 at 13:43, Fabrice Bacchella <fabrice.bacchella@orange.fr <mailto:fabrice.bacchella@orange.fr>> > > wrote: > > I have started to write a custom sdk/cli in python for Ovirt 4. It > > provides helpers and wrapper for the rather raw level sdk4 provided. > > > > It's still a work in progress, but a big improvement from my previous > > version, made for ovirt 3. > > > > It allows to write simple commands on shell : > > > > $ ./ovcmd host -n hostname maintenance > > $ ./ovcmd host -n hostname activate > > > > It also allows to do fine exports: > > > > $ ./ovcmd vm -n vmname export os type > > rhel_6x64 > > > > $ ./ovcmd capabilities -n 4.1 export cpu_types name > > Intel Conroe Family > > Intel Penryn Family > > Intel Nehalem Family > > Intel Westmere Family > > Intel SandyBridge Family > > Intel Haswell-noTSX Family > > Intel Haswell Family > > Intel Broadwell-noTSX Family > > Intel Broadwell Family > > Intel Skylake Family > > AMD Opteron G1 > > AMD Opteron G2 > > AMD Opteron G3 > > AMD Opteron G4 > > AMD Opteron G5 > > IBM POWER8 > > > > Or to get a display console on a mac os: > > > > $open $(./ovcmd vm -n vmname console ) > > > > > > It can be found at https://github.com/fbacchella/ovirtcmd/tree/sdk4 <https://github.com/fbacchella/ovirtcmd/tree/sdk4> > > It's still works in progress, I need to finish to remove sdk3 code. > > > > Some example of object written to sdk4 can be found at: > > > > https://github.com/fbacchella/ovirtcmd/blob/sdk4/ovlib/vms/__init__.py <https://github.com/fbacchella/ovirtcmd/blob/sdk4/ovlib/vms/__init__.py> > > > > _______________________________________________ > > Users mailing list > > Users@ovirt.org <mailto:Users@ovirt.org> > > http://lists.ovirt.org/mailman/listinfo/users <http://lists.ovirt.org/mailman/listinfo/users>
_______________________________________________ Users mailing list Users@ovirt.org http://lists.ovirt.org/mailman/listinfo/users

I just generated the python API with the cmdline tools. I tend to use docker with random things like this from the internet, but with docker installed this will generate a python version of the api. docker run --rm -v ${PWD}:/local swaggerapi/swagger-codegen-cli generate \ -c /local/swagger.json \ -l python \ -o /local/out/ to a folder called local/out On 28 April 2017 at 20:01, Juan Hernández <jhernand@redhat.com> wrote:
On 04/28/2017 06:00 PM, Ben De Luca wrote:
before people go writing yet another api client wouldn't it make sense to just define the api client in terms of some thing like swagger ? http://swagger.io/
The oVirt API has a formal specification, defined in this project:
https://github.com/oVirt/ovirt-engine-api-model
The skeleton of the server, the documentation, and the SDKs are automatically generated from that specification.
There is also an experimental Swagger/OpenAPI specification, available here:
https://jhernand.fedorapeople.org/ovirt-engine-api-model/swagger.json
However this seems to be too big for Swagger tools (1 MiB, 17000 lines). Every time I tried to load it into Swagger editor or Swagger UI it just burns the CPU of the browser and never finishes loading. If you have some Swagger expertise would be nice if you can take a look and pinpoint what is the problem.
On 28 April 2017 at 18:57, Alexander Wels <awels@redhat.com <mailto:awels@redhat.com>> wrote:
On Friday, April 28, 2017 11:41:03 AM EDT Ben De Luca wrote: > does ovirt have a restful api? >
Yes,
Its available at https://<engine_url>/ovirt-engine/api
In fact the python/java/ruby sdk are just wrappers to calling this
api.
> On 28 April 2017 at 13:43, Fabrice Bacchella <fabrice.bacchella@orange.fr <mailto:fabrice.bacchella@orange.fr>> > > wrote: > > I have started to write a custom sdk/cli in python for Ovirt 4.
It
> > provides helpers and wrapper for the rather raw level sdk4
provided.
> > > > It's still a work in progress, but a big improvement from my previous > > version, made for ovirt 3. > > > > It allows to write simple commands on shell : > > > > $ ./ovcmd host -n hostname maintenance > > $ ./ovcmd host -n hostname activate > > > > It also allows to do fine exports: > > > > $ ./ovcmd vm -n vmname export os type > > rhel_6x64 > > > > $ ./ovcmd capabilities -n 4.1 export cpu_types name > > Intel Conroe Family > > Intel Penryn Family > > Intel Nehalem Family > > Intel Westmere Family > > Intel SandyBridge Family > > Intel Haswell-noTSX Family > > Intel Haswell Family > > Intel Broadwell-noTSX Family > > Intel Broadwell Family > > Intel Skylake Family > > AMD Opteron G1 > > AMD Opteron G2 > > AMD Opteron G3 > > AMD Opteron G4 > > AMD Opteron G5 > > IBM POWER8 > > > > Or to get a display console on a mac os: > > > > $open $(./ovcmd vm -n vmname console ) > > > > > > It can be found at https://github.com/fbacchella/ovirtcmd/tree/sdk4 <https://github.com/fbacchella/ovirtcmd/tree/sdk4> > > It's still works in progress, I need to finish to remove sdk3
code.
> > > > Some example of object written to sdk4 can be found at: > > > > https://github.com/fbacchella/ovirtcmd/blob/sdk4/ovlib/vms/_
_init__.py
ovlib/vms/__init__.py>
> > > > _______________________________________________ > > Users mailing list > > Users@ovirt.org <mailto:Users@ovirt.org> > > http://lists.ovirt.org/mailman/listinfo/users <http://lists.ovirt.org/mailman/listinfo/users>
_______________________________________________ Users mailing list Users@ovirt.org http://lists.ovirt.org/mailman/listinfo/users

I wrote too soon! oops generated the wrong api! On 28 April 2017 at 20:09, Ben De Luca <bdeluca@gmail.com> wrote:
I just generated the python API with the cmdline tools.
I tend to use docker with random things like this from the internet, but with docker installed this will generate a python version of the api.
docker run --rm -v ${PWD}:/local swaggerapi/swagger-codegen-cli generate \ -c /local/swagger.json \ -l python \ -o /local/out/
to a folder called local/out
On 28 April 2017 at 20:01, Juan Hernández <jhernand@redhat.com> wrote:
On 04/28/2017 06:00 PM, Ben De Luca wrote:
before people go writing yet another api client wouldn't it make sense to just define the api client in terms of some thing like swagger ? http://swagger.io/
The oVirt API has a formal specification, defined in this project:
https://github.com/oVirt/ovirt-engine-api-model
The skeleton of the server, the documentation, and the SDKs are automatically generated from that specification.
There is also an experimental Swagger/OpenAPI specification, available here:
https://jhernand.fedorapeople.org/ovirt-engine-api-model/swagger.json
However this seems to be too big for Swagger tools (1 MiB, 17000 lines). Every time I tried to load it into Swagger editor or Swagger UI it just burns the CPU of the browser and never finishes loading. If you have some Swagger expertise would be nice if you can take a look and pinpoint what is the problem.
On 28 April 2017 at 18:57, Alexander Wels <awels@redhat.com <mailto:awels@redhat.com>> wrote:
On Friday, April 28, 2017 11:41:03 AM EDT Ben De Luca wrote: > does ovirt have a restful api? >
Yes,
Its available at https://<engine_url>/ovirt-engine/api
In fact the python/java/ruby sdk are just wrappers to calling this
api.
> On 28 April 2017 at 13:43, Fabrice Bacchella <fabrice.bacchella@orange.fr <mailto:fabrice.bacchella@orange.fr>> > > wrote: > > I have started to write a custom sdk/cli in python for Ovirt 4.
It
> > provides helpers and wrapper for the rather raw level sdk4
provided.
> > > > It's still a work in progress, but a big improvement from my previous > > version, made for ovirt 3. > > > > It allows to write simple commands on shell : > > > > $ ./ovcmd host -n hostname maintenance > > $ ./ovcmd host -n hostname activate > > > > It also allows to do fine exports: > > > > $ ./ovcmd vm -n vmname export os type > > rhel_6x64 > > > > $ ./ovcmd capabilities -n 4.1 export cpu_types name > > Intel Conroe Family > > Intel Penryn Family > > Intel Nehalem Family > > Intel Westmere Family > > Intel SandyBridge Family > > Intel Haswell-noTSX Family > > Intel Haswell Family > > Intel Broadwell-noTSX Family > > Intel Broadwell Family > > Intel Skylake Family > > AMD Opteron G1 > > AMD Opteron G2 > > AMD Opteron G3 > > AMD Opteron G4 > > AMD Opteron G5 > > IBM POWER8 > > > > Or to get a display console on a mac os: > > > > $open $(./ovcmd vm -n vmname console ) > > > > > > It can be found at https://github.com/fbacchella/ovirtcmd/tree/sdk4 <https://github.com/fbacchella/ovirtcmd/tree/sdk4> > > It's still works in progress, I need to finish to remove sdk3
code.
> > > > Some example of object written to sdk4 can be found at: > > > > https://github.com/fbacchella/ovirtcmd/blob/sdk4/
ovlib/vms/__init__.py
vms/__init__.py>
> > > > _______________________________________________ > > Users mailing list > > Users@ovirt.org <mailto:Users@ovirt.org> > > http://lists.ovirt.org/mailman/listinfo/users <http://lists.ovirt.org/mailman/listinfo/users>
_______________________________________________ Users mailing list Users@ovirt.org http://lists.ovirt.org/mailman/listinfo/users

ok this works. docker run --rm -v ${PWD}:/local swaggerapi/swagger-codegen-cli generate \ -i /local/swagger.json \ -c /local/config.json \ -l python \ -o /local/out/ where config looks like {"packageName": "overt", "packageVersion": "0.9" } On 28 April 2017 at 20:11, Ben De Luca <bdeluca@gmail.com> wrote:
I wrote too soon! oops generated the wrong api!
On 28 April 2017 at 20:09, Ben De Luca <bdeluca@gmail.com> wrote:
I just generated the python API with the cmdline tools.
I tend to use docker with random things like this from the internet, but
docker run --rm -v ${PWD}:/local swaggerapi/swagger-codegen-cli generate
\
-c /local/swagger.json \ -l python \ -o /local/out/
to a folder called local/out
On 28 April 2017 at 20:01, Juan Hernández <jhernand@redhat.com> wrote:
On 04/28/2017 06:00 PM, Ben De Luca wrote:
before people go writing yet another api client wouldn't it make sense to just define the api client in terms of some thing like swagger ? http://swagger.io/
The oVirt API has a formal specification, defined in this project:
https://github.com/oVirt/ovirt-engine-api-model
The skeleton of the server, the documentation, and the SDKs are automatically generated from that specification.
There is also an experimental Swagger/OpenAPI specification, available
here:
https://jhernand.fedorapeople.org/ovirt-engine-api-model/swagger.json
However this seems to be too big for Swagger tools (1 MiB, 17000 lines). Every time I tried to load it into Swagger editor or Swagger UI it just burns the CPU of the browser and never finishes loading. If you have some Swagger expertise would be nice if you can take a look and pinpoint what is the problem.
On 28 April 2017 at 18:57, Alexander Wels <awels@redhat.com <mailto:awels@redhat.com>> wrote:
On Friday, April 28, 2017 11:41:03 AM EDT Ben De Luca wrote: > does ovirt have a restful api? >
Yes,
Its available at https://<engine_url>/ovirt-engine/api
In fact the python/java/ruby sdk are just wrappers to calling
> On 28 April 2017 at 13:43, Fabrice Bacchella <fabrice.bacchella@orange.fr <mailto:fabrice.bacchella@orange.fr>> > > wrote: > > I have started to write a custom sdk/cli in python for Ovirt
> > provides helpers and wrapper for the rather raw level sdk4
with docker installed this will generate a python version of the api. this api. 4. It provided.
> > > > It's still a work in progress, but a big improvement from my previous > > version, made for ovirt 3. > > > > It allows to write simple commands on shell : > > > > $ ./ovcmd host -n hostname maintenance > > $ ./ovcmd host -n hostname activate > > > > It also allows to do fine exports: > > > > $ ./ovcmd vm -n vmname export os type > > rhel_6x64 > > > > $ ./ovcmd capabilities -n 4.1 export cpu_types name > > Intel Conroe Family > > Intel Penryn Family > > Intel Nehalem Family > > Intel Westmere Family > > Intel SandyBridge Family > > Intel Haswell-noTSX Family > > Intel Haswell Family > > Intel Broadwell-noTSX Family > > Intel Broadwell Family > > Intel Skylake Family > > AMD Opteron G1 > > AMD Opteron G2 > > AMD Opteron G3 > > AMD Opteron G4 > > AMD Opteron G5 > > IBM POWER8 > > > > Or to get a display console on a mac os: > > > > $open $(./ovcmd vm -n vmname console ) > > > > > > It can be found at https://github.com/fbacchella/ovirtcmd/tree/sdk4 <https://github.com/fbacchella/ovirtcmd/tree/sdk4> > > It's still works in progress, I need to finish to remove sdk3
code.
> > > > Some example of object written to sdk4 can be found at: > > > >
https://github.com/fbacchella/ovirtcmd/blob/sdk4/ovlib/vms/__init__.py
<
https://github.com/fbacchella/ovirtcmd/blob/sdk4/ovlib/vms/__init__.py>
> > > > _______________________________________________ > > Users mailing list > > Users@ovirt.org <mailto:Users@ovirt.org> > > http://lists.ovirt.org/mailman/listinfo/users <http://lists.ovirt.org/mailman/listinfo/users>
_______________________________________________ Users mailing list Users@ovirt.org http://lists.ovirt.org/mailman/listinfo/users

Le 28 avr. 2017 à 18:00, Ben De Luca <bdeluca@gmail.com> a écrit :
before people go writing yet another api client wouldn't it make sense to just define the api client in terms of some thing like swagger ? http://swagger.io/
I'm using the curl wrapper from the python sdk4, but it misses a lot of high level wrappers and helpers. That's what I'm doing, writting code like: @wrapper(writer_class=StorageDomainWriter, type_class=StorageDomain, service_class=StorageDomainService) class StorageDomainWrapper(ObjectWrapper): pass @wrapper(service_class=StorageDomainsService, service_root="storagedomains") class StoragesDomainWrapper(ListObjectWrapper): pass That allows to pack some functions that the sdk splitted or made difficult to find. It should allows to write simpler code for end user : lister = StoragesDomainWrapper(api=...) sd = lister.get(name="sd1") print sd.status sd.export()
participants (4)
-
Alexander Wels
-
Ben De Luca
-
Fabrice Bacchella
-
Juan Hernández