This is a multi-part message in MIME format.
--------------E989B134D18EA4BA207035AA
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: quoted-printable
Le 10/01/2017 =C3=A0 16:41, Yaniv Kaul a =C3=A9crit :
On Fri, Jan 6, 2017 at 3:51 PM, Nathana=C3=ABl Blanchet <blanchet(a)abes.=
fr=20
<mailto:blanchet@abes.fr>> wrote:
There was a last error in the script :
snap_service =3D snaps_service.snapshot_service(snap.id
<
http://snap.id>) instead of snap_service =3D
snaps_service.snap_service(snap.id <
http://snap.id>)
For those who are interested in using a full remove_vm_snapshot
working script:
Perhaps worth contributing to the examples[1] of the SDK?
Y.
[1]
https://github.com/oVirt/ovirt-engine-sdk/tree/master/sdk/examples Done,
you're right, this is the best way to do!
# Create the connection to the server:
connection =3D sdk.Connection(
url=3D'https://engine/ovirt-engine/api
<
https://engine/ovirt-engine/api>';,
username=3D'admin@internal',
password=3D'passwd',
# ca_file=3D'ca.pem',
insecure=3DTrue,
debug=3DTrue,
log=3Dlogging.getLogger(),
)
# Locate the virtual machines service and use it to find the virtua=
l
# machine:
vms_service =3D connection.system_service().vms_service()
vm =3D vms_service.list(search=3D'name=3Dmyvm')[0]
# Locate the service that manages the snapshots of the virtual
machine:
vm_service =3D vms_service.vm_service(vm.id <
http://vm.id>)
snaps_service =3D vm_service.snapshots_service()
snaps =3D snaps_service.list()
snap =3D [s for s in snaps if s.description =3D=3D 'My snapshot2'][=
0]
# Remove the snapshot:
snap_service =3D snaps_service.snapshot_service(snap.id
<
http://snap.id>)
snap_service.remove()
# Close the connection to the server:
connection.close()
Le 06/01/2017 =C3=A0 14:44, Nathana=C3=ABl Blanchet a =C3=A9crit :
Le 06/01/2017 =C3=A0 13:39, Juan Hern=C3=A1ndez a =C3=A9crit :
On 01/06/2017 12:20 PM, Nathana=C3=ABl Blanchet wrote:
Le 04/01/2017 =C3=A0 18:55, Juan Hern=C3=A1ndez a =C3=A9=
crit :
On 01/04/2017 05:38 PM, Nathana=C3=ABl Blanchet wro=
te:
Le 04/01/2017 =C3=A0 15:41, Juan Hern=C3=A1ndez=
a
=C3=A9crit :
On 01/04/2017 12:30 PM, Yaniv Kaul wrote:
On Wed, Jan 4, 2017 at 1:04 PM,
Nicolas Ecarnot <nicolas(a)ecarnot.net
<mailto:nicolas@ecarnot.net
<mailto:nicolas@ecarnot.net
<mailto:nicolas@ecarnot.net>>> wrote:
Hello,
Le 04/01/2017 =C3=A0 11:49,
Nathana=C3=ABl Blanchet a =C3=A9crit :
Le 04/01/2017 =C3=A0 10:09,
Andrea Ghelardi a =C3=A9crit :
Personally I don=E2=80=99=
t
think ansible and ovirt-shell are
mutually exclusive.
Those who are in
ansible and devops realms are not
really
scared by
making python/ansible
work with ovirt.
From what I gather,
playbooks are quite a de-facto
pre-requisite to
build up a real SaaC
=E2=80=9CSoftware as a Code=E2=80=9D en=
vironment.
On the other hand,
ovirt-shell can and is a fast/easy
way to
perform
=E2=80=9Cnormal daily ta=
sks=E2=80=9D.
totally agree but
ovirt-shell is deprecated in 4.1 et
will be
removed in
4.2. Ansible or sdk4 are
proposed as an alternative.
Could someone point me to an
URL where sdk4 is fully
documented, as
I have to get ready for
ovirt-shell deprecation?
The Rest API is partially documented un=
der
https://<engine>/api/model .
It's not complete yet. All new
features in 4.0 are documented and
we are
working on the 'older' features now.
(contributions are welcome!)
I'm sure no one at Redhat
thought about deprecating a tool in
favor
of a new one before providing a
complete user doc!
In addition, the SDK RPM itself
contains many examples. See [1].
(contributions are welcome!)
Y.
[1]
https://github.com/oVirt/ovirt-engine-s=
dk/tree/master/sdk/examples
sdk/tree/master/sdk/examples
Although these examples, I can successfully
create a snapshot, but I
didn't find the way to delete it...
Regarding many example, it should be possible
to locate any service by :
name_service =3D
connection.system_service().name.service()
So logically it should be doable with snapshot
like
snapshots_service =3D
connection.system_service().snapshots.service()
but : AttributeError: 'SystemService' object
has no attribute 'snapshots
In the SDK the services are arranged in a tree
structure that mimics the
URL structure of the API. For example, if you want
to get the service
that manages a particular snapshot, in the API you
would use an URL like
this:
/ovirt-engine/api/vms/123/snapshots/456
In the Python SDK that translates into this:
snap_service =3D connection.system_service() \
.vms_service() \
.vm_service('123') \
.snapshots_service() \
.snapshot_service('456')
There is also a generic "service" method that is
useful when you already
have all that path as an string:
snap_service =3D
connection.service("vms/123/snapshots/456")
Both return exactly the same object. The first is
usually better when
you are calculating the path of the object step by
step, and I generally
prefer it as it is less error prone.
Once you have the reference to the service, you
can use the 'remove'
method:
snap_service.remove()
If you need to search by the names of the objects,
then you can use the
'search' methods, which are only available for the
top level objects,
like VM, data centers, clusters, etc. For example,
to find your virtual
machine and then the snapshot:
# Get the root service:
system_service =3D connection.system_service()
# Find the virtual machine:
vms_service =3D system_service.vms_service()
vm =3D vms_service.list(search=3D'name=3Dmyvm')=
[0]
# Find the snapshot:
vm_service =3D vms_service.vm_service(vm.id
<
http://vm.id>)
snaps_service =3D vm_service.snapshots_service(=
)
snaps =3D snaps_service.list()
snap =3D [s for s in snaps where s.description
=3D=3D 'My snap'][0]
sounds good, thank so much for taking time to explain,
but for the last
entry, I get ;
snap =3D [s for s in snaps where s.description =3D=3D '=
My
snapshot2'][0]
^
SyntaxError: invalid syntax
I apologize, I wrote that too fast. That is SQL syntax,
not Python. In
python should be "if" instead of "where":
snap =3D [s for s in snaps if s.description =3D=3D 'My
snapshot2'][0]
Thank you, it's ok for now.
May I use a version 3 of python?
You SDK supports both Python 2 and Python 3. If you are
using the RPMs
make sure to install the 'python3-ovirt-engine-sdk4' packag=
e.
python3-ovirt-engine-sdk4 doesn't exist in repos, only
python-ovirt-engine-sdk4
Thanks to your explanations, I begin to understand the
philosophy of this sdk, it's far different from sdk3.
What's was wrong with the v3, what was the motivation to write
a new version?
Will it be possible to use the old sdk3 (manually installed)
for old scripts in ovirt 4.2 ?
Note that both are supported, but Python 3 doesn't get a
lot of
attention yet, so you may find issues. If you find any
issue with Python
3 let as know, as we are committed to make it work.
# Remove the snapshot:
snap_service =3D
snaps_service.snap_service(snap.id <
http://snap.id>= )
snap_service.remove()
I saw an example into the ansible [ working ]
way to do the same thing
and I found this :
snapshot =3D
snapshots_service.snapshot_service(module.param=
s['snapshot_id']).get()
How can I get this working with sdk, I mean
giving snapshot_id as a
parameter?
Also the complete reference documentation
of the Python SDK is
available
here:
http://ovirt.github.io/ovirt-engine-sdk/v4.=
0/4.0.3/index.html
.0/4.0.3/index.html
There also SDKs for Ruby and Java, in case
Python is not your preferred
language:
Ruby:
https://github.com/oVirt/ovirt-engine-sdk-r=
uby/tree/master/sdk
ruby/tree/master/sdk
uby/tree/master/sdk/examples
ruby/tree/master/sdk/examples
dk
sdk
ava/tree/master/sdk
java/tree/master/sdk
ava/tree/master/sdk/src/test/java/org/ovirt/engine/sdk4/examples
java/tree/master/sdk/src/test/java/org/ovirt/engine/sdk4/examples
api/sdk
.api/sdk
--
Nicolas ECARNOT
=20
______________________________________=
_________
Users mailing list
Users(a)ovirt.org
<mailto:Users@ovirt.org
<mailto:Users@ovirt.org
<mailto:Users@ovirt.org>
http://lists.ovirt.org/mailman/listinfo= /users
o/users
o/users
o/users>
_______________________________________=
________
Users mailing list
Users(a)ovirt.org <mailto:Users@ovirt.org=
http://lists.ovirt.org/mailman/listinfo= /users
o/users
___________________________________________=
____
Users mailing list
Users(a)ovirt.org <mailto:Users@ovirt.org
http://lists.ovirt.org/mailman/listinfo/use= rs
ers
--=20
Nathana=C3=ABl Blanchet
Supervision r=C3=A9seau
P=C3=B4le Infrastrutures Informatiques
227 avenue Professeur-Jean-Louis-Viala
34193 MONTPELLIER CEDEX 5
T=C3=A9l. 33 (0)4 67 54 84 55
Fax 33 (0)4 67 54 84 14
blanchet(a)abes.fr <mailto:blanchet@abes.fr
_______________________________________________
Users mailing list
Users(a)ovirt.org <mailto:Users@ovirt.org
http://lists.ovirt.org/mailman/listinfo/users
<
http://lists.ovirt.org/mailman/listinfo/users
--=20
Nathana=C3=ABl Blanchet
Supervision r=C3=A9seau
P=C3=B4le Infrastrutures Informatiques
227 avenue Professeur-Jean-Louis-Viala
34193 MONTPELLIER CEDEX 5 =09
T=C3=A9l. 33 (0)4 67 54 84 55
Fax 33 (0)4 67 54 84 14
blanchet(a)abes.fr
--------------E989B134D18EA4BA207035AA
Content-Type: text/html; charset=utf-8
Content-Transfer-Encoding: quoted-printable
<html
<head
<meta content=3D"text/html; charset=3Dutf-8"
http-equiv=3D"Content-Ty=
pe"
</head
<body text=3D"#000000"
bgcolor=3D"#FFFFFF"
<p><br
</p
<br
<div class=3D"moz-cite-prefix">Le
10/01/2017 =C3=A0 16:41, Yaniv Kaul=
a
=C3=A9crit=C2=A0:<br
</div
<blockquote
cite=3D"mid:CAJgorsZj8XiO-xR4+MtNy3cco9yUbqR5mJnT+q-qciMSkNLEFA@mail.gmai=
l.com"
type=3D"cite"
<div
dir=3D"ltr"><br
<div
class=3D"gmail_extra"><br
<div class=3D"gmail_quote">On Fri, Jan 6, 2017 at 3:51 PM,
Nathana=C3=ABl Blanchet <span dir=3D"ltr"><<a
moz-do-not-send=3D"true"
href=3D"mailto:blanchet@abes.fr"
target=3D"_blank"><a
class=3D"moz-txt-link-abbreviated" h=
ref=3D"mailto:blanchet@abes.fr">blanchet@abes.fr</a></a>></span>
wrote=
:<br
<blockquote class=3D"gmail_quote"
style=3D"margin:0px 0px 0px
0.8ex;border-left:1px solid
rgb(204,204,204);padding-left:1ex">There was a last error
in the script :<br
<br
snap_service =3D
snaps_service.snapshot_service<wbr>(<a
moz-do-not-send=3D"true" href=3D"http://snap.id"
rel=3D"noreferrer"
target=3D"_blank">snap.id</a>) instead=
of
snap_service =3D snaps_service.snap_service(<a
moz-do-not-send=3D"true" href=3D"http://snap.id"
rel=3D"noreferrer"
target=3D"_blank">sna<wbr>p.id</a>)<br=
<br
For those who are interested in using a full
remove_vm_snapshot working script:<br
</blockquote
<div><br
</div
<div>Perhaps worth contributing to the examples[1] of the
SDK?</div
<div>Y.</div
<div><br
</div
<div>[1] <a moz-do-not-send=3D"true"
href=3D"https://github.com/oVirt/ovirt-engine-sdk/tree/master/sdk/ex...
s">https://github.com/oVirt/ovirt-engine-sdk/tree/master/sdk/exam...
</div
</div
</div
</div
</blockquote
Done, you're right, this is the best way to
do!<br
<blockquote
cite=3D"mid:CAJgorsZj8XiO-xR4+MtNy3cco9yUbqR5mJnT+q-qciMSkNLEFA@mail.gmai=
l.com"
type=3D"cite"
<div
dir=3D"ltr"
<div
class=3D"gmail_extra"
<div
class=3D"gmail_quote"
<div>=C2=A0</div
<blockquote
class=3D"gmail_quote" style=3D"margin:0px 0px 0px
0.8ex;border-left:1px solid
rgb(204,204,204);padding-left:1ex"
<br
# Create the
connection to the server:<br
connection =3D
sdk.Connection(<br
=C2=A0
url=3D'<a moz-do-not-send=3D"true"
href=3D"https://engine/ovirt-engine/api" rel=3D"noreferre=
r"
target=3D"_blank">https://engine/ovirt-engi<wbr>ne/api</a=
>',<br
=C2=A0
username=3D'admin@internal',<br
=C2=A0 password=3D'passwd',<br
#=C2=A0 ca_file=3D'ca.pem',<br
=C2=A0 insecure=3DTrue,<br
=C2=A0
debug=3DTrue,<br
=C2=A0
log=3Dlogging.getLogger(),<br
)<br
<br
# Locate the virtual machines service and use it to find
the virtual<br
# machine:<br
vms_service =3D
connection.system_service().vm<wbr>s_servic=
e()<span
class=3D"gmail-"><br
vm =3D vms_service.list(search=3D'name=3D<wbr>myvm')[0]<b=
r
<br
</span
# Locate the service
that manages the snapshots of the
virtual machine:<span class=3D"gmail-"><br
vm_service =3D vms_service.vm_service(<a
moz-do-not-send=3D"true" href=3D"http://vm.id"
rel=3D"noreferrer"
target=3D"_blank">vm.id</a>)<br
snaps_service =3D vm_service.snapshots_service()<br
snaps =3D snaps_service.list()<br
</span><span class=3D"gmail-"
snap =3D [s for s in snaps if s.description =3D=3D 'My
snapshot2'][0]<br
<br
</span
# Remove the snapshot:<br
snap_service =3D
snaps_service.snapshot_service<wbr>(<a
moz-do-not-send=3D"true" href=3D"http://snap.id"
rel=3D"noreferrer"
target=3D"_blank">snap.id</a>)<br
snap_service.remove()<br
<br
# Close the connection to the server:<br
connection.close()
<div class=3D"gmail-HOEnZb"
<div class=3D"gmail-h5"><br
<br
Le 06/01/2017
=C3=A0 14:44, Nathana=C3=ABl Blanchet a =C3=
=A9crit :<br
<blockquote
class=3D"gmail_quote" style=3D"margin:0px 0=
px
0px 0.8ex;border-left:1px solid
rgb(204,204,204);padding-left:1ex"
<br
<br
Le 06/01/2017 =C3=A0 13:39, Juan
Hern=C3=A1ndez a =C3=
=A9crit :<br
<blockquote
class=3D"gmail_quote" style=3D"margin:0px
0px 0px 0.8ex;border-left:1px solid
rgb(204,204,204);padding-left:1ex"
On 01/06/2017 12:20 PM, Nathana=C3=ABl Blanchet wro=
te:<br
<blockquote
class=3D"gmail_quote" style=3D"margin:0=
px
0px 0px 0.8ex;border-left:1px solid
rgb(204,204,204);padding-left:1ex"
<br
Le 04/01/2017 =C3=A0 18:55, Juan Hern=C3=A1ndez a=
=C3=A9crit :<br
<blockquote class=3D"gmail_quote"
style=3D"margin:0px 0px 0px
0.8ex;border-left:1px solid
rgb(204,204,204);padding-left:1ex"
On 01/04/2017 05:38 PM,
Nathana=C3=ABl Blanchet
wrote:<br
<blockquote class=3D"gmail_quote"
style=3D"margin:0px 0px 0px
0.8ex;border-left:1px solid
rgb(204,204,204);padding-left:1ex"
Le 04/01/2017 =C3=A0 15:41, Juan
Hern=C3=A1nd=
ez a
=C3=A9crit :<br
<blockquote class=3D"gmail_quote"
style=3D"margin:0px 0px 0px
0.8ex;border-left:1px solid
rgb(204,204,204);padding-left:1ex"
On 01/04/2017 12:30 PM, Yaniv
Kaul wrote:<b=
r
<blockquote
class=3D"gmail_quote"
style=3D"margin:0px 0px 0px
0.8ex;border-left:1px solid
rgb(204,204,204);padding-left:1ex"
On Wed, Jan 4, 2017 at 1:04 PM,
Nicolas
Ecarnot <<a moz-do-not-send=3D"true"
href=3D"mailto:nicolas@ecarnot.net"
target=3D"_blank">nicolas(a)ecarnot.net</=
a><br
<mailto:<a moz-do-not-send=3D"true"
href=3D"mailto:nicolas@ecarnot.net"
target=3D"_blank">nicolas(a)ecarnot.net</=
a>>>
wrote:<br
<br
=C2=A0 =C2=A0 =C2=A0 =C2=A0Hello,<br
<br
=C2=A0 =C2=A0 =C2=A0 =C2=A0Le 04/01/2017 =
=C3=A0 11:49, Nathana=C3=ABl
Blanchet a =C3=A9crit :<br
<br
<br
<br
=C2=A0 =C2=A0 =C2=A0 =C2=A0
=C2=A0 =C2=A0=
Le 04/01/2017 =C3=A0 10:09, Andrea
Ghelardi a =C3=A9crit :<br
<br
<br
=C2=A0 =C2=A0 =C2=A0 =C2=A0
=C2=A0 =C2=A0=
=C2=A0 =C2=A0Personally I don=E2=80=99t think
ansible and ovirt-shell are<br
=C2=A0 =C2=A0 =C2=A0 =C2=A0
=C2=A0 =C2=A0=
=C2=A0 =C2=A0mutually exclusive.<br
<br
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=
=C2=A0 =C2=A0Those who are in ansible
and devops realms are not<br
really<br
=C2=A0 =C2=A0 =C2=A0 =C2=A0
=C2=A0 =C2=A0=
=C2=A0 =C2=A0scared by<br
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=
=C2=A0 =C2=A0making python/ansible
work with ovirt.<br
<br
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=
=C2=A0 =C2=A0From what I gather,
playbooks are quite a de-facto<br
=C2=A0 =C2=A0 =C2=A0 =C2=A0
=C2=A0 =C2=A0=
=C2=A0 =C2=A0pre-requisite to<br
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=
=C2=A0 =C2=A0build up a real SaaC
=E2=80=9CSoftware as a Code=E2=80=9D envi=
ronment.<br
<br
<br
<br
=C2=A0 =C2=A0 =C2=A0 =C2=A0
=C2=A0 =C2=A0=
=C2=A0 =C2=A0On the other hand,
ovirt-shell can and is a fast/easy<br
way to<br
=C2=A0 =C2=A0 =C2=A0 =C2=A0
=C2=A0 =C2=A0=
=C2=A0 =C2=A0perform<br
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=
=C2=A0 =C2=A0=E2=80=9Cnormal daily tasks=E2=80=9D.<br
<br
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=
totally agree but ovirt-shell
is deprecated in 4.1 et<br
will be<br
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=
removed in<br
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=
4.2. Ansible or sdk4 are
proposed as an alternative.<br
<br
<br
=C2=A0 =C2=A0 =C2=A0
=C2=A0Could someone =
point me to an URL
where sdk4 is fully<br
documented, as<br
=C2=A0 =C2=A0 =C2=A0 =C2=A0I have to get =
ready for
ovirt-shell deprecation?<br
<br
<br
The Rest API is partially
documented
under<br
<a class=3D"moz-txt-link-freetext" href=3D=
"https://">https://</a><engine>/api/model .<br
It's not complete yet. All
new features
in 4.0 are documented and<br
we are<br
working on the 'older'
features now.<br
(contributions are welcome!)<br
<br
<br
=C2=A0 =C2=A0 =C2=A0
=C2=A0I'm sure no on=
e at Redhat thought
about deprecating a tool in<br
favor<br
=C2=A0 =C2=A0 =C2=A0 =C2=A0of a
new one b=
efore providing a
complete user doc!<br
<br
<br
In addition, the SDK RPM itself
contains
many examples. See [1].<br
(contributions are welcome!)<br
<br
Y.<br
<br
[1] <a
moz-do-not-send=3D"true"
href=3D"https://github.com/oVirt/ovirt-engine-sdk/tree/master/sdk/ex...
s"
rel=3D"noreferrer"
target=3D"_blank">ht=
tps://github.com/oVirt/ovirt<wbr>-engine-sdk/tree/master/sdk/<wb...
s</a><br
<br
</blockquote
</blockquote
Although these examples, I can
successfully
create a snapshot, but I<br
didn't find the way to delete it...<br
Regarding many example, it should
be
possible to locate any service by :<br
name_service =3D
connection.system_service().na<wbr>me.service=
()<br
<br
So logically it should be doable
with
snapshot like<br
snapshots_service =3D
connection.system_service().sn<wbr>apshots.se=
rvice()<br
but :
AttributeError: 'SystemService' object
has no attribute 'snapshots<br
<br
</blockquote
In the SDK
the services are arranged in a tree
structure that mimics the<br
URL structure of the API. For example, if you
want to get the service<br
that manages a particular snapshot, in the API
you would use an URL like<br
this:<br
<br
=C2=A0 =C2=A0
/ovirt-engine/api/vms/123/snap<wb=
r>shots/456<br
<br
In the Python SDK that translates
into this:<br=
<br
=C2=A0 =C2=A0 snap_service =3D connection.syste=
m_service()
\<br
=C2=A0
=C2=A0 =C2=A0 .vms_service() \<br
=C2=A0 =C2=A0 =C2=A0 .vm_service('123') \<br
=C2=A0 =C2=A0 =C2=A0
.snapshots_service() \<br
=C2=A0
=C2=A0 =C2=A0 .snapshot_service('456')<b=
r
<br
There is also a generic "service" method that
is useful when you already<br
have all that path as an string:<br
<br
=C2=A0
=C2=A0 snap_service =3D
connection.service("vms/123/sn<wbr>apshots/456"=
)<br
<br
Both return exactly the same object. The first
is usually better when<br
you are calculating the path of the object
step by step, and I generally<br
prefer it as it is less error prone.<br
<br
Once you
have the reference to the service,
you can use the 'remove'<br
method:<br
<br
=C2=A0 =C2=A0 snap_service.remove()<br
<br
If you
need to search by the names of the
objects, then you can use the<br
'search' methods, which are only available for
the top level objects,<br
like VM, data centers, clusters, etc. For
example, to find your virtual<br
machine and then the snapshot:<br
<br
=C2=A0
=C2=A0 # Get the root service:<br
=C2=A0 =C2=A0 system_service =3D
connection.system_service()<br
<br
=C2=A0
=C2=A0 # Find the virtual machine:<br
=C2=A0 =C2=A0 vms_service =3D system_service.vm=
s_service()<br
=C2=A0
=C2=A0 vm =3D vms_service.list(search=3D=
'name=3D<wbr>myvm')[0]<br
<br
=C2=A0
=C2=A0 # Find the snapshot:<br
=C2=A0
=C2=A0 vm_service =3D vms_service.vm_ser=
vice(<a
moz-do-not-send=3D"true" href=3D"http://vm.id=
"
rel=3D"noreferrer"
target=3D"_blank">vm.id</a=
>)<br
=C2=A0
=C2=A0 snaps_service =3D
vm_service.snapshots_service()<br
=C2=A0 =C2=A0 snaps =3D
snaps_service.list()<br=
=C2=A0 =C2=A0 snap =3D [s for s in
snaps where
s.description =3D=3D 'My snap'][0]<br
</blockquote
sounds good, thank so much for taking
time to
explain, but for the last<br
entry, I get ;<br
<br
snap =3D [s for s in snaps where
s.description =3D=
=3D
'My snapshot2'][0]<br
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ^<br
SyntaxError: invalid syntax<br
</blockquote
I apologize, I
wrote that too fast. That is SQL
syntax, not Python. In<br
python should be "if" instead of "where":<br
<br
=C2=A0 =C2=A0snap =3D [s for s in snaps if s.descri=
ption =3D=3D
'My snapshot2'][0]<br
</blockquote
Thank you,
it's ok for now.<br
<blockquote
class=3D"gmail_quote" style=3D"margin:0px
0px 0px 0.8ex;border-left:1px solid
rgb(204,204,204);padding-left:1ex"
<br
<blockquote
class=3D"gmail_quote" style=3D"margin:0=
px
0px 0px 0.8ex;border-left:1px solid
rgb(204,204,204);padding-left:1ex"
May I use a version 3 of
python?<br
</blockquote
You SDK
supports both Python 2 and Python 3. If
you are using the RPMs<br
make sure to install the
'python3-ovirt-engine-sdk4' package.<br
</blockquote
<br
python3-ovirt-engine-sdk4 doesn't exist in repos,
only python-ovirt-engine-sdk4<br
Thanks to your explanations, I begin to understand
the philosophy of this sdk, it's far different from
sdk3.<br
What's was
wrong with the v3, what was the
motivation to write a new version?<br
Will it be possible to use the old sdk3 (manually
installed) for old scripts in ovirt 4.2 ?<br
<br
<blockquote class=3D"gmail_quote" style=3D"margin:0px
0px 0px 0.8ex;border-left:1px solid
rgb(204,204,204);padding-left:1ex"
<br
Note that both
are supported, but Python 3 doesn't
get a lot of<br
attention yet, so you may find issues. If you find
any issue with Python<br
3 let as know, as we are committed to make it
work.<br
<br
<blockquote
class=3D"gmail_quote" style=3D"margin:0=
px
0px 0px 0.8ex;border-left:1px solid
rgb(204,204,204);padding-left:1ex"
<blockquote
class=3D"gmail_quote"
style=3D"margin:0px 0px 0px
0.8ex;border-left:1px solid
rgb(204,204,204);padding-left:1ex"
=C2=A0 =C2=A0 # Remove the
snapshot:<br
=C2=A0
=C2=A0 snap_service =3D snaps_service.sn=
ap_service(<a
moz-do-not-send=3D"true" href=3D"http://snap.=
id"
rel=3D"noreferrer"
target=3D"_blank">sna<wbr>=
p.id</a>)<br
=C2=A0
=C2=A0 snap_service.remove()<br
<br
<blockquote
class=3D"gmail_quote"
style=3D"margin:0px 0px 0px
0.8ex;border-left:1px solid
rgb(204,204,204);padding-left:1ex"
I saw an example into the ansible [
working
] way to do the same thing<br
and I found this :<br
snapshot =3D<br
snapshots_service.snapshot_ser<wbr>vice(modul=
e.params['snapshot_<wbr>id']).get()
<br
<br
How can I get this working with
sdk, I mean
giving snapshot_id as a<br
parameter?<br
<br
<br
<blockquote class=3D"gmail_quote"
style=3D"margin:0px 0px 0px
0.8ex;border-left:1px solid
rgb(204,204,204);padding-left:1ex"
Also the complete reference
documentation
of the Python SDK is<br
available<br
here:<br
<br
<a
moz-do-not-send=3D"true"
href=3D"http://ovirt.github.io/ovirt-engi=
ne-sdk/v4.0/4.0.3/index.html"
rel=3D"noreferrer"
target=3D"_blank">http=
://ovirt.github.io/ovirt-e<wbr>ngine-sdk/v4.0/4.0.3/index.htm<wbr>l</a><b=
r
<br
There also SDKs for Ruby and
Java, in case
Python is not your preferred<br
language:<br
<br
=C2=A0 =C2=A0
=C2=A0Ruby:<br
<a
moz-do-not-send=3D"true"
href=3D"https://github.com/oVirt/ovirt-en=
gine-sdk-ruby/tree/master/sdk"
rel=3D"noreferrer"
target=3D"_blank">http=
s://github.com/oVirt/ovirt<wbr>-engine-sdk-ruby/tree/master/<wbr...
br
<a
moz-do-not-send=3D"true"
href=3D"https://github.com/oVirt/ovirt-engine-sdk-ruby/tree/master/s...
amples"
rel=3D"noreferrer"
target=3D"_blank">http=
s://github.com/oVirt/ovirt<wbr>-engine-sdk-ruby/tree/master/<wbr...
ples</a
<br
=C2=A0 =C2=A0 =C2=A0<a
moz-do-not-send=3D"t=
rue"
href=3D"http://www.rubydoc.info/gems/ovir=
t-engine-sdk"
rel=3D"noreferrer"
target=3D"_blank">http=
://www.rubydoc.info/gems/<wbr>ovirt-engine-sdk</a><br
<br
=C2=A0 =C2=A0
=C2=A0Java:<br
<a
moz-do-not-send=3D"true"
href=3D"https://github.com/oVirt/ovirt-en=
gine-sdk-java/tree/master/sdk"
rel=3D"noreferrer"
target=3D"_blank">http=
s://github.com/oVirt/ovirt<wbr>-engine-sdk-java/tree/master/<wbr...
br
<br
<a
moz-do-not-send=3D"true"
href=3D"https://github.com/oVirt/ovirt-engine-sdk-java/tree/master/s...
c/test/java/org/ovirt/engine/sdk4/examples"
rel=3D"noreferrer"
target=3D"_blank">http=
s://github.com/oVirt/ovirt<wbr>-engine-sdk-java/tree/master/<wbr...
test/java/org/ovirt/<wbr>engine/sdk4/examples</a
<br
<br
<br
=C2=A0 =C2=A0 =C2=A0<a
moz-do-not-send=3D"t=
rue"
href=3D"http://www.javadoc.io/doc/org.ovi=
rt.engine.api/sdk"
rel=3D"noreferrer"
target=3D"_blank">http=
://www.javadoc.io/doc/<wbr>org.ovirt.engine.api/sdk</a><br
<br
<blockquote
class=3D"gmail_quote"
style=3D"margin:0px 0px 0px
0.8ex;border-left:1px solid
rgb(204,204,204);padding-left:1ex"
=C2=A0 =C2=A0 =C2=A0
=C2=A0--<br
=C2=A0 =C2=A0 =C2=A0 =C2=A0Nicolas ECARNO=
T<br
<br
=C2=A0 =C2=A0 =C2=A0
=C2=A0______________=
_______________<wbr>__________________<br
=C2=A0 =C2=A0 =C2=A0 =C2=A0Users mailing =
list<br
=C2=A0 =C2=A0 =C2=A0 =C2=A0<a moz-do-not-=
send=3D"true"
href=3D"mailto:Users@ovirt.org"
target=3D"_blank">Users(a)ovirt.org</a
<mailto:<a
moz-do-not-send=3D"true"
href=3D"mailto:Users@ovirt.org"
target=3D"_blank">Users(a)ovirt.org</a>&g=
t;<br
=C2=A0 =C2=A0 =C2=A0 =C2=A0<a moz-do-not-=
send=3D"true"
href=3D"http://lists.ovirt.org/mailman/=
listinfo/users"
rel=3D"noreferrer"
target=3D"_blank">ht=
tp://lists.ovirt.org/mailma<wbr>n/listinfo/users</a><br
<<a
moz-do-not-send=3D"true"
href=3D"http://lists.ovirt.org/mailman/=
listinfo/users"
rel=3D"noreferrer"
target=3D"_blank">ht=
tp://lists.ovirt.org/mailma<wbr>n/listinfo/users</a>>&...
<br
<br
<br
<br
______________________________<wbr>______=
___________<br
Users mailing list<br
<a moz-do-not-send=3D"true"
href=3D"mailto:Users@ovirt.org"
target=3D"_blank">Users(a)ovirt.org</a><b=
r
<a
moz-do-not-send=3D"true"
href=3D"http://lists.ovirt.org/mailman/=
listinfo/users"
rel=3D"noreferrer"
target=3D"_blank">ht=
tp://lists.ovirt.org/mailman<wbr>/listinfo/users</a><br
<br
</blockquote
______________________________<wbr>________=
_________<br
Users
mailing list<br
<a
moz-do-not-send=3D"true"
href=3D"mailto:Users@ovirt.org"
target=3D"_blank">Users(a)ovirt.org</a><br
<a
moz-do-not-send=3D"true"
href=3D"http://lists.ovirt.org/mailman/li=
stinfo/users"
rel=3D"noreferrer"
target=3D"_blank">http=
://lists.ovirt.org/mailman<wbr>/listinfo/users</a><br
</blockquote
</blockquote
</blockquote
</blockquote
</blockquote
<br
</blockquote
<br
-- <br
Nathana=C3=ABl Blanchet<br
<br
Supervision
r=C3=A9seau<br
P=C3=B4le
Infrastrutures Informatiques<br
227 avenue
Professeur-Jean-Louis-Viala<br
34193 MONTPELLIER
CEDEX 5=C2=A0 =C2=A0 =C2=A0 =C2=A0<br=
T=C3=A9l. 33 (0)4 67 54 84 55<br
Fax=C2=A0 33 (0)4 67 54 84 14<br
<a moz-do-not-send=3D"true"
href=3D"mailto:blanchet@abes.fr"
target=3D"_blank">bl=
anchet(a)abes.fr</a><br
<br
______________________________<wbr>_________________<br=
Users mailing list<br
<a moz-do-not-send=3D"true"
href=3D"mailto:Users@ovirt.org"
target=3D"_blank">Use=
rs(a)ovirt.org</a><br
<a
moz-do-not-send=3D"true"
href=3D"http://lists.ovirt.org/mailman/listinfo/users=
"
rel=3D"noreferrer"
target=3D"_blank">http://lists.ovi=
rt.org/mailman<wbr>/listinfo/users</a><br
</div
</div
</blockquote
</div
<br
</div
</div
</blockquote
<br
<pre class=3D"moz-signature" cols=3D"72">--=20
Nathana=C3=ABl Blanchet
Supervision r=C3=A9seau
P=C3=B4le Infrastrutures Informatiques
227 avenue Professeur-Jean-Louis-Viala
34193 MONTPELLIER CEDEX 5 =09
T=C3=A9l. 33 (0)4 67 54 84 55
Fax 33 (0)4 67 54 84 14
<a class=3D"moz-txt-link-abbreviated"
href=3D"mailto:blanchet@abes.fr">bl=
anchet(a)abes.fr</a> </pre
</body
</html
--------------E989B134D18EA4BA207035AA--