Re: [ovirt-users] How to generate Swagger specification of the oVirt API?

2018-03-22 Thread Juan Hernández

On 03/22/2018 04:40 AM, Shao-Da Huang wrote:

Hi Juan,

I saw the discussion in users-list:
http://lists.ovirt.org/pipermail/users/2017-April/081618.html
and I'm curious about how to generate the Swagger specfication of existing
oVirt API (or maybe can generate by ovirt-engine-api-model?).
Could you give me some advices on the generating tools or maybe some points
to change during the procedure of building ovirt-engine?

Michael



The JSON file that I mentioned in that mail was generated using I tool 
that I started to write, but that I never finished. I just have uploaded 
the patch that adds it to the ovirt-engine-api-metamodel project:


  [WIP] Generate Swagger specification
  https://gerrit.ovirt.org/89337

Note that it is by no means complete, it is just an experiment. Take a 
look if you are curious.


Truth is that I don't plan to work on that. Would be nice if you can 
take it and complete it. If you complete it, then it could be integrated 
in the build process of the ovirt-engine-api-model project, so that it 
is generated automatically.

___
Users mailing list
Users@ovirt.org
http://lists.ovirt.org/mailman/listinfo/users


Re: [ovirt-users] Tunable parameters in ovirt engine

2018-03-08 Thread Juan Hernández
I think the configuration is good. There may be some connections that 
the server is closing before the client expected, but that is normal, in 
my opinion.


On 03/08/2018 12:34 PM, Hari Prasanth Loganathan wrote:

This is the only error message we received from ab.

I googled it and found that it is due to the connection drop. So It would
be Great, If you could check my Apache server configuration I shared in the
thread and let me know your thoughts on this.

Thanks,
Hari

On Thu, Mar 8, 2018 at 4:56 PM, Juan Hernández <jhern...@redhat.com> wrote:


But other than those SSL error messages, are the connections really
failing? Can you share the results reported by "ab"?


On 03/08/2018 12:16 PM, Hari Prasanth Loganathan wrote:


No Juan, It is not working with any benchmark / application tool. It fails
with the same error SSL handshake failed (5).

Could you let me know the configuration of Apache web server is correct?

Thanks,
Hari

On Thu, Mar 8, 2018 at 1:08 AM, Juan Hernández <jhern...@redhat.com>
wrote:

If you are still having problems I am inclined to think that it is a

client issue. For example, I'd try to remove the "-k" option from the
"ab"
command. If you use keep alive the server may decide anyhow to close the
connection after certain number of requests, even if the client asks to
keep it alive. Some clients don't handle that perfectly, "ab" may have
that
problem. If that makes the SSL error messages disappear then I think you
can safely ignore them, and restore the "-k" option, if you want.

On 03/07/2018 07:30 PM, Hari Prasanth Loganathan wrote:

Thanks Juan for your response. Appreciate it.

But for some reason still, I am facing the same SSL handshake failed
(5).
Could you please check this configuration and let me know the issue in
my
ovirt engine environment.

*Configuration of Apache server:*


1) httpd version,

# httpd -v
Server version: Apache/2.4.6 (CentOS)
Server built:   Oct 19 2017 20:39:16

2) I checked the status using the following command,

# systemctl status httpd -l
● httpd.service - The Apache HTTP Server
  Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled;
vendor
preset: disabled)
  Active: active (running) since Wed 2018-03-07 23:46:32 IST; 1min
55s
ago
Docs: man:httpd(8)
  man:apachectl(8)
 Process: 4351 ExecStop=/bin/kill -WINCH ${MAINPID} (code=exited,
status=0/SUCCESS)
Main PID: 4359 (httpd)
  Status: "Total requests: 264; Current requests/sec: 0.1; Current
traffic: 204 B/sec"
  CGroup: /system.slice/httpd.service
  ├─4359 /usr/sbin/httpd -DFOREGROUND
  ├─4360 /usr/sbin/httpd -DFOREGROUND
  ├─4362 /usr/sbin/httpd -DFOREGROUND
  ├─5100 /usr/sbin/httpd -DFOREGROUND
  ├─5386 /usr/sbin/httpd -DFOREGROUND
  ├─5415 /usr/sbin/httpd -DFOREGROUND
  └─5416 /usr/sbin/httpd -DFOREGROUND

3) Since the httpd is pointing to the path :
/usr/lib/systemd/system/httpd.service

vi /usr/lib/systemd/system/httpd.service

[Unit]
Description=The Apache HTTP Server
After=network.target remote-fs.target nss-lookup.target
Documentation=man:httpd(8)
Documentation=man:apachectl(8)

[Service]
Type=notify
EnvironmentFile=/etc/sysconfig/httpd
ExecStart=/usr/sbin/httpd $OPTIONS -DFOREGROUND
ExecReload=/usr/sbin/httpd $OPTIONS -k graceful
ExecStop=/bin/kill -WINCH ${MAINPID}
# We want systemd to give httpd some time to finish gracefully, but
still
want
# it to kill httpd after TimeoutStopSec if something went wrong during
the
# graceful stop. Normally, Systemd sends SIGTERM signal right after the
# ExecStop, which would kill httpd. We are sending useless SIGCONT here
to
give
# httpd time to finish.
KillSignal=SIGCONT
PrivateTmp=true

[Install]
WantedBy=multi-user.target


4) As per the above command I found the env file is available
'/etc/sysconfig/httpd'

vi /etc/sysconfig/httpd

#
# This file can be used to set additional environment variables for
# the httpd process, or pass additional options to the httpd
# executable.
#
# Note: With previous versions of httpd, the MPM could be changed by
# editing an "HTTPD" variable here.  With the current version, that
# variable is now ignored.  The MPM is a loadable module, and the
# choice of MPM can be changed by editing the configuration file
/etc/httpd/conf.modules.d/00-mpm.conf
#

#
# To pass additional options (for instance, -D definitions) to the
# httpd binary at startup, set OPTIONS here.
#
#OPTIONS=

#
# This setting ensures the httpd process is started in the "C" locale
# by default.  (Some modules will not behave correctly if
# case-sensitive string comparisons are performed in a different
# locale.)
#
LANG=C


5) As per the above command, I found that the conf fileis available in
the
path : /etc/httpd/conf.modules.d/00-mpm.conf

vi /etc/httpd/conf.modules.d/00-mpm.conf

# Select the MPM module which should be used

Re: [ovirt-users] Tunable parameters in ovirt engine

2018-03-08 Thread Juan Hernández
But other than those SSL error messages, are the connections really 
failing? Can you share the results reported by "ab"?


On 03/08/2018 12:16 PM, Hari Prasanth Loganathan wrote:

No Juan, It is not working with any benchmark / application tool. It fails
with the same error SSL handshake failed (5).

Could you let me know the configuration of Apache web server is correct?

Thanks,
Hari

On Thu, Mar 8, 2018 at 1:08 AM, Juan Hernández <jhern...@redhat.com> wrote:


If you are still having problems I am inclined to think that it is a
client issue. For example, I'd try to remove the "-k" option from the "ab"
command. If you use keep alive the server may decide anyhow to close the
connection after certain number of requests, even if the client asks to
keep it alive. Some clients don't handle that perfectly, "ab" may have that
problem. If that makes the SSL error messages disappear then I think you
can safely ignore them, and restore the "-k" option, if you want.

On 03/07/2018 07:30 PM, Hari Prasanth Loganathan wrote:


Thanks Juan for your response. Appreciate it.
But for some reason still, I am facing the same SSL handshake failed (5).
Could you please check this configuration and let me know the issue in my
ovirt engine environment.

*Configuration of Apache server:*


1) httpd version,

# httpd -v
Server version: Apache/2.4.6 (CentOS)
Server built:   Oct 19 2017 20:39:16

2) I checked the status using the following command,

# systemctl status httpd -l
● httpd.service - The Apache HTTP Server
 Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled;
vendor
preset: disabled)
 Active: active (running) since Wed 2018-03-07 23:46:32 IST; 1min 55s
ago
   Docs: man:httpd(8)
 man:apachectl(8)
Process: 4351 ExecStop=/bin/kill -WINCH ${MAINPID} (code=exited,
status=0/SUCCESS)
   Main PID: 4359 (httpd)
 Status: "Total requests: 264; Current requests/sec: 0.1; Current
traffic: 204 B/sec"
 CGroup: /system.slice/httpd.service
 ├─4359 /usr/sbin/httpd -DFOREGROUND
 ├─4360 /usr/sbin/httpd -DFOREGROUND
 ├─4362 /usr/sbin/httpd -DFOREGROUND
 ├─5100 /usr/sbin/httpd -DFOREGROUND
 ├─5386 /usr/sbin/httpd -DFOREGROUND
 ├─5415 /usr/sbin/httpd -DFOREGROUND
 └─5416 /usr/sbin/httpd -DFOREGROUND

3) Since the httpd is pointing to the path :
/usr/lib/systemd/system/httpd.service

vi /usr/lib/systemd/system/httpd.service

[Unit]
Description=The Apache HTTP Server
After=network.target remote-fs.target nss-lookup.target
Documentation=man:httpd(8)
Documentation=man:apachectl(8)

[Service]
Type=notify
EnvironmentFile=/etc/sysconfig/httpd
ExecStart=/usr/sbin/httpd $OPTIONS -DFOREGROUND
ExecReload=/usr/sbin/httpd $OPTIONS -k graceful
ExecStop=/bin/kill -WINCH ${MAINPID}
# We want systemd to give httpd some time to finish gracefully, but still
want
# it to kill httpd after TimeoutStopSec if something went wrong during the
# graceful stop. Normally, Systemd sends SIGTERM signal right after the
# ExecStop, which would kill httpd. We are sending useless SIGCONT here to
give
# httpd time to finish.
KillSignal=SIGCONT
PrivateTmp=true

[Install]
WantedBy=multi-user.target


4) As per the above command I found the env file is available
'/etc/sysconfig/httpd'

vi /etc/sysconfig/httpd

#
# This file can be used to set additional environment variables for
# the httpd process, or pass additional options to the httpd
# executable.
#
# Note: With previous versions of httpd, the MPM could be changed by
# editing an "HTTPD" variable here.  With the current version, that
# variable is now ignored.  The MPM is a loadable module, and the
# choice of MPM can be changed by editing the configuration file
/etc/httpd/conf.modules.d/00-mpm.conf
#

#
# To pass additional options (for instance, -D definitions) to the
# httpd binary at startup, set OPTIONS here.
#
#OPTIONS=

#
# This setting ensures the httpd process is started in the "C" locale
# by default.  (Some modules will not behave correctly if
# case-sensitive string comparisons are performed in a different
# locale.)
#
LANG=C


5) As per the above command, I found that the conf fileis available in the
path : /etc/httpd/conf.modules.d/00-mpm.conf

vi /etc/httpd/conf.modules.d/00-mpm.conf

# Select the MPM module which should be used by uncommenting exactly
# one of the following LoadModule lines:

# prefork MPM: Implements a non-threaded, pre-forking web server
# See: http://httpd.apache.org/docs/2.4/mod/prefork.html
#LoadModule mpm_prefork_module modules/mod_mpm_prefork.so

# worker MPM: Multi-Processing Module implementing a hybrid
# multi-threaded multi-process web server
# See: http://httpd.apache.org/docs/2.4/mod/worker.html
#
LoadModule mpm_worker_module modules/mod_mpm_worker.so

# event MPM: A variant of the worker MPM with the goal of consuming
# threads only for connections with 

Re: [ovirt-users] Tunable parameters in ovirt engine

2018-03-07 Thread Juan Hernández
It means that with the default configuration the Apache web server can't 
serve more than 256 concurrent connections. This applies to any 
application that uses Apache as the web frontend, not just to oVirt. If 
you want to change that you have to change the MaxRequestWorkers and 
ServerLimit parameters, as explained here:


  https://httpd.apache.org/docs/2.4/mod/mpm_common.html#maxrequestworkers

So, go to your oVirt engine machine and create a 
/etc/httpd/conf.d/my.conf file with this content:


  MaxRequestWorkers 1000
  ServerLimit 1000

Then restart the Apache server:

  # systemctl restart httpd

Then your web server should be able to handle 1000 concurrent requests, 
and you will probably start to find other limits, like the amount of 
memory and CPU that those 1000 Apache child processes will consume, the 
number of threads in the JBoss application server, the number of 
connections to the database, etc.


Let me insist a bit that if you base your benchmark solely on the number 
of concurrent requests or connections that the server can handle you may 
end up with meaningless results, as a real world application can/should 
use the server much better than that.


On 03/07/2018 04:33 PM, Hari Prasanth Loganathan wrote:

With the default configuration of the web server it is impossible to handle
more than 256 *connections* simultaneously. I guess that "ab" is opening a
connection for each concurrent request, so when you reach request 257 the
web server will just reject the connection, there is nothing that the JBoss
can do about it; you have to increase the number of connections supported
by the web server.

*So Does it mean that oVirt cannot serve more than 257 request? *
My question is, If its possible How to scale this and what is the
configuration we need to change?

Also, we are taking a benchmark in using oVirt, So I need to find the
maximum possible oVirt request. So please let me know the configuration
tuning for oVirt to achieve maximum concurrent request.

Thanks,
Hari

On Wed, Mar 7, 2018 at 7:25 PM, Juan Hernández <jhern...@redhat.com> wrote:


With the default configuration of the web server it is impossible to
handle more than 256 *connections* simultaneously. I guess that "ab" is
opening a connection for each concurrent request, so when you reach request
257 the web server will just reject the connection, there is nothing that
the JBoss can do about it; you have to increase the number of connections
supported by the web server.

Or else you may want to re-consider why you want to use 1000 simultaneous
connections. It may be OK for a performance test, but there are better ways
to squeeze performance. For example, you could consider using HTTP
pipelining, which is much more friendly for the server than so many
connections. This is what we use when we need to send a large number of
requests from other systems. There are examples of how to do that with the
Python and Ruby SDKs here:

   Python:

https://github.com/oVirt/ovirt-engine-sdk/blob/master/sdk/
examples/asynchronous_inventory.py

   Ruby:

https://github.com/oVirt/ovirt-engine-sdk-ruby/blob/master/
sdk/examples/asynchronous_inventory.rb


On 03/07/2018 02:43 PM, Hari Prasanth Loganathan wrote:


Hi Juan,

Thanks for the response.

I agree web server can handle only limited number of concurrent requests.
But Why it is failing with SSL handshake failure for few requests, Can't
the JBOSS wait and serve the request? We can spare the delay but not with
the request fails. So Is there a configuration in oVirt which can be tuned
to achieve this?

Thanks,
Hari

On Wed, Mar 7, 2018 at 7:05 PM, Juan Hernández <jhern...@redhat.com>
wrote:

The first thing you will need to change for such a test is the number of

simultaneous connections accepted by the Apache web server: by default
the
max is 256. See the Apache documentation here:

https://httpd.apache.org/docs/2.4/mod/mpm_common.html#m
axrequestworkers

In addition I also suggest that you consider using the "worker"
multi-processing module instead of the "prefork", as it usually works
better when talking to a Java application server, because it re-uses
connections better.

On 03/07/2018 02:20 PM, Hari Prasanth Loganathan wrote:

Hi Team,


*Description of problem:*

I am trying to achieve 1000 concurrent request to oVirt. What are the
tunable parameters to achieve this?

I tried to perform the benchmarking for ovirt engine using Apache
benchmark
using the same SSO token.

ab -n 1000 -c 500 -k -H "accept: application/json" -H "Authorization:
Bearer SSOTOKEN" https://172.30.56.70/ovirt-engine/
<https://172.30.56.70/ovirt-engine/api/vms/5440271b-afb3-48b
b-9ff1-076fc07ebf50/statistics>

When the number of concurrent request is 500, we are getting more than
100
failures with the following error,

SSL read failed (1) - closing connection
139620982339352:error:

NOTE: It is scaling for concurrent request be

Re: [ovirt-users] Tunable parameters in ovirt engine

2018-03-07 Thread Juan Hernández
With the default configuration of the web server it is impossible to 
handle more than 256 *connections* simultaneously. I guess that "ab" is 
opening a connection for each concurrent request, so when you reach 
request 257 the web server will just reject the connection, there is 
nothing that the JBoss can do about it; you have to increase the number 
of connections supported by the web server.


Or else you may want to re-consider why you want to use 1000 
simultaneous connections. It may be OK for a performance test, but there 
are better ways to squeeze performance. For example, you could consider 
using HTTP pipelining, which is much more friendly for the server than 
so many connections. This is what we use when we need to send a large 
number of requests from other systems. There are examples of how to do 
that with the Python and Ruby SDKs here:


  Python:

https://github.com/oVirt/ovirt-engine-sdk/blob/master/sdk/examples/asynchronous_inventory.py

  Ruby:

https://github.com/oVirt/ovirt-engine-sdk-ruby/blob/master/sdk/examples/asynchronous_inventory.rb

On 03/07/2018 02:43 PM, Hari Prasanth Loganathan wrote:

Hi Juan,

Thanks for the response.

I agree web server can handle only limited number of concurrent requests.
But Why it is failing with SSL handshake failure for few requests, Can't
the JBOSS wait and serve the request? We can spare the delay but not with
the request fails. So Is there a configuration in oVirt which can be tuned
to achieve this?

Thanks,
Hari

On Wed, Mar 7, 2018 at 7:05 PM, Juan Hernández <jhern...@redhat.com> wrote:


The first thing you will need to change for such a test is the number of
simultaneous connections accepted by the Apache web server: by default the
max is 256. See the Apache documentation here:

   https://httpd.apache.org/docs/2.4/mod/mpm_common.html#maxrequestworkers

In addition I also suggest that you consider using the "worker"
multi-processing module instead of the "prefork", as it usually works
better when talking to a Java application server, because it re-uses
connections better.

On 03/07/2018 02:20 PM, Hari Prasanth Loganathan wrote:


Hi Team,

*Description of problem:*

I am trying to achieve 1000 concurrent request to oVirt. What are the
tunable parameters to achieve this?

I tried to perform the benchmarking for ovirt engine using Apache
benchmark
using the same SSO token.

ab -n 1000 -c 500 -k -H "accept: application/json" -H "Authorization:
Bearer SSOTOKEN" https://172.30.56.70/ovirt-engine/
<https://172.30.56.70/ovirt-engine/api/vms/5440271b-afb3-48b
b-9ff1-076fc07ebf50/statistics>

When the number of concurrent request is 500, we are getting more than 100
failures with the following error,

SSL read failed (1) - closing connection
139620982339352:error:

NOTE: It is scaling for concurrent request below 500.

I used the profiler to get the memory and CPU and it seems very less,

PID USER  PR  NIVIRTRESSHR S  %CPU %MEM TIME+
COMMAND
30413 ovirt 20   0 4226664 882396   6776 S 126.0 23.0  27:48.53 java

Configuration of the machine in which Ovirt is deployed :

RAM - 4GB,
Hard disk - 100GB,
core processor - 2,
OS - Cent7.x.

In which 2GB is allocated to oVirt.


Version-Release number of selected component (if applicable):

4.2.2


How reproducible:

If the number of concurrent requests are above 500, we are easily facing
this issue.


*Actual results:*

SSL read failed (1) - closing connection
139620982339352:error:

*Expected results:*

Request success.


Thanks,
Hari



___
Users mailing list
Users@ovirt.org
http://lists.ovirt.org/mailman/listinfo/users








___
Users mailing list
Users@ovirt.org
http://lists.ovirt.org/mailman/listinfo/users


Re: [ovirt-users] Tunable parameters in ovirt engine

2018-03-07 Thread Juan Hernández
The first thing you will need to change for such a test is the number of 
simultaneous connections accepted by the Apache web server: by default 
the max is 256. See the Apache documentation here:


  https://httpd.apache.org/docs/2.4/mod/mpm_common.html#maxrequestworkers

In addition I also suggest that you consider using the "worker" 
multi-processing module instead of the "prefork", as it usually works 
better when talking to a Java application server, because it re-uses 
connections better.


On 03/07/2018 02:20 PM, Hari Prasanth Loganathan wrote:

Hi Team,

*Description of problem:*

I am trying to achieve 1000 concurrent request to oVirt. What are the
tunable parameters to achieve this?

I tried to perform the benchmarking for ovirt engine using Apache benchmark
using the same SSO token.

ab -n 1000 -c 500 -k -H "accept: application/json" -H "Authorization:
Bearer SSOTOKEN" https://172.30.56.70/ovirt-engine/


When the number of concurrent request is 500, we are getting more than 100
failures with the following error,

SSL read failed (1) - closing connection
139620982339352:error:

NOTE: It is scaling for concurrent request below 500.

I used the profiler to get the memory and CPU and it seems very less,

   PID USER  PR  NIVIRTRESSHR S  %CPU %MEM TIME+
COMMAND
30413 ovirt 20   0 4226664 882396   6776 S 126.0 23.0  27:48.53 java

Configuration of the machine in which Ovirt is deployed :

RAM - 4GB,
Hard disk - 100GB,
core processor - 2,
OS - Cent7.x.

In which 2GB is allocated to oVirt.


Version-Release number of selected component (if applicable):

4.2.2


How reproducible:

If the number of concurrent requests are above 500, we are easily facing
this issue.


*Actual results:*

SSL read failed (1) - closing connection
139620982339352:error:

*Expected results:*

Request success.


Thanks,
Hari



___
Users mailing list
Users@ovirt.org
http://lists.ovirt.org/mailman/listinfo/users



___
Users mailing list
Users@ovirt.org
http://lists.ovirt.org/mailman/listinfo/users


Re: [ovirt-users] oVirt and Foreman

2017-08-01 Thread Juan Hernández

On 07/28/2017 06:03 PM, Davide Ferrari wrote:



On 28/07/17 17:46, Juan Hernández wrote:


The oVirt access log indeed shows that three disks are added to the 
virtual machine. May it be that Foreman thinks that it has to 
explicitly add a boot disk? Ohad, Ivan, any idea?




I've explicitly added the template id to the hammer command line and 
still adds 3 disks but at least now two of them respect the size I'm 
passing through Hammer. But it still sets a random disk as the bootable 
one and I cannot find a way to force to use the disk already present in 
the oVirt template as the bootable one
Is there a way in oVirt to log the JSONs passed in the various POST 
requests?




There is no such mechanism available by default You can get some more 
information about the requests and responses using the WildFly request 
dumping filter, but it won't give you the request or response bodies. If 
you want to do that first you need to go to the oVirt engine machine and 
start the "jboss-cli.sh" tool:


  # /usr/share/ovirt-engine-wildfly/bin/jboss-cli.sh \
  --controller=localhost:8706 \
  --user=admin@internal \
  --connect

That will as for the password of the "admin@internal" user, and then it 
should display you a prompt like this:


  [standalone@localhost:8706 /]

In that prompt you can type any WildFly management command. For more 
information see here:


  https://docs.jboss.org/author/display/WFLY/Command+Line+Interface

In this particular case you can first add the request dumping filter to 
the configuration, typing the following command:


  /subsystem=undertow/configuration=filter/custom-filter=myfilter:\
 add(class-name=io.undertow.server.handlers.RequestDumpingHandler,\
  module=io.undertow.core)

Then you can enable that filter for the /ovirt-engine/api/* URL:


/subsystem=undertow/server=default-server/host=default-host/filter-ref=myfilter:add(predicate="regex['/ovirt-engine/api.*']")

Note again that this won't give you the request and response bodies, so 
it may not be worth.


Another thing you may want to try, in the Foreman side, is to modify the 
"rbovirt" gem so it writes the request bodies to some place. For 
example, you can locate the "rbovirt.rb" file in your Foreman 
installation, and then, after this line:


  https://github.com/abenari/rbovirt/blob/v0.1.3/lib/rbovirt.rb#L131

Add something that writes the request body to a file, for example:

  open('/tmp/mylog', 'a') { |f| f.write(body) }

Then you will probably need to restart Foreman.

Remember to restore the "rbovirt.rb" file when you finish.



More over, looking at 
/ovirt-engine/api/vms/47f5035a-696c-4578-ace9-b23d865c6aa7/disks it 
throws a 404, the endpoint seems to be 
/ovirt-engine/api/vms/47f5035a-696c-4578-ace9-b23d865c6aa7/diskattachments 
while 
/ovirt-engine/api/vms/47f5035a-696c-4578-ace9-b23d865c6aa7/disks 
seems to work only with API v3. Maybe I should change the base URL 
for the ovirt's API in foreman config, shouldn't I?




I think you don't need to change anything there. Foreman uses 
'rbovirt', and 'rbovirt' explicitly requests version 3 of the API 
using the 'Version: 3' header. 


Well, I've added it anyway and it didn't break anything :)



___
Users mailing list
Users@ovirt.org
http://lists.ovirt.org/mailman/listinfo/users


Re: [ovirt-users] oVirt and Foreman

2017-07-28 Thread Juan Hernández

On 07/28/2017 04:53 PM, Davide Ferrari wrote:



On 28/07/17 16:14, Juan Hernández wrote:
Ah, I see, in your command you are listing Gluster volumes, not 
storage domains. They are different kinds of objects inside oVirt, and 
thus they have different identifiers. That is completely normal. If 
you want to get the identifiers of the storage domains use "list 
storagedomains".




Oh, got it. Thanks for the tip!

Anyway, I've replaced the storage domain UUID with the one that works 
with the REST API and something improved: now I don't get the 404 
from ovirt and the machine is not deleted BUT:  I've added 2 disks 
(20GB and 30GB) plus the base template 8Gb disk, and I get a VM with 
four (4) 8GB disks, and the bootable one is a random disk


I've attached the engine.log with the (I hope) relevant messages



Are you adding those disks and template using the Foreman CLI? Can you 
share the commands that you are using?




Yes, I'm using Hammer CLI

hammer host create --architecture-id=1 --domain billy.preprod 
--operatingsystem-id=7 --hostgroup-title Billy/Preprod --name foobar03 
--partition-table-id=192 --provision-method image --root-password 
billy12345 --compute-resource 'LeaseWeb VMs prod' --image CentOS_7.3 
--compute-attributes 
cluster=0002-0002-0002-0002-0345,cores=2,memory=4294967296,start=1 
--volume 
'"size_gb=20,storage_domain=ba2bd397-9222-424d-aecc-eb652c0169d9,bootable=0"' 
--volume 
'"size_gb=30,storage_domain=ba2bd397-9222-424d-aecc-eb652c0169d9,bootable=0"' 




Also, can you share again the relevant part of the 
/var/log/ovirt-engine/ssl_access_log file? There we can see what 
requests are actually sent to the oVirt engine. 


These are the requests arriving from Foreman:
192.168.10.158 - - [28/Jul/2017:14:19:42 +] "GET 
/ovirt-engine/api/vms/24831007-97ad-4f6d-9009-e6fb68a585f9 HTTP/1.1" 200 
2865
192.168.10.158 - - [28/Jul/2017:14:26:19 +] "GET 
/ovirt-engine/api/datacenters?search= HTTP/1.1" 200 408
192.168.10.158 - - [28/Jul/2017:14:26:19 +] "GET 
/ovirt-engine/api/operatingsystems HTTP/1.1" 200 2943
192.168.10.158 - - [28/Jul/2017:14:26:20 +] "GET 
/ovirt-engine/api/datacenters?search= HTTP/1.1" 200 408
192.168.10.158 - - [28/Jul/2017:14:26:20 +] "GET 
/ovirt-engine/api/operatingsystems HTTP/1.1" 200 2943
192.168.10.158 - - [28/Jul/2017:14:26:20 +] "GET 
/ovirt-engine/api/datacenters?search= HTTP/1.1" 200 408
192.168.10.158 - - [28/Jul/2017:14:26:20 +] "GET 
/ovirt-engine/api/clusters/ HTTP/1.1" 200 1091
192.168.10.158 - - [28/Jul/2017:14:26:20 +] "POST 
/ovirt-engine/api/vms HTTP/1.1" 202 1612
192.168.10.158 - - [28/Jul/2017:14:26:22 +] "GET 
/ovirt-engine/api/vms/47f5035a-696c-4578-ace9-b23d865c6aa7 HTTP/1.1" 200 
2256
192.168.10.158 - - [28/Jul/2017:14:26:22 +] "GET 
/ovirt-engine/api/vms/47f5035a-696c-4578-ace9-b23d865c6aa7/nics 
HTTP/1.1" 200 409
192.168.10.158 - - [28/Jul/2017:14:26:22 +] "GET 
/ovirt-engine/api/vms/47f5035a-696c-4578-ace9-b23d865c6aa7 HTTP/1.1" 200 
2256
192.168.10.158 - - [28/Jul/2017:14:26:23 +] "GET 
/ovirt-engine/api/vms/47f5035a-696c-4578-ace9-b23d865c6aa7 HTTP/1.1" 200 
2256
192.168.10.158 - - [28/Jul/2017:14:26:26 +] "GET 
/ovirt-engine/api/vms/47f5035a-696c-4578-ace9-b23d865c6aa7 HTTP/1.1" 200 
2256
192.168.10.158 - - [28/Jul/2017:14:26:30 +] "GET 
/ovirt-engine/api/vms/47f5035a-696c-4578-ace9-b23d865c6aa7 HTTP/1.1" 200 
2252
192.168.10.158 - - [28/Jul/2017:14:26:30 +] "DELETE 
/ovirt-engine/api/vms/47f5035a-696c-4578-ace9-b23d865c6aa7/nics/bf0dabd2-796b-4b07-bd69-db3915409939 
HTTP/1.1" 200 119
192.168.10.158 - - [28/Jul/2017:14:26:30 +] "POST 
/ovirt-engine/api/vms/47f5035a-696c-4578-ace9-b23d865c6aa7/nics 
HTTP/1.1" 201 430
192.168.10.158 - - [28/Jul/2017:14:26:31 +] "GET 
/ovirt-engine/api/vms/47f5035a-696c-4578-ace9-b23d865c6aa7/nics 
HTTP/1.1" 200 442
192.168.10.158 - - [28/Jul/2017:14:26:31 +] "GET /ovirt-engine/api/ 
HTTP/1.1" 200 873
192.168.10.158 - - [28/Jul/2017:14:26:31 +] "GET 
/ovirt-engine/api/datacenters/0001-0001-0001-0001-03e3 
HTTP/1.1" 200 396
192.168.10.158 - - [28/Jul/2017:14:26:31 +] "POST 
/ovirt-engine/api/vms/47f5035a-696c-4578-ace9-b23d865c6aa7/disks 
HTTP/1.1" 201 674
192.168.10.158 - - [28/Jul/2017:14:26:32 +] "POST 
/ovirt-engine/api/vms/47f5035a-696c-4578-ace9-b23d865c6aa7/disks 
HTTP/1.1" 201 676
192.168.10.158 - - [28/Jul/2017:14:26:33 +] "POST 
/ovirt-engine/api/vms/47f5035a-696c-4578-ace9-b23d865c6aa7/disks 
HTTP/1.1" 201 677
192.168.10.158 - - [28/Jul/2017:14:26:33 +] "GET 
/ovirt-engine/api/vms/47f5035a-696c-4578-ace9-b23d865c6aa7/disks 
HTTP/1.1" 200 1136
192.168.10.158 - - [28/Jul/2017:14:26:34 +] "GET 
/ovirt-engine/api/vms/

Re: [ovirt-users] oVirt and Foreman

2017-07-28 Thread Juan Hernández

On 07/28/2017 01:27 PM, Davide Ferrari wrote:



On 28/07/17 10:50, Juan Hernández wrote:
[oVirt shell (connected)]# list glustervolumes --cluster-identifier 
0002-0002-0002-0002-0345


id : 23f8f1ae-a3ac-47bf-8223-5b5f7c29e508
name   : data_ssd

id : 6be35972-4720-4d34-b2b0-26ffc294f8a3
name   : engine

id : 66f33b1e-7bc8-44cf-9cca-9041b0e0dd15
name   : export

id : cc2c9765-6a3d-4281-8af8-c3526a81cfab
name   : iso

So there is something wrong with the "data_ssd" storage domain, 
apparently, as the identifier that can't be found corresponds to that 
storage domain. Can you try to retrieve that storage domain? Just use 
your browser to get the following URL:



https://yourovirt/ovirt-engine/api/storagedomains/23f8f1ae-a3ac-47bf-8223-5b5f7c29e508 



Also this, in case the problem is related to version 3 of the API:


https://yourovirt/ovirt-engine/api/v3/storagedomains/23f8f1ae-a3ac-47bf-8223-5b5f7c29e508 



Do they work?



Nope, 404 both v4 and v3 API, but if I go to the storagedomains/ root, I 
get completely different UUIDs listed there. For example, in the case of 
the "data_ssd" domain, the UUID is 7a28ea1a-df7e-4205-bb96-45ff2817f175


Why is the ovirt console showing a completely different UUID?



Ah, I see, in your command you are listing Gluster volumes, not storage 
domains. They are different kinds of objects inside oVirt, and thus they 
have different identifiers. That is completely normal. If you want to 
get the identifiers of the storage domains use "list storagedomains".


Anyway, I've replaced the storage domain UUID with the one that works 
with the REST API and something improved: now I don't get the 404 from 
ovirt and the machine is not deleted BUT:  I've added 2 disks (20GB and 
30GB) plus the base template 8Gb disk, and I get a VM with four (4) 8GB 
disks, and the bootable one is a random disk


I've attached the engine.log with the (I hope) relevant messages



Are you adding those disks and template using the Foreman CLI? Can you 
share the commands that you are using?


Also, can you share again the relevant part of the 
/var/log/ovirt-engine/ssl_access_log file? There we can see what 
requests are actually sent to the oVirt engine.


___
Users mailing list
Users@ovirt.org
http://lists.ovirt.org/mailman/listinfo/users


Re: [ovirt-users] oVirt and Foreman

2017-07-28 Thread Juan Hernández

On 07/28/2017 09:34 AM, Davide Ferrari wrote:



On 27/07/17 11:17, Juan Hernández wrote:


Looks like the oVirt engine is rejecting the request to add the disk 
because some of the related entities doesn't exist. This is the 
relevant message in the engine log:


  2017-07-25 08:28:03,063Z ERROR 
[org.ovirt.engine.api.restapi.resource.AbstractBackendResource] 
(default task-51) [] Operation Failed: Entity not found: 
23f8f1ae-a3ac-47bf-8223-5b5f7c29e508


Would be nice if you can check the /var/log/httpd/ssl_access_log in 
the oVirt engine machine. There should be a line there with the 404 
HTTP status, something like this:


  POST /ovirt-engine/api/vms//disks 404

What is the exact content of that line? Is the VM id the one that 
appears in the above message.


Bingo, there's definitely a 404 error log at the same hour:

192.168.10.158 - - [25/Jul/2017:08:28:02 +] "POST 
/ovirt-engine/api/vms/896098c2-5895-42c3-a419-0c3a43b5ff8b/disks 
HTTP/1.1" 404 169


But the ID is different



Also, can you check what are the identifiers of the relevant data 
center and storage domains?




DC and storage UUID "should" be correct, I've copied them from the oVirt 
CLI output into my hammer command
These are the storage IDs for the datacenter where I'm trying to create 
the VM in:


[oVirt shell (connected)]# list glustervolumes --cluster-identifier 
0002-0002-0002-0002-0345


id : 23f8f1ae-a3ac-47bf-8223-5b5f7c29e508
name   : data_ssd

id : 6be35972-4720-4d34-b2b0-26ffc294f8a3
name   : engine

id : 66f33b1e-7bc8-44cf-9cca-9041b0e0dd15
name   : export

id : cc2c9765-6a3d-4281-8af8-c3526a81cfab
name   : iso

and this is the command line I'm using

hammer host create --architecture-id=1 --domain billy.preprod 
--operatingsystem-id=7 --hostgroup-title Billy/Preprod --name foo01 
--partition-table-id=192 --provision-method image --root-password 
billy12345 --compute-resource 'LeaseWeb VMs prod' --image CentOS_7.3 
--compute-attributes 
cluster=0002-0002-0002-0002-0345,cores=2,memory=4294967296,start=1 
--volume 
'"size_gb=20,storage_domain=23f8f1ae-a3ac-47bf-8223-5b5f7c29e508,bootable=0"' 
--volume 
'"size_gb=30,storage_domain=23f8f1ae-a3ac-47bf-8223-5b5f7c29e508,bootable=0"' 



So there is something wrong with the "data_ssd" storage domain, 
apparently, as the identifier that can't be found corresponds to that 
storage domain. Can you try to retrieve that storage domain? Just use 
your browser to get the following URL:



https://yourovirt/ovirt-engine/api/storagedomains/23f8f1ae-a3ac-47bf-8223-5b5f7c29e508

Also this, in case the problem is related to version 3 of the API:


https://yourovirt/ovirt-engine/api/v3/storagedomains/23f8f1ae-a3ac-47bf-8223-5b5f7c29e508

Do they work?




There should also be additional details in the 
/var/log/ovirt-engine/server.log file. Please check it.


Nope, no log with the same timestamp in server.log :/

Thanks for your kind help!



___
Users mailing list
Users@ovirt.org
http://lists.ovirt.org/mailman/listinfo/users


Re: [ovirt-users] oVirt and Foreman

2017-07-27 Thread Juan Hernández

On 07/27/2017 09:46 AM, Davide Ferrari wrote:

On 25/07/17 10:59, Davide Ferrari wrote:


Hello

I've attached logs from:

- hammer cli (debug) with the command line I've used

- foreman logs

- ovirt engine logs (server.log)



Any idea about what might be happening?



Looks like the oVirt engine is rejecting the request to add the disk 
because some of the related entities doesn't exist. This is the relevant 
message in the engine log:


  2017-07-25 08:28:03,063Z ERROR 
[org.ovirt.engine.api.restapi.resource.AbstractBackendResource] (default 
task-51) [] Operation Failed: Entity not found: 
23f8f1ae-a3ac-47bf-8223-5b5f7c29e508


Would be nice if you can check the /var/log/httpd/ssl_access_log in the 
oVirt engine machine. There should be a line there with the 404 HTTP 
status, something like this:


  POST /ovirt-engine/api/vms//disks 404

What is the exact content of that line? Is the VM id the one that 
appears in the above message.


Also, can you check what are the identifiers of the relevant data center 
and storage domains?


There should also be additional details in the 
/var/log/ovirt-engine/server.log file. Please check it.

___
Users mailing list
Users@ovirt.org
http://lists.ovirt.org/mailman/listinfo/users


Re: [ovirt-users] SQL : last time halted?

2017-07-06 Thread Juan Hernández

On 07/06/2017 02:07 PM, Nicolas Ecarnot wrote:

[For the record]

Juan,

Thanks to your hint, I eventually found it more convenient for me to use 
a SQL query to find out which VM was unsed for months :


SELECT
   vm_static.vm_name,
   vm_dynamic.status,
   vm_dynamic.vm_ip,
   vm_dynamic.vm_host,
   vm_dynamic.last_start_time,
   vm_dynamic.vm_guid,
   vm_dynamic.last_stop_time
FROM
   public.vm_dynamic,
   public.vm_static
WHERE
   vm_dynamic.vm_guid = vm_static.vm_guid AND
   vm_dynamic.status = 0
ORDER BY
   vm_dynamic.last_stop_time ASC;

Thank you.



That is nice. Just keep in mind that the database schema isn't kept 
backwards compatible. A minor change in the engine can make your query 
fail or return incorrect results.

___
Users mailing list
Users@ovirt.org
http://lists.ovirt.org/mailman/listinfo/users


Re: [ovirt-users] Unable to rename disks via REST API

2017-06-28 Thread Juan Hernández
On 06/28/2017 01:34 PM, Bruno Rodriguez wrote:
> Shit, I got it. Sorry
> 
> The problem is that I was accessing to the v4 disk-attachment id and I
> was getting everything quite messed up. I was doing all of this while
> creating a machine, so I was trying to rename the disk at the same time
> it's being created.
> 
> I'll delete all the "if ($ovirt_major == 3)" I have in my code. If I
> have any problem I'll let you know.
> 
> Thank you 
> 

If what you want to do is set the name of the disk for a VM that you are
creating then you can just set it when adding the disk:

  POST /ovirt-engine/api/vms/123/diskattachments

  

  yourfavoritename
  ...

...
  

That way you don't need to modify it later.

Also, in general, try to wait till the objects are completely created
before trying to use or update them. For disks in particular, it is good
idea to repeatedly retrieve the disk till the 'status' is 'OK':


https://github.com/oVirt/ovirt-engine-sdk/blob/master/sdk/examples/add_vm_disk.py#L73-L80

(This is an example from the Python SDK, but you get the idea. There are
SDKs for Ruby and Java as well.)

Finally, if you get a 500 error then there is most probably a bug. The
API should never return that, even if you try to do something that
doesn't make sense it should respond with a reasonable error message. If
you keep getting that 500 error please share the details.

> On Wed, Jun 28, 2017 at 1:03 PM, Juan Hernández <jhern...@redhat.com
> <mailto:jhern...@redhat.com>> wrote:
> 
> On 06/28/2017 12:55 PM, Bruno Rodriguez wrote:
> > I'm sorry about bothering you again, but after trying it some times I'm
> > still getting a "500 Internal Server Error". I'm using a REST client
> > instead of CURL and I tried adding a "Version: 3" to headers and used
> > the URL with the v3 as well.
> >
> > I'm issuing a PUT of
> >
> > Alias_for_disk
> >
> > To the URL
> >
> > 
> https://myserver/ovirt-engine/api/v3/vms/62498f51-0203-48b9-83c8-4c6f3bdfe05c/disks/583ed952-46a8-4bc5-8a27-8660e4a24ea2
> 
> <https://myserver/ovirt-engine/api/v3/vms/62498f51-0203-48b9-83c8-4c6f3bdfe05c/disks/583ed952-46a8-4bc5-8a27-8660e4a24ea2>
> >
> > I mean, I can live without it but we are using oVirt as a "static
> > virtualization" environment and is quite useful for us being able to
> > recognize easily each disk by its server name. In case I have to wait
> > until the 4.2 API version to automatize this I'll do :(
> >
> 
> That should work. Can you please check if you get any useful message in
> /var/log/ovirt-engine/server.log or /var/log/ovirt-engine/engine.log?
> 
> >
> >
> > On Wed, Jun 28, 2017 at 11:18 AM, Bruno Rodriguez <br...@pic.es 
> <mailto:br...@pic.es>
> > <mailto:br...@pic.es <mailto:br...@pic.es>>> wrote:
> >
> > Thank you very much !!!
> >
> > I expected I was missing something like that. Thanks again!
> >
> > On Wed, Jun 28, 2017 at 11:12 AM, Juan Hernández
> > <jhern...@redhat.com <mailto:jhern...@redhat.com>
> <mailto:jhern...@redhat.com <mailto:jhern...@redhat.com>>> wrote:
> >
> > On 06/28/2017 10:43 AM, Bruno Rodriguez wrote:
> > > Thank you, Daniel
> > >
> > > I tried a PUT with the same XML body, I got a "405
> Method Not Allowed".
> > > It's quite strange, there must be someting I'm missing
> > >
> >
> > The operation to update a disk will be introduced in version 4
> > of the
> > API with version 4.2 of the engine. Meanwhile the way to
> update
> > the disk
> > is to use version 3 of the API and the disks
> sub-collection of the
> > virtual machine. That means that if you have a VM with id 123
> > and a disk
> > with id 456 you can send a request like this:
> >
> >   PUT /ovirt-engine/api/v3/vms/123/disks/456
> >
> > With a request body like this:
> >
> >   
> > newalias
> >   
> >
> > Note that you can use the above "v3" prefix in the URL or
> else the
> > "Version: 3" header. A complete example using curl:
> >
> > ---8<---
> > #!/bin/bash -

Re: [ovirt-users] Unable to rename disks via REST API

2017-06-28 Thread Juan Hernández
On 06/28/2017 12:55 PM, Bruno Rodriguez wrote:
> I'm sorry about bothering you again, but after trying it some times I'm
> still getting a "500 Internal Server Error". I'm using a REST client
> instead of CURL and I tried adding a "Version: 3" to headers and used
> the URL with the v3 as well.
> 
> I'm issuing a PUT of 
> 
> Alias_for_disk
> 
> To the URL
> 
> https://myserver/ovirt-engine/api/v3/vms/62498f51-0203-48b9-83c8-4c6f3bdfe05c/disks/583ed952-46a8-4bc5-8a27-8660e4a24ea2
> 
> I mean, I can live without it but we are using oVirt as a "static
> virtualization" environment and is quite useful for us being able to
> recognize easily each disk by its server name. In case I have to wait
> until the 4.2 API version to automatize this I'll do :(
> 

That should work. Can you please check if you get any useful message in
/var/log/ovirt-engine/server.log or /var/log/ovirt-engine/engine.log?

> 
> 
> On Wed, Jun 28, 2017 at 11:18 AM, Bruno Rodriguez <br...@pic.es
> <mailto:br...@pic.es>> wrote:
> 
> Thank you very much !!!
> 
>     I expected I was missing something like that. Thanks again!
> 
> On Wed, Jun 28, 2017 at 11:12 AM, Juan Hernández
> <jhern...@redhat.com <mailto:jhern...@redhat.com>> wrote:
> 
> On 06/28/2017 10:43 AM, Bruno Rodriguez wrote:
> > Thank you, Daniel
> >
> > I tried a PUT with the same XML body, I got a "405 Method Not 
> Allowed".
> > It's quite strange, there must be someting I'm missing
> >
> 
> The operation to update a disk will be introduced in version 4
> of the
> API with version 4.2 of the engine. Meanwhile the way to update
> the disk
> is to use version 3 of the API and the disks sub-collection of the
> virtual machine. That means that if you have a VM with id 123
> and a disk
> with id 456 you can send a request like this:
> 
>   PUT /ovirt-engine/api/v3/vms/123/disks/456
> 
> With a request body like this:
> 
>   
> newalias
>   
> 
> Note that you can use the above "v3" prefix in the URL or else the
> "Version: 3" header. A complete example using curl:
> 
> ---8<---
> #!/bin/bash -ex
> 
> url="https://.../ovirt-engine/api;
> user="admin@internal"
> password="..."
> vm_id="..."
> disk_id="..."
> 
> curl \
> --verbose \
> --cacert "ca.pem" \
> --header "Version: 3" \
> --header "Content-Type: application/xml" \
> --user "${user}:${password}" \
> --request PUT \
> --data "
> 
>   newalias
> 
> " \
> "${url}/vms/${vm_id}/disks/${disk_id}"
> --->8---
> 
> >
> > On Wed, Jun 28, 2017 at 10:07 AM, Daniel Erez <de...@redhat.com 
> <mailto:de...@redhat.com>
> > <mailto:de...@redhat.com <mailto:de...@redhat.com>>> wrote:
> >
> > Hi,
> >
> > Updating is done using the PUT method.
> > Please try that with the same XML body.
> >
> > Thanks,
> > Daniel
> >
> > On Wed, Jun 28, 2017 at 10:26 AM Bruno Rodriguez <br...@pic.es 
> <mailto:br...@pic.es>
> > <mailto:br...@pic.es <mailto:br...@pic.es>>> wrote:
> >
> > Hello everyone,
> >
> > I'm having some problems about renaming some disks (setting 
> a
> > different alias, name or description) for VMs disks created 
> from
> > a template. When I get this URL
> >
> > https://ovirt-manager/ovirt-engine/api/disks/0123
> <https://ovirt-manager/ovirt-engine/api/disks/0123>
> > <https://ovirt-manager/ovirt-engine/api/disks/0123
> <https://ovirt-manager/ovirt-engine/api/disks/0123>>
> >
> > I can see are the methods sparsify, export, move and copy. I
> > tried to POST the following XML to the previous URL with no
> > result (as expected, it won't work)
> >
> > 
> >   my_machine_Disk1
> > 
> &

Re: [ovirt-users] Unable to rename disks via REST API

2017-06-28 Thread Juan Hernández
On 06/28/2017 10:43 AM, Bruno Rodriguez wrote:
> Thank you, Daniel
> 
> I tried a PUT with the same XML body, I got a "405 Method Not Allowed".
> It's quite strange, there must be someting I'm missing
> 

The operation to update a disk will be introduced in version 4 of the
API with version 4.2 of the engine. Meanwhile the way to update the disk
is to use version 3 of the API and the disks sub-collection of the
virtual machine. That means that if you have a VM with id 123 and a disk
with id 456 you can send a request like this:

  PUT /ovirt-engine/api/v3/vms/123/disks/456

With a request body like this:

  
newalias
  

Note that you can use the above "v3" prefix in the URL or else the
"Version: 3" header. A complete example using curl:

---8<---
#!/bin/bash -ex

url="https://.../ovirt-engine/api;
user="admin@internal"
password="..."
vm_id="..."
disk_id="..."

curl \
--verbose \
--cacert "ca.pem" \
--header "Version: 3" \
--header "Content-Type: application/xml" \
--user "${user}:${password}" \
--request PUT \
--data "

  newalias

" \
"${url}/vms/${vm_id}/disks/${disk_id}"
--->8---

> 
> On Wed, Jun 28, 2017 at 10:07 AM, Daniel Erez  > wrote:
> 
> Hi,
> 
> Updating is done using the PUT method.
> Please try that with the same XML body.
> 
> Thanks,
> Daniel
> 
> On Wed, Jun 28, 2017 at 10:26 AM Bruno Rodriguez  > wrote:
> 
> Hello everyone,
> 
> I'm having some problems about renaming some disks (setting a
> different alias, name or description) for VMs disks created from
> a template. When I get this URL
> 
> https://ovirt-manager/ovirt-engine/api/disks/0123
> 
> 
> I can see are the methods sparsify, export, move and copy. I
> tried to POST the following XML to the previous URL with no
> result (as expected, it won't work)
> 
> 
>   my_machine_Disk1
> 
> 
> I'm quite sure I'm thinking about it in a wrong way (as usual).
> Any help would be welcome...
> 
> Thank you in advance
> 
> -- 
> Bruno Rodríguez Rodríguez
> 
> *Port d'Informació Científica (PIC)* 
> 
> ___
> Users mailing list
> Users@ovirt.org 
> http://lists.ovirt.org/mailman/listinfo/users
> 
> 
> 
> 
> 
> -- 
> Bruno Rodríguez Rodríguez
> 
> *Port d'Informació Científica (PIC)* 
> Campus UAB - Edificio D,
> C / Albareda, s / n 
> 08193-Bellaterra (Barcelona), España
> Telf. +34 93 170 27 30
> GPS  coordenadas:  41.500850 2.110628
> 
> "Si algo me ha enseñado el tetris, es que los errores se acumulan y los
> triunfos desaparecen"
> 
> 
> ___
> Users mailing list
> Users@ovirt.org
> http://lists.ovirt.org/mailman/listinfo/users
> 

___
Users mailing list
Users@ovirt.org
http://lists.ovirt.org/mailman/listinfo/users


Re: [ovirt-users] ovirt sdk and pipelining

2017-06-16 Thread Juan Hernández
On 06/16/2017 09:52 AM, Fabrice Bacchella wrote:
> I just read the blog entry about performance increate in for the python sdk 
> (https://www.ovirt.org/blog/2017/05/higher-performance-for-python-sdk/).
> 
> I'm quite sceptical about pipelining.
> 
> A few explanation about that can be found at:
> https://devcentral.f5.com/articles/http-pipelining-a-security-risk-without-real-performance-benefits
> https://stackoverflow.com/questions/14810890/what-are-the-disadvantages-of-using-http-pipelining
>

Did you test it? Can you share the results?

In our tests pipe-lining dramatically increases the performance in large
scale environments with high latency. In our tests with 4000 virtual
machines 1 disks and 150ms of latency retrieving the complete
inventory is reduced from approx 1 hour to approx 2 minutes.

Note that the usage of the HTTP protocol in this scenario is very
different from the typical usage when a browser retrieves a web page.

> It also talks about multiple connection, but don't use pycurl.CurlShare(). I 
> thing this might be very helpfull, as it allows to share cookies, see 
> https://curl.haxx.se/libcurl/c/CURLOPT_SHARE.html. 
>

The SDK uses the curl "multi" mechanism, which automatically shares the
DNS cache. In addition version 4 of the SDK does not use cookies. So
this shouldn't be relevant.
___
Users mailing list
Users@ovirt.org
http://lists.ovirt.org/mailman/listinfo/users


Re: [ovirt-users] Python-SDK4: Managing accents?

2017-06-13 Thread Juan Hernández
On 06/13/2017 01:58 PM, nico...@devels.es wrote:
> Currently all our scripts are python2-based, not sure if running them
> with Python3 would need a major change, but currently we're happy with
> Python2. I'm still not clear if this is a bug or an additional option
> should be supplied in order to make this work.
> 
> Thanks.
> 

It is a but. I think it was introduced recently. Please try to use
version 4.1.3 and check if it works correctly. Open a bug reporting the
results. We will probably need to do something like this to fix it:

  Fix parsing of multi-byte UTF-8 characters
  https://gerrit.ovirt.org/78112

> El 2017-06-12 14:48, Fabrice Bacchella escribió:
>> Did you try with python 3 ? UTF management changed a lot with this
>> version, it might works better in your case.
>>
>>> Le 12 juin 2017 à 12:33, nico...@devels.es a écrit :
>>>
>>> Hi,
>>>
>>> We're running Python SDK (ovirt-engine-sdk-python) ver 4.1.4 and
>>> we're having some issues getting values that contain accents. For
>>> example, this snippet fails:
>>>
>>>import ovirtsdk4 as sdk
>>>import ovirtsdk4.types as types
>>>
>>># Create the connection to the server:
>>>connection = sdk.Connection(
>>>url='https://fqdn/ovirt-engine/api',
>>>username='...',
>>>password='...',
>>>ca_file='...',
>>>debug=True,
>>>)
>>>
>>>users_service = connection.system_service().users_service()
>>>users = users_service.list()
>>>
>>>connection.close()
>>>
>>> This snippet fails in the "users = users_service.list()" line,
>>> because one of the records have a tilde (ó).
>>>
>>> The trace is:
>>> Traceback (most recent call last):
>>>  File "lista_users", line 23, in 
>>>users = users_service.list()
>>>  File
>>> "/home/ovirt/prueba/ejemplo2/lib/python2.7/site-packages/ovirtsdk4/services.py",
>>> line 22155, in list
>>>return self._internal_get(headers, query, wait)
>>>  File
>>> "/home/ovirt/prueba/ejemplo2/lib/python2.7/site-packages/ovirtsdk4/service.py",
>>> line 202, in _internal_get
>>>return future.wait() if wait else future
>>>  File
>>> "/home/ovirt/prueba/ejemplo2/lib/python2.7/site-packages/ovirtsdk4/service.py",
>>> line 53, in wait
>>>return self._code(response)
>>>  File
>>> "/home/ovirt/prueba/ejemplo2/lib/python2.7/site-packages/ovirtsdk4/service.py",
>>> line 197, in callback
>>>return self._internal_read_body(response)
>>>  File
>>> "/home/ovirt/prueba/ejemplo2/lib/python2.7/site-packages/ovirtsdk4/service.py",
>>> line 310, in _internal_read_body
>>>return reader.Reader.read(response.body)
>>>  File
>>> "/home/ovirt/prueba/ejemplo2/lib/python2.7/site-packages/ovirtsdk4/reader.py",
>>> line 297, in read
>>>cursor = xml.XmlReader(io.BytesIO(source.encode('utf-8')))
>>> UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position
>>> 1899: ordinal not in range(128)
>>>
>>> Opening the source code (ovirtsdk4/reader.py) file and seeking the
>>> exact line that fails I can see:
>>>
>>>if isinstance(source, str):
>>>cursor = xml.XmlReader(io.BytesIO(source.encode('utf-8')))
>>>
>>> If I add a line just after the 'if' being "cursor =
>>> cursor.decode('utf-8')", it seems to work, but I guess the source
>>> code should handle this kind of situations.
>>>
>>> Is this a known issue? Should I open a BZ? Any workaround meanwhile?
>>>
>>> Thanks.
>>> ___
>>> Users mailing list
>>> Users@ovirt.org
>>> http://lists.ovirt.org/mailman/listinfo/users
> ___
> Users mailing list
> Users@ovirt.org
> http://lists.ovirt.org/mailman/listinfo/users

___
Users mailing list
Users@ovirt.org
http://lists.ovirt.org/mailman/listinfo/users


Re: [ovirt-users] Problem while adding a VM NIC via REST API

2017-06-02 Thread Juan Hernández
On 06/02/2017 03:56 PM, Bruno Rodriguez wrote:
> Hello everyone,
> 
> I have some scripts that create VMs, which are in perl using libcurl and
> oVirt REST API. They work quite fine but I'm experiencing something unusual.
> 
> After I create the machine (let's suppose it's called server.pic.es
> ) with UUID 123abc I post the following REST API
> call to https://... /vms/123abc/nics 
> 
> 
> server.pic.es_nic1
> virtio
> VLANXXX
> 
> 
> The NIC is created and attached to the VM but it's network field is
> empty, not in the VLANXXX. I don't know if I'm missing something but
> this worked flawlessly with 3.6.9 REST API.
> 
> Some people could say: "it's because you're using Perl". Yup, that's
> probably a mental issue of mine and I should visit a doctor about using
> it, but it doesn't work even using a fancy REST browser extension to
> send requests (ARC for chromium), anyways the REST reply is a "201:
> Created" that looks OK...
> 
> Any idea or suggestion will be welcome. Thanks in advance!
> 

It is not because of Perl :-) .

In version 4 of the API it is mandatory to specify the NIC profile, as
the network may have multiple profiles. So you need to find the
identifier of that NIC profile and then send a request like this:

  
server.pic.es_nic1
virtio

  

You can find the identifiers of the profiles like this:

  GET /ovirt-engine/api/networks/the_identifier_of_the_network/vnicprofildes

If you want the old behavior, the behavior of version 3 of the API, you
can just add to your request the 'Version: 3' HTTP header. But note that
version 3 of the API is deprecated since version 4.0 of the engine, and
it will be removed with version 4.2 of the engine.
___
Users mailing list
Users@ovirt.org
http://lists.ovirt.org/mailman/listinfo/users


Re: [ovirt-users] SQL : last time halted?

2017-05-30 Thread Juan Hernández
On 05/30/2017 05:02 PM, Nicolas Ecarnot wrote:
> Hello,
> 
> I'm trying to find a way to clean up the VMs list of my DCs.
> I think some of my users have created VM they're not using anymore, but
> it's difficult to sort them out.
> In some cases, I can shutdown some of them and wait.
> Is there somewhere stored in the db tables the date of the last VM
> exctinction?
> 
> Thank you.
> 

Did you consider using the API? There is a 'stop_time' attribute that
you can use. For example, to list all the VMs and sort them by stop time
you can use the following Python script:

---8<---
import ovirtsdk4 as sdk
import ovirtsdk4.types as types

# Create the connection to the server:
connection = sdk.Connection(
url='https://engine.example.com/ovirt-engine/api',
username='admin@internal',
password='...',
ca_file='/etc/pki/ovirt-engine/ca.pem'
)

# List the virtual machines:
vms_service = connection.system_service().vms_service()
vms = vms_service.list()

# Sort the them by stop time:
vms.sort(key=lambda vm: vm.stop_time)

# Print the result:
for vm in vms:
print("%s: %s" % (vm.name, vm.stop_time))

# Close the connection to the server:
connection.close()
--->8---

___
Users mailing list
Users@ovirt.org
http://lists.ovirt.org/mailman/listinfo/users


Re: [ovirt-users] Docker images for oVirt engine

2017-05-19 Thread Juan Hernández
On 05/19/2017 05:20 AM, Leni Kadali Mutungi wrote:
> Running `make build` went fine until I saw this error:
> 
> Step 26/34 : RUN sed -i 's/multipathd.service //g'
> /usr/lib/systemd/system/vdsmd.service
>  ---> Running in 6a0948c94798
> ERRO[0104] containerd: notify OOM events error=cgroup
> path for memory not found
> sed: can't read /usr/lib/systemd/system/vdsmd.service: No such file or 
> directory
> The command '/bin/sh -c sed -i 's/multipathd.service //g'
> /usr/lib/systemd/system/vdsmd.service' returned a non-zero code: 2
> Failed to build image 'ovirt/vdsc:master'
> 
> I tried restarting the Docker daemon and re-running `make build`,
> since before this I got this error:
> 
> Message from syslogd@localhost at May 19 06:07:57 ... kernel:[
> 7498.623027] unregister_netdevice: waiting for lo to become free.
> Usage count = 1
> 

Did that restart of the docker daemon resolve the problem?

As far as I can tell that 'RUN sed' instruction that failed is correct.
I just re-checked it in my environment and it works correctly. Looks
more like a resources issue or a bug in docker itself. The message says
OOM, out of memory, is that machine low on memory maybe?
___
Users mailing list
Users@ovirt.org
http://lists.ovirt.org/mailman/listinfo/users


Re: [ovirt-users] Building ovirt-host-deploy gives `configure: error: otopi-devtools required but missing`

2017-05-19 Thread Juan Hernández
On 05/19/2017 05:38 AM, Leni Kadali Mutungi wrote:
> By the way, how does WildFly fit into all of this? Because I
> downloaded a zip file from their site as referenced here:
> https://github.com/leni1/oVirt-docs-Debian/blob/master/oVirt-Development-Environment.md
> and it seemed to me that zip contained a script that runs the WildFly
> server instance within the terminal. How is it supposed to interact
> with the oVirt engine and how do I make sure to run it such that there
> are no errors arising from not having it. As of now I run it as a
> standalone server according to the instructions in the README.txt file
> that comes with the zip file:
> 
> Starting a Standalone Server
> 
> A WildFly standalone server runs a single instance.
> 
> /bin/standalone.sh  (Unix / Linux)
> 
> 

Currently the oVirt engine has its own mechanism to start the
application server, you don't need to (and should not) start it yourself
with the 'standalone.sh' script. All you need to do is to tell the
engine where the application server is installed. To do so you need to
set the 'JBOSS_HOME' home in the engine configuration. The easiest way
to do that is to add the '--jboss-home' option to the 'engine-setup'
command:

  engine-setup --jboss-home=

That will add the following to the generated
'engine.conf.d/10-setup-jboss.conf' file:

  JBOSS_HOME=""

You can also change that file manually, if you move the application
server to a different directory, for example.
___
Users mailing list
Users@ovirt.org
http://lists.ovirt.org/mailman/listinfo/users


Re: [ovirt-users] Docker images for oVirt engine

2017-05-18 Thread Juan Hernández
On 05/18/2017 05:29 AM, Leni Kadali Mutungi wrote:
> On 5/15/17, Juan Hernández <jhern...@redhat.com> wrote:
>> The tool that builds and deploy the containers to the OpenShift cluster
>> is a program written in Go. It is compiled when you run 'make ...'. That
>> means that you need to have the go development environment installed.
>> For example, in CentOS or Fedora:
>>
>>   yum -y install golang
>>
>> Once you have it installed, try again 'make build' and 'make deploy'.
>>
>> I'll try to update the documentation to explain that.
> 
> Installed Go. For some reason, building still refuses to work.
> 
> user@localhost:~/ovirt-containers$ sudo make build
> for godep in gopkg.in/ini.v1 ; do \
> GOPATH=""/tools"" go get ${godep}; \
> done
> GOPATH=""/tools"" go install ovirt/cmd/build
> can't load package: package ovirt/cmd/build: cannot find package
> "ovirt/cmd/build" in any of:
> /usr/lib/go-1.7/src/ovirt/cmd/build (from $GOROOT)
> /tools/src/ovirt/cmd/build (from $GOPATH)
> Makefile:40: recipe for target 'tools/bin/build' failed
> make: *** [tools/bin/build] Error 1
> 
> I looked at the tools/src/ovirt/cmd/build directory and it had the
> build.go file. I don't have the ovirt subdirectory in the
> /usr/lib/go-1.7/src/ directory. Any ideas on how to get it there?
> 

The problem is that the Makefile uses the current working directory to
setup the GOPATH. When you use 'sudo' the current working directory is
the home of the root user, hence the Makefile won't work. Please try to
run the build with a non-root user, just go into the the source
directory and type 'make build'.

You will also need to make sure that the user has docker permissions, if
you didn't do it yet. To do so just add it to the 'docker' group. For
example, in Fedora or RHEL:

  usermod -aG docker youruser

Note that once you do that you will need to re-login to make it effective.
___
Users mailing list
Users@ovirt.org
http://lists.ovirt.org/mailman/listinfo/users


Re: [ovirt-users] Docker images for oVirt engine

2017-05-15 Thread Juan Hernández
On 05/15/2017 05:24 AM, Leni Kadali Mutungi wrote:
> Managed to run the OpenShift cluster well enough. When I went into the
> ovirt-containers directory and tried to run `make build`, I got the
> following error:
> 
> for godep in gopkg.in/ini.v1 ; do \
> GOPATH=""/home/herabus/ovirt-containers/tools"" go get ${godep}; \
> done
> /bin/sh: 2: go: Permission denied
> Makefile:40: recipe for target 'tools/bin/build' failed
> make: *** [tools/bin/build] Error 127
> 
> So I ran `sudo make build` instead and got the following error:
> for godep in gopkg.in/ini.v1 ; do \
> GOPATH=""/tools"" go get ${godep}; \
> done
> /bin/sh: 2: go: not found
> Makefile:40: recipe for target 'tools/bin/build' failed
> make: *** [tools/bin/build] Error 127
> 
> Running `sudo make deploy` gave me this error:
> 
> for godep in gopkg.in/ini.v1 ; do \
> GOPATH=""/tools"" go get ${godep}; \
> done
> /bin/sh: 2: go: not found
> Makefile:40: recipe for target 'tools/bin/deploy' failed
> make: *** [tools/bin/deploy] Error 127
> 

The tool that builds and deploy the containers to the OpenShift cluster
is a program written in Go. It is compiled when you run 'make ...'. That
means that you need to have the go development environment installed.
For example, in CentOS or Fedora:

  yum -y install golang

Once you have it installed, try again 'make build' and 'make deploy'.

I'll try to update the documentation to explain that.
___
Users mailing list
Users@ovirt.org
http://lists.ovirt.org/mailman/listinfo/users


Re: [ovirt-users] slow kerberos authentication

2017-05-12 Thread Juan Hernández
On 05/12/2017 11:45 AM, Juan Hernández wrote:
> On 05/12/2017 10:04 AM, Yaniv Kaul wrote:
>>
>>
>> On May 11, 2017 8:25 PM, "Fabrice Bacchella"
>> <fabrice.bacche...@orange.fr <mailto:fabrice.bacche...@orange.fr>> wrote:
>>
>> I'm using kerberos authentication in ovirt for the URL
>> /sso/oauth/token-http-auth, but kerberos is done in Apache using
>> auth_gssapi_module and it's quite slow, about 6s for a request.
>>
>> I'm trying to understand if it's apache or ovirt-engine that are
>> slow. Is there a way to get response time metered for http requests
>> inside ovirt instead of seen from apache ?
>>
>>
>> In 4.1, look under /var/log/httpd, there should be an ovirt specific log
>> file for exactly this - end to end latency of requests. 
>> Y. 
>>
> 
> The name of that file is 'ovirt-requests-log', and it contains messages
> like this:
> 
>   [12/May/2017:11:09:30 +0200] 192.168.122.1 "Correlation-Id:
> 9e259b75-ee9e-4501-9737-b38d2c318123" "Duration: 393514us" "GET
> /ovirt-engine/api/vms HTTP/1.1" 2322
> 
> Note however that it is generated by the web server, so the reported
> time will include all the web server activities required to complete the
> request.
> 
> If you need to get the same measurement from the point of view of the
> application server you can edit the
> /usr/share/ovirt-engine/services/ovirt-engine/ovirt-engine.xml.in file
> and do the following modifications:
> 
> 1. Modify the AJP connector (the one that Apache talks to) so that it
> records the start time of the request:
> 
>name="ajp"
> socket-binding="ajp"
> redirect-socket="redirect"
> record-request-start-time="true"  <-- This is new
>   />
> 
> 2. Enable the access log:
> 
>   
> 
>  prefix="my" suffix=".log"/>  <-- This is new
>   
> 
> Then restart the engine. It will start to write to
> /var/log/ovirt-engine/my.log lines like this:
> 
>   /ovirt-engine/api/vms 801ms
> 
> The format of the pattern is described here:
> 
>   http://undertow.io/javadoc/1.4.x/index.html
> 

Actually here:


http://undertow.io/javadoc/1.4.x/io/undertow/server/handlers/accesslog/AccessLogHandler.html

> Remember that the ovirt-engine.xml.in file isn't considered a
> configuration file, so your changes will be lost next time you update
> the engine RPMs.
> 

___
Users mailing list
Users@ovirt.org
http://lists.ovirt.org/mailman/listinfo/users


Re: [ovirt-users] slow kerberos authentication

2017-05-12 Thread Juan Hernández
On 05/12/2017 10:04 AM, Yaniv Kaul wrote:
> 
> 
> On May 11, 2017 8:25 PM, "Fabrice Bacchella"
> > wrote:
> 
> I'm using kerberos authentication in ovirt for the URL
> /sso/oauth/token-http-auth, but kerberos is done in Apache using
> auth_gssapi_module and it's quite slow, about 6s for a request.
> 
> I'm trying to understand if it's apache or ovirt-engine that are
> slow. Is there a way to get response time metered for http requests
> inside ovirt instead of seen from apache ?
> 
> 
> In 4.1, look under /var/log/httpd, there should be an ovirt specific log
> file for exactly this - end to end latency of requests. 
> Y. 
> 

The name of that file is 'ovirt-requests-log', and it contains messages
like this:

  [12/May/2017:11:09:30 +0200] 192.168.122.1 "Correlation-Id:
9e259b75-ee9e-4501-9737-b38d2c318123" "Duration: 393514us" "GET
/ovirt-engine/api/vms HTTP/1.1" 2322

Note however that it is generated by the web server, so the reported
time will include all the web server activities required to complete the
request.

If you need to get the same measurement from the point of view of the
application server you can edit the
/usr/share/ovirt-engine/services/ovirt-engine/ovirt-engine.xml.in file
and do the following modifications:

1. Modify the AJP connector (the one that Apache talks to) so that it
records the start time of the request:

  

2. Enable the access log:

  

  <-- This is new
  

Then restart the engine. It will start to write to
/var/log/ovirt-engine/my.log lines like this:

  /ovirt-engine/api/vms 801ms

The format of the pattern is described here:

  http://undertow.io/javadoc/1.4.x/index.html

Remember that the ovirt-engine.xml.in file isn't considered a
configuration file, so your changes will be lost next time you update
the engine RPMs.
___
Users mailing list
Users@ovirt.org
http://lists.ovirt.org/mailman/listinfo/users


Re: [ovirt-users] Python-SDK4: Shutdown a machine with a specific message?

2017-05-12 Thread Juan Hernández
On 05/12/2017 09:46 AM, nico...@devels.es wrote:
> Hi,
> 
> Using Python-SDK4, is there a way to shutdown a machine with a specific
> message?
> 
> In code I just see this definition:
> 
> def shutdown(
> self,
> async=None,
> headers=None,
> query=None,
> ):
> 
> I wonder if some header allows specifying the message here.
> 

Currently there is no way to specify that message using the API. Can you
open a RFE requesting it?
___
Users mailing list
Users@ovirt.org
http://lists.ovirt.org/mailman/listinfo/users


Re: [ovirt-users] Current status of ManageIQ to manage oVirt 4.1.1?

2017-05-11 Thread Juan Hernández
On 05/09/2017 01:02 PM, Gianluca Cecchi wrote:
> On Fri, May 5, 2017 at 4:47 PM, Juan Hernández <jhern...@redhat.com
> <mailto:jhern...@redhat.com>> wrote:
> 
> 
> Yes, capablanca is too old.
> 
> The instructions that you mention should still work, but remember to
> make a backup before doing that in your production environment.
> 
> Anyhow, I'd suggest that you install a fresh euwe, if that is an option
> for you.
> 
> There is no support for YUM/RPM upgrades, as far as I know.
> 
> 
> OK, after some attempts to upgrade in place my capablanca VM (just for
> learning), I abandoned it.
> It seems the euwe stable qemu/kvm has some problems too in general... I
> get this during the initialization after VM start
> 
> appliance_console_cli --region 0 --internal --password smartvm
> /opt/rubies/ruby-2.3.1/lib/ruby/gems/2.3.0/gems/bundler-1.14.6/lib/bundler/source/git/git_proxy.rb:225:in
> |allowed_in_path': The git source
> https://github.com/ManageIQ/manageiq-providers-amazon is not yet checked
> out. Please run|bundle install` before trying to start your application
> (Bundler::GitError)
> 
> Then I have tried the just released Fine qemu/kvm rc1 image and it works
> ok, so I'm using it for my tests...
> I was able to add oVirt engine 4.1.2 pre.
> But now I see almost all (VMs, datastores, ecc.) but the hosts...
> Furthermore in Compute --> Infrastructure --> Hosts I do find the engine
> but not the host...
> Do I have to add in any way also the hypervisors to the ManageIQ
> configuration? Or should it be automatic?
> 

The hosts should be added automatically. Moti, I remember that you
mentioned some issue with hosts. Was that resolved?

> Also, do you know when I choose to see console in ManageIQ, both the
> "web console"  and the "WM console" options in "Access" menu, from where
> the connection is originated: my client where browser is running or from
> manageiq server and then passed in any way to client?
> Which protocol does the web console use?
>

I am not sure about that. Martin, can you answer that question?


___
Users mailing list
Users@ovirt.org
http://lists.ovirt.org/mailman/listinfo/users


Re: [ovirt-users] Docker images for oVirt engine

2017-05-11 Thread Juan Hernández
On 05/11/2017 08:54 AM, Barak Korren wrote:
> On 11 May 2017 at 06:02, Leni Kadali Mutungi  wrote:
>>> On 5/10/17, Barak Korren  wrote:
 That one is obsolete AFAIK. The oVirt container images are now being
 worked on in the 'ovirt-containers' repo.
>>
>> Checked it out. It seems more complicated than what I need, which
>> would be just a Dockerfile that pulls the required image. The
>> ovirt-containers repo seems to have a dependency on OpenCluster, which
>> I think I won't need since I'm after a basic install on one machine
>> for documentation purposes. Your advice is appreciated.
> 
> Adding ovirt-containers developers. Yaniv, Juan, Fabian, Sandro,
> Simone - can ovirt-containers be used for his purpose?
> 
> Also adding Rgolan since he did work in the past on a containerized
> dev environment for oVirt.
> 
> If you just want your own little oVirt install "in a box" for
> testing/dev purposes, you can look at Lago and the ovirt-system-tests
> projects.
> 
> 

You may be able to use the engine container independently, with some
effort. But this 'ovirt-containers' project isn't certainly intended for
that simple use case, it is intended to be able to deploy the complete
oVirt system in an OpenShift cluster.

If you are willing to give this a try, and you already have a docker
installation, creating an OpenShift cluster for testing purposes is
really simple. You can use 'oc cluster up'. It is a matter of
downloading the 'oc' tool from here:


https://github.com/openshift/origin/releases/download/v1.5.0/openshift-origin-client-tools-v1.5.0-031cbe4-linux-64bit.tar.gz

That contains the 'oc' binary. Put it in your path and then run this
command:

  oc cluster up

That will pull all the required images, and configure a simple OpenShift
cluster into your machine. Once that completes you can proceed to deploy
the oVirt application. First you need to build the images, as they
aren't yet available in a public repository. To build the images
checkout the code of the project:

  git clone git://gerrit.ovirt.org/ovirt-containers

Then go into that directory and run this:

  make build

That will take quite a long time, as it needs to build all the images,
and it requires downloading of the base images and of the RPMs that go
into the images being built. Be patient.

Once the images are built, you can deploy the complete oVirt application
running this:

  make deploy

Would be great to have you testing this, giving feedback and reporting
any issues you find. But be aware that this is in a very early stage of
development and should be considered experimental.

___
Users mailing list
Users@ovirt.org
http://lists.ovirt.org/mailman/listinfo/users


Re: [ovirt-users] Current status of ManageIQ to manage oVirt 4.1.1?

2017-05-05 Thread Juan Hernández
On 05/05/2017 04:40 PM, Gianluca Cecchi wrote:
> 
> 
> On Fri, May 5, 2017 at 4:29 PM, Juan Hernández <jhern...@redhat.com
> <mailto:jhern...@redhat.com>> wrote:
> 
> On 05/05/2017 03:47 PM, Gianluca Cecchi wrote:
> > Hello,
> > is ManageIQ able to manage oVirt version 4.1.1?
> > From which version of ManageIQ has been included in case?
> > I see this link abot prblems with 4.x api and such:
> > https://github.com/ManageIQ/manageiq/issues/7573
> <https://github.com/ManageIQ/manageiq/issues/7573>
> >
> > Thanks,
> > Gianluca
> >
> 
> Managing oVirt 4 is supported since ManageIQ 'darga' release, which is
> the previous release, current is 'euwe'.
> 
> The issue that you mention is already closed.
> 
> Like with any piece of software there may be issues. We are committed to
> fix them. If you find one, please let us know.
> 
> 
> Ah, ok. Perfect.
> I was testing an older appliance ad I'm noticing now that is based on
> capablanca, so probably too old... and it didn't work
> Do you think there is a quick path to update it to the latest or better
> to directly deploy the euwe one?  
> I have found this old link:
> http://mariopang.blogspot.it/2015/05/update-manageiq-image.html
> but I don't know if it is still ok
> 
> hopefully there is also a yum/rpm path?
> 

Yes, capablanca is too old.

The instructions that you mention should still work, but remember to
make a backup before doing that in your production environment.

Anyhow, I'd suggest that you install a fresh euwe, if that is an option
for you.

There is no support for YUM/RPM upgrades, as far as I know.

___
Users mailing list
Users@ovirt.org
http://lists.ovirt.org/mailman/listinfo/users


Re: [ovirt-users] Current status of ManageIQ to manage oVirt 4.1.1?

2017-05-05 Thread Juan Hernández
On 05/05/2017 03:47 PM, Gianluca Cecchi wrote:
> Hello,
> is ManageIQ able to manage oVirt version 4.1.1?
> From which version of ManageIQ has been included in case?
> I see this link abot prblems with 4.x api and such: 
> https://github.com/ManageIQ/manageiq/issues/7573
> 
> Thanks,
> Gianluca
> 

Managing oVirt 4 is supported since ManageIQ 'darga' release, which is
the previous release, current is 'euwe'.

The issue that you mention is already closed.

Like with any piece of software there may be issues. We are committed to
fix them. If you find one, please let us know.
___
Users mailing list
Users@ovirt.org
http://lists.ovirt.org/mailman/listinfo/users


Re: [ovirt-users] Ovirt 4, the missing python sdk

2017-04-28 Thread Juan Hernández
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  > 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:///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
> >
> >
> > 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
> 
> 
> 
> 
> 
> 
> ___
> Users mailing list
> Users@ovirt.org
> http://lists.ovirt.org/mailman/listinfo/users
> 

___
Users mailing list
Users@ovirt.org
http://lists.ovirt.org/mailman/listinfo/users


Re: [ovirt-users] Info on fence_rhevm against oVirt 4.1.1

2017-04-28 Thread Juan Hernández
On 04/28/2017 01:54 AM, Gianluca Cecchi wrote:
> On Thu, Apr 27, 2017 at 6:32 PM, Juan Hernández <jhern...@redhat.com
> <mailto:jhern...@redhat.com>> wrote:
> 
> That is a known issue:
> 
>   fence_rhevm can only work as RHEV admin user not a regular user (that
> requires "Filter: true http header)
>   https://bugzilla.redhat.com/1287059
> <https://bugzilla.redhat.com/1287059>
> 
> That was fixed in fence-agents-4.0.11-47.el7, but I guess it wasn't
> backported to CentOS 6.
> 
> I'd suggest that you open a bug for this component in the Red Hat
> Enterprise Linux bug tracker, requesting that the fix be back-ported.
> 
> Meanwhile, if you are in a hurry, you can take the CentOS 7 fence_rhev
> script, which should work.
> 
> You will most likely also need to add --ssl-indecure to the command line
> of the agent, because you will most likely be using the default self
> signed certificate authority used by the engine.
> 
> Note that the latest version of this script uses the 'Filter: true'
> header to drop privileges. That means that even when using
> 'admin@internal' you have to make sure that 'admin@internal' has
> permissions for the VM that you want to fence, otherwise it will not be
> able to find/fence it.
> 
> 
> Thanks for the feedback Juan.
> I confirm that using fence_rhevm from latest CentOS 7 version it worked.
> These were the lines in my cluster.conf
> 
>   
>   
>   
>port="p2vorasvi1"/>
>   
>   
>   
>   
>   
>   
>port="p2vorasvi2"/>
>   
>   
>   
>   
>   
>score="1" tko="200"/>
>   
>   
>ipaddr="10.4.192.43" login="g.cecchi@internal" 
> passwd_script="/usr/local/bin/pwd_dracnode01.sh" name="ovirt_fencedelay" 
> ssl="on" ssl_insecure="on" shell_timeout="20" power_wait="10"/>
>login="g.cecchi@internal" passwd_script="/usr/local/bin/pwd_dracnode02.sh" 
> name="ovirt_fence" ssl="on" ssl_insecure="on" shell_timeout="20" 
> power_wait="10"/>
>   
> 
> Using admin@internal didn't work even if I set the permissions at vm
> level too...
> 

It should work adding 'UserRole' to 'admin@internal'. The issue is that
the fence agent uses the 'Filter: true' header, thus it drops its
super-user privileges to do the query, and won't get the VM unless it
has explicitly granted permissions. To check it you can do the
following, for example:

---8<---
#!/bin/sh -ex

url="https://yourengine/ovirt-engine/api;
user="admin@internal"
password="..."

curl \
--verbose \
--cacert "/etc/pki/ovirt-engine/ca.pem" \
--user "${user}:${password}" \
--request GET \
--header "Version: 3" \
--header "Filter: true" \
"${url}/vms?search=name%3Dmyvm"
--->8---

That should return the details of the VM, or nothing if the user doesn't
have permission to see that VM.

> It worked with my username (g.cecchi) that has SuperUser system
> privilege and also at VM level.
> 
> Is it yet necessary to have a user with SuperUser privilege at system level?
> 

No, it shouldn't be necessary. Actually, as you are using the 'internal'
domain, it is easy to add a new dummy user without SuperUser privileges.
You can give that user permissions (with 'UserRole') only for the VMs
that are nodes of the cluster. That should be enough.

> Tomorrow (today... ;-) I'm going to open a bugzilla to backport the feature.
> 
> Thanks again,
> Gianluca
> 

___
Users mailing list
Users@ovirt.org
http://lists.ovirt.org/mailman/listinfo/users


Re: [ovirt-users] Info on fence_rhevm against oVirt 4.1.1

2017-04-27 Thread Juan Hernández
On 04/27/2017 05:35 PM, Gianluca Cecchi wrote:
> On Thu, Apr 27, 2017 at 4:58 PM, Gianluca Cecchi
> > wrote:
> 
> On Thu, Apr 27, 2017 at 4:43 PM, Gianluca Cecchi
> > wrote:
> 
> Hello,
> I'm trying to use fence_rhevm in a CentOS 6.8 guest that is part
> of a virtual rhcs cluster
> 
> My sw version for fence_agents inside guest is
> fence-agents-4.0.15-12.el6.x86_64 and I notice that for this
> particular agent nothing changes also using the latest available
> package fence-agents-4.0.15-13.el6.x86_64.rpm apart
> 
> [root@p2vnorasvi1 ~]# diff fence_rhevm /usr/sbin/fence_rhevm
> 13c13
> < BUILD_DATE="(built Wed Mar 22 04:24:11 UTC 2017)"
> ---
> > BUILD_DATE="(built Tue May 10 22:28:47 UTC 2016)"
> [root@p2vnorasvi1 ~]# 
> 
> The VM name in oVirt 4.1.1 is p2vorasvi1
> 
> Running this command against the engine I get
> 
> [root@p2vnorasvi1 network-scripts]# fence_rhevm -a 10.4.192.43
> -l "admin@internal" -p "mypassword" -z --shell-timeout=20
> --power-wait=10 -v -o status -n p2vorasvi1
> vms/?search=name%3Dp2vorasvi1
> 
> 
> 
> 404 Not Found
> 
> Not Found
> The requested URL /api/vms/ was not found on this server.
> 
> 
> 
> Failed: Unable to obtain correct plug status or plug is not
> available
> 
> Actually I get the same error even if I put a wrong password
> 
> What am I missing...?
> Do I have to specify DC/cluster if I have more than one, or
> other parameters?
> 
> Thanks,
> Gianluca
> 
> 
> 
> If I change this in fence_rhevm
> 
> [root@p2vnorasvi1 sbin]# diff fence_rhevm fence_rhevm.orig 
> 84c84
> < url += "//" + opt["--ip"] + ":" + str(opt["--ipport"]) +
> "/ovirt-engine/api/" + command
> ---
> > url += "//" + opt["--ip"] + ":" + str(opt["--ipport"]) + "/api/" +
> command
> 
> I now get 401 unauthorized
> 
> [root@p2vnorasvi1 sbin]# fence_rhevm -a 10.4.192.43 -z -l
> "admin@internal" -p "mypassword"  --shell-timeout=20 --power-wait=10
> -v -o status -n p2vorasvi1
> vms/?search=name%3Dp2vorasvi1
> 
> ErrorUnauthorized
> 
> Failed: Unable to obtain correct plug status or plug is not available
> 
> 
> [root@p2vnorasvi1 sbin]# 
> 
> and in engine ssl_access.log
> 
> 127.0.0.1 - - [27/Apr/2017:16:51:55 +0200] "POST
> /ovirt-engine/sso/oauth/token HTTP/1.1" 200 153
> 10.4.168.91 - - [27/Apr/2017:16:51:55 +0200] "GET
> /ovirt-engine/api/vms/?search=name%3Dp2vorasvi2 HTTP/1.1" 401 71
> 
> 
> 
> Tried also using v3 in url, this way:
> 
> [root@p2vnorasvi1 sbin]# diff fence_rhevm fence_rhevm.orig 
> 84c84
> < url += "//" + opt["--ip"] + ":" + str(opt["--ipport"]) +
> "/ovirt-engine/api/v3/" + command
> ---
>> url += "//" + opt["--ip"] + ":" + str(opt["--ipport"]) + "/api/" + command
> [root@p2vnorasvi1 sbin]# 
> 
> [root@p2vnorasvi1 sbin]# fence_rhevm -a 10.4.192.43 -z -l
> "admin@internal" -p "mypassword"  --shell-timeout=20 --login-timeout=20
> --power-wait=10 -v -o status -n p2vorasvi1
> vms/?search=name%3Dp2vorasvi1
> 
> ErrorUnauthorized
> 
> Failed: Unable to obtain correct plug status or plug is not available
> 
> 
> [root@p2vnorasvi1 sbin]# 
> 

That is a known issue:

  fence_rhevm can only work as RHEV admin user not a regular user (that
requires "Filter: true http header)
  https://bugzilla.redhat.com/1287059

That was fixed in fence-agents-4.0.11-47.el7, but I guess it wasn't
backported to CentOS 6.

I'd suggest that you open a bug for this component in the Red Hat
Enterprise Linux bug tracker, requesting that the fix be back-ported.

Meanwhile, if you are in a hurry, you can take the CentOS 7 fence_rhev
script, which should work.

You will most likely also need to add --ssl-indecure to the command line
of the agent, because you will most likely be using the default self
signed certificate authority used by the engine.

Note that the latest version of this script uses the 'Filter: true'
header to drop privileges. That means that even when using
'admin@internal' you have to make sure that 'admin@internal' has
permissions for the VM that you want to fence, otherwise it will not be
able to find/fence it.
___
Users mailing list
Users@ovirt.org
http://lists.ovirt.org/mailman/listinfo/users


Re: [ovirt-users] bug with ConsoleWriter ?

2017-04-22 Thread Juan Hernández
On 04/21/2017 05:26 PM, Fabrice Bacchella wrote:
> I'm trying to dump informations about console with the following code:
> 
> vm = vms_service.list(search='name=fa41')[0]
> 
> # Find the service that manages the graphics consoles of the virtual machine:
> vm_service = vms_service.vm_service(vm.id)
> consoles_service = vm_service.graphics_consoles_service()
> console_type = consoles_service.list()[0]
> 
> console_type = connection.follow_link(console_type)
> buf = None
> writer = None
> buf = io.BytesIO()
> writer = xml.XmlWriter(buf, indent=True)
> ConsoleWriter.write_one(console_type, writer)
> writer.flush()
> print buf.getvalue()
> But i got the following result :
> 
> Traceback (most recent call last):
>   File "./export_console.py", line 69, in 
> ConsoleWriter.write_one(console_type, writer)
>   File ".../venv/lib/python2.7/site-packages/ovirtsdk4/writers.py", line 
> 1262, in write_one
> if obj.enabled is not None:
> 
> If I add print console_type.__dict__, it contains:
> 
> {'_address': None, '_instance_type': None, '_href': 
> '/ovirt-engine/api/vms/61a6de0a-2a21-4e90-bc20-29e3f0cd0ad8/graphicsconsoles/7370696365',
>  '_description': None, '_tls_port': None, '_comment': None, '_port': None, 
> '_name': None, '_vm': , 
> '_protocol': , '_template': None, '_id': 
> '7370696365'}
> 
> 
> Did I miss something, or is that a but with the console writer ? 

The problem is that you are trying to use the ConsoleWriter class to
write something that isn't a Console. The GraphicsConsoleService.list
method returns a list of objects of type GraphicsConsole, not Console.
So you need to use GraphicsConsoleWriter.

Note that once you have the virtual machine you can obtain the graphics
consoles directly using the 'follow_link' method, no need to use the
intermediate services. For example:

  vm = ...
  console = connection.follow_link(vm.graphics_consoles)[0]

Remember that the WhateverWriter classes are an implementation detail,
and that they may change or disappear without notice. If you need to
convert objects to XML use the generic Writer.write method that will be
introduced by this patch:

  Add generic writer
  https://gerrit.ovirt.org/75699

Ondra, in what version of the SDK do we plan to include that enhancement?

I also wonder why do you need to convert objects to XML explicitly. Can
you elaborate on what is your need?

___
Users mailing list
Users@ovirt.org
http://lists.ovirt.org/mailman/listinfo/users


Re: [ovirt-users] Missing feature in python SDK4

2017-04-20 Thread Juan Hernández
On 04/20/2017 04:35 PM, Juan Hernández wrote:
> On 04/20/2017 12:26 PM, Fabrice Bacchella wrote:
>> I didn't find a way to find the writer that correspond to a given type. Is 
>> there a way to do that, or it's up to the end user to manually manage this 
>> mapping ?
>>
> 
> Yes that is missing. We have it for reading, but not for writing. This
> patch should address that:
> 
>   Add generic writer
>   https://gerrit.ovirt.org/75699
> 
> Please open a bug so that we can decide what version should contain this
> fix.
> 
> Note that you should try to avoid using directly the writer/reader
> classes, as they are an internal implementation detail and may change in
> the future. The contract for reading/writing is using the Reader and
> Writer classes. For example, to generate the XML for an object (once the
> patch is merged):
> 
>   from ovirtsdk4 import types
>   from ovirtsdk4 import writer
>   from ovirtsdk4 import writers
> 
>   vm = types.Vm(
> id="123",
> name="myvm",
> ...
>   )
> 
>   xml = writer.Writer.write(vm)
> 
>   print(xml)
> 

The above was not complete clear. The ovirtsdk4.writer.Writer and
ovirtsdk4.reader.Reader classes are part of the contract of the SDK, it
is safe to use them. The specific writer/reader classes, for example
VmReader or VmWriter, are not part of the contract, and they may change
in the future without notice, so try to avoid using them directly.
___
Users mailing list
Users@ovirt.org
http://lists.ovirt.org/mailman/listinfo/users


Re: [ovirt-users] Missing feature in python SDK4

2017-04-20 Thread Juan Hernández
On 04/20/2017 12:26 PM, Fabrice Bacchella wrote:
> I didn't find a way to find the writer that correspond to a given type. Is 
> there a way to do that, or it's up to the end user to manually manage this 
> mapping ?
> 

Yes that is missing. We have it for reading, but not for writing. This
patch should address that:

  Add generic writer
  https://gerrit.ovirt.org/75699

Please open a bug so that we can decide what version should contain this
fix.

Note that you should try to avoid using directly the writer/reader
classes, as they are an internal implementation detail and may change in
the future. The contract for reading/writing is using the Reader and
Writer classes. For example, to generate the XML for an object (once the
patch is merged):

  from ovirtsdk4 import types
  from ovirtsdk4 import writer
  from ovirtsdk4 import writers

  vm = types.Vm(
id="123",
name="myvm",
...
  )

  xml = writer.Writer.write(vm)

  print(xml)
___
Users mailing list
Users@ovirt.org
http://lists.ovirt.org/mailman/listinfo/users


Re: [ovirt-users] [Python-SDK][Ovirt-4.0] Create VM on specific Host.

2017-04-19 Thread Juan Hernández
On 04/19/2017 01:27 PM, TranceWorldLogic . wrote:
> Hi,
> 
> It is working fine.
> But I want to disable migration policy. It didn't solve my purpose.
> 
> What else I have to do to disable migration ?
> 

Not sure what exactly you want to achieve. Can you elaborate a bit?

If in addition to pin the VM to a host you also want to disable
migration, you can use the Vm.placement_policy.affinity attribute:

  vm = vms_service.add(
vm=types.Vm(
  ...
  placement_policy=types.VmPlacementPolicy(
hosts=[
  types.Host(name='host-01')
],
affinity=types.VmAffinity.PINNED
  )
)
  )

Martin, I think that you can explain better than me what are the
meanings of the values of the VmAffinity enum, and what is it
relationship to pinning. Would be nice to have that documented in the
specification of the API.

> 
> 
> On Wed, Apr 19, 2017 at 1:36 PM, TranceWorldLogic .
> <tranceworldlo...@gmail.com <mailto:tranceworldlo...@gmail.com>> wrote:
> 
> Thanks will try and let you know,
> ~Rohit
> 
> On Wed, Apr 19, 2017 at 1:18 PM, Juan Hernández <jhern...@redhat.com
> <mailto:jhern...@redhat.com>> wrote:
> 
> On 04/19/2017 09:34 AM, Juan Hernández wrote:
> > On 04/19/2017 08:41 AM, TranceWorldLogic . wrote:
> >> Hi,
> >>
> >> I was trying to create VM on specific HOST using python sdk
> as shown below.
> >>
> >> -- Code ---
> >> vm = vms_service.add(  
> >> host = types.Host(
> >> name = "host-01",
> >> ),
> >>   )
> >> -- End Code ---
> >>
> >> It created VM successfully, but when I see in ovirt GUI I saw
> that VM is
> >> not bonded with specific host.
> >>
> >> Ovirt GUI:
> >> Virtual Machines -> click on VM -> "Edit" button -> In
> advance menu ->
> >> "Host" tab
> >> Start Running On:
> >>o  Any Host in Cluster  <== This option got selected
> >>o  Specific Host(s)   <== *I want this option to select.*
> >>
> >> Please help me to bind VM to specific Host via Python SDK
> >>
> >
> > The Vm.host attribute is used only to indicate in what host is
> the VM
> > currently running.
> >
> > To pin the VM to a set of hosts you have to use
> Vm.placement_policy, as
> > described here:
> >
> >
> >
> 
> http://ovirt.github.io/ovirt-engine-api-model/4.1/#types/vm/attributes/placement_policy
> 
> <http://ovirt.github.io/ovirt-engine-api-model/4.1/#types/vm/attributes/placement_policy>
> >
> > With the Python SDK it should be something like this:
> >
> >   vm = vms_service.add(
> > vm=types.Vm(
> >   ...
> >   placement_policy=types.PlacementPolicy(
> > hosts=[
> >   types.Host(name='host-01')
> > ]
> >   )
> > )
> >   )
> >
> 
> Sorry, the name of the type is incorrect, should be
> 'types.VmPlacementPolicy'. So the complete example should be
> like this:
> 
>   vm = vms_service.add(
> vm=types.Vm(
>   ...
>   placement_policy=types.VmPlacementPolicy(
> hosts=[
>   types.Host(name='host-01')
> ]
>   )
> )
>   )
> 
> 
> 

___
Users mailing list
Users@ovirt.org
http://lists.ovirt.org/mailman/listinfo/users


Re: [ovirt-users] [Python-SDK][Ovirt-4.0] Create VM on specific Host.

2017-04-19 Thread Juan Hernández
On 04/19/2017 09:34 AM, Juan Hernández wrote:
> On 04/19/2017 08:41 AM, TranceWorldLogic . wrote:
>> Hi,
>>
>> I was trying to create VM on specific HOST using python sdk as shown below.
>>
>> -- Code ---
>> vm = vms_service.add(  
>> host = types.Host(
>> name = "host-01",
>> ),
>>   )
>> -- End Code ---
>>
>> It created VM successfully, but when I see in ovirt GUI I saw that VM is
>> not bonded with specific host.
>>
>> Ovirt GUI:
>> Virtual Machines -> click on VM -> "Edit" button -> In advance menu ->
>> "Host" tab
>> Start Running On:
>>o  Any Host in Cluster  <== This option got selected
>>o  Specific Host(s)   <== *I want this option to select.*
>>
>> Please help me to bind VM to specific Host via Python SDK
>>
> 
> The Vm.host attribute is used only to indicate in what host is the VM
> currently running.
> 
> To pin the VM to a set of hosts you have to use Vm.placement_policy, as
> described here:
> 
> 
> http://ovirt.github.io/ovirt-engine-api-model/4.1/#types/vm/attributes/placement_policy
> 
> With the Python SDK it should be something like this:
> 
>   vm = vms_service.add(
> vm=types.Vm(
>   ...
>   placement_policy=types.PlacementPolicy(
> hosts=[
>   types.Host(name='host-01')
> ]
>   )
> )
>   )
> 

Sorry, the name of the type is incorrect, should be
'types.VmPlacementPolicy'. So the complete example should be like this:

  vm = vms_service.add(
vm=types.Vm(
  ...
  placement_policy=types.VmPlacementPolicy(
hosts=[
  types.Host(name='host-01')
]
  )
)
  )

___
Users mailing list
Users@ovirt.org
http://lists.ovirt.org/mailman/listinfo/users


Re: [ovirt-users] [Python-SDK][Ovirt-4.0] Create VM on specific Host.

2017-04-19 Thread Juan Hernández
On 04/19/2017 08:41 AM, TranceWorldLogic . wrote:
> Hi,
> 
> I was trying to create VM on specific HOST using python sdk as shown below.
> 
> -- Code ---
> vm = vms_service.add(  
> host = types.Host(
> name = "host-01",
> ),
>   )
> -- End Code ---
> 
> It created VM successfully, but when I see in ovirt GUI I saw that VM is
> not bonded with specific host.
> 
> Ovirt GUI:
> Virtual Machines -> click on VM -> "Edit" button -> In advance menu ->
> "Host" tab
> Start Running On:
>o  Any Host in Cluster  <== This option got selected
>o  Specific Host(s)   <== *I want this option to select.*
> 
> Please help me to bind VM to specific Host via Python SDK
> 

The Vm.host attribute is used only to indicate in what host is the VM
currently running.

To pin the VM to a set of hosts you have to use Vm.placement_policy, as
described here:


http://ovirt.github.io/ovirt-engine-api-model/4.1/#types/vm/attributes/placement_policy

With the Python SDK it should be something like this:

  vm = vms_service.add(
vm=types.Vm(
  ...
  placement_policy=types.PlacementPolicy(
hosts=[
  types.Host(name='host-01')
]
  )
)
  )
___
Users mailing list
Users@ovirt.org
http://lists.ovirt.org/mailman/listinfo/users


Re: [ovirt-users] Python-SDK4: How to list VM user sessions?

2017-04-10 Thread Juan Hernández
On 04/10/2017 05:38 PM, Giorgio Biacchi wrote:
> Hi,
> I'm taking over Giulio because he's not at work now. I'm starting to
> understand what's happening because we have not that users (and many
> others) in the users tab in the admin portal.
> 
> We have heavily modified the paradigm of ovirt, VM are bound to thin
> clients and not to users, this because we want to reproduce a
> lab/classroom environment and we don't use the user portal. We wrote an
> alternative administration portal where we define classrooms, thin
> clients and associations between clients and VMs.
> 
> Windows VMs are joined to a AD domain and linux VMs are joined to IPA,
> home dirs are remotely mounted upon user login.
> 
> So there's no need to have all that users (over 31000) in the admin
> portal because they have no permission on any VM, they can login from
> any client to the VM bound to that client.
> 
> In the admin portal, if I go to a VM with a logged in user in the "Guest
> info" tab I can see which user is logged in because, I think, the guest
> agents are aware of the logged in username, but there's no "user object"
> in the engine when I try to get that information via API.
> 
> Thanks for your time and patience..
> 
> Regards,
> Giorgio
> 

OK, that makes sense. I think this is a bug in the server then. If the
users are not oVirt users we should just not report them, or maybe
report just the user name and domain, if available. But returning 404
and failing in that case isn't correct, in my opinion. I have opened the
following bug to track this issue:

  Don't fail with 404 if session user doesn't exist in the database
  https://bugzilla.redhat.com/1440861

> On 04/10/2017 01:18 PM, Juan Hernández wrote:
>> On 04/10/2017 11:10 AM, Giulio Casella wrote:
>>> On 07/04/2017 16:00, Juan Hernández wrote:
>>>> I have been trying to reproduce this and I wasn't able. In theory the
>>>> 404 error that you get should only happen if the virtual machine
>>>> doesn't
>>>> exist, but that isn't the case.
>>>>
>>>> Can you check the server.log file and share the complete stack traces
>>>> that should appear after the "HTTP 404 Not Found" message?
>>>>
>>>
>>> No problem, find attached a snippet of server.log.
>>>
>>> Bye,
>>> Giulio
>>>
>>
>> Thanks, that helps. What the engine isn't finding is the user, not the
>> virtual machine. Can you provide more information about that user? I
>> mean, take the virtual machine and find via the GUI which user is using
>> it. Then go to https://.../ovirt-engine/api/users and find that user.
>> Share the definition of that user that you get there, if possible.
>>
>>>> On 03/31/2017 10:25 AM, Giulio Casella wrote:
>>>>> On 30/03/2017 20:05, Juan Hernández wrote:
>>>>>> On 03/30/2017 01:01 PM, Giulio Casella wrote:
>>>>>>> Hi,
>>>>>>> I'm trying to obtain a list of users connected to a VM, using
>>>>>>> python SDK
>>>>>>> v4.
>>>>>>> Here's what I'm doing:
>>>>>>>
>>>>>>> vm = vms_service.list(search="name=vmname")[0]
>>>>>>> vm_service = vms_service.vm_service(vm.id)
>>>>>>> sessions = vm_service.sessions_service().list()
>>>>>>>
>>>>>>> But "sessions" is None.
>>>>>>>
>>>>>>> Same result using:
>>>>>>>
>>>>>>> s = connection.follow_link(vm.sessions)
>>>>>>>
>>>>>>> "s" is None.
>>>>>>>
>>>>>>> I tried also using curl, and if I connect to:
>>>>>>>
>>>>>>> https://my.ovirt.host/ovirt-engine/api/v4/vms//sessions
>>>>>>>
>>>>>>> I get a beautiful 404.
>>>>>>>
>>>>>>> Also using v3 of python SDK I obtain the same behaviour.
>>>>>>>
>>>>>>> So I suspect that retrieving user sessions via API is not
>>>>>>> implemented,
>>>>>>> is it? If not, what I'm doing wrong?
>>>>>>>
>>>>>>> I'm using RHV 4.0.6.3-0.1.el7ev
>>>>>>>
>>>>>>> Thanks in advance,
>>>>>>> Giulio
>>>>>>>
>>>>>>
>>>>>> Giulio, you should never get a 404 error from that URL, unless the
>>&g

Re: [ovirt-users] Python-SDK4: How to list VM user sessions?

2017-04-10 Thread Juan Hernández
On 04/10/2017 11:10 AM, Giulio Casella wrote:
> On 07/04/2017 16:00, Juan Hernández wrote:
>> I have been trying to reproduce this and I wasn't able. In theory the
>> 404 error that you get should only happen if the virtual machine doesn't
>> exist, but that isn't the case.
>>
>> Can you check the server.log file and share the complete stack traces
>> that should appear after the "HTTP 404 Not Found" message?
>>
> 
> No problem, find attached a snippet of server.log.
> 
> Bye,
> Giulio
> 

Thanks, that helps. What the engine isn't finding is the user, not the
virtual machine. Can you provide more information about that user? I
mean, take the virtual machine and find via the GUI which user is using
it. Then go to https://.../ovirt-engine/api/users and find that user.
Share the definition of that user that you get there, if possible.

>> On 03/31/2017 10:25 AM, Giulio Casella wrote:
>>> On 30/03/2017 20:05, Juan Hernández wrote:
>>>> On 03/30/2017 01:01 PM, Giulio Casella wrote:
>>>>> Hi,
>>>>> I'm trying to obtain a list of users connected to a VM, using
>>>>> python SDK
>>>>> v4.
>>>>> Here's what I'm doing:
>>>>>
>>>>> vm = vms_service.list(search="name=vmname")[0]
>>>>> vm_service = vms_service.vm_service(vm.id)
>>>>> sessions = vm_service.sessions_service().list()
>>>>>
>>>>> But "sessions" is None.
>>>>>
>>>>> Same result using:
>>>>>
>>>>> s = connection.follow_link(vm.sessions)
>>>>>
>>>>> "s" is None.
>>>>>
>>>>> I tried also using curl, and if I connect to:
>>>>>
>>>>> https://my.ovirt.host/ovirt-engine/api/v4/vms//sessions
>>>>>
>>>>> I get a beautiful 404.
>>>>>
>>>>> Also using v3 of python SDK I obtain the same behaviour.
>>>>>
>>>>> So I suspect that retrieving user sessions via API is not implemented,
>>>>> is it? If not, what I'm doing wrong?
>>>>>
>>>>> I'm using RHV 4.0.6.3-0.1.el7ev
>>>>>
>>>>> Thanks in advance,
>>>>> Giulio
>>>>>
>>>>
>>>> Giulio, you should never get a 404 error from that URL, unless the
>>>> virtual doesn't exist or isn't visible for you. What user name are you
>>>> to create the SDK connection? An administrator or a regular user?
>>>>
>>>
>>> I tried with a regular domain user (with superuser role assigned) and
>>> admin@internal, with same result.
>>>
>>>> Also, please check the /var/log/ovirt-engine/server.log and
>>>> /var/log/ovirt-engine/engine.log when you send that request. Do you see
>>>> there something relevant?
>>>
>>> server.log reports:
>>>
>>> 2017-03-31 10:03:11,346 ERROR [org.jboss.resteasy.resteasy_jaxrs.i18n]
>>> (default task-33) RESTEASY002010: Failed to execute:
>>> javax.ws.rs.WebApplicationException: HTTP 404 Not Found
>>>
>>> (no surprise here, same message obtained by curl).
>>>
>>> engine.log is full of:
>>>
>>> ERROR [org.ovirt.engine.core.aaa.filters.SsoRestApiAuthFilter] (default
>>> task-7) [] Cannot authenticate using authentication Headers:
>>> invalid_grant: The provided authorization grant for the auth code has
>>> expired
>>>
>>> (indipendently of my request)
>>>
>>> It's quite strange I can perform almost every other operation (e.g.
>>> getting other VM parameters, running methods, etc.)
>>>
>>>
>>>>
>>>> Finally, please run your script with the 'debug=True' option in the
>>>> connection, and with a log file, like here:
>>>>
>>>>
>>>> https://github.com/oVirt/ovirt-engine-sdk/blob/master/sdk/examples/list_vms.py#L20-L37
>>>>
>>>>
>>>>
>>>> Then share that log file so that we can check what the server is
>>>> returning exactly. Make sure to remove your password from that log file
>>>> before sharing it.
>>>>
>>> Find attached produced log (passwords purged).
>>>
>>> BTW: VM is a Fedora 24, with guest agents correctly installed (I can see
>>> user sessions in admin portal and in postgresql DB).
>>>
>>> Thanks,
>>> Giulio
>>>
>>>
>>>
>>> ___
>>> Users mailing list
>>> Users@ovirt.org
>>> http://lists.ovirt.org/mailman/listinfo/users
>>>
>>
> 

___
Users mailing list
Users@ovirt.org
http://lists.ovirt.org/mailman/listinfo/users


Re: [ovirt-users] [Ovirt 4.0 Python SDK] Host fail to move in Maintenance State

2017-04-10 Thread Juan Hernández
On 04/07/2017 12:06 PM, TranceWorldLogic . wrote:
> Hi,
> 
> I was trying to deactivate host via python SDK but found that host is
> not moving in Maintenance State.
> 
> In this scenario, I found that I have one additional network added in
> cluster but not setup on Host.
> Hence it retrying in background for network sync.
> Because of this I suspect host is fail to move in maintenance state.
> 
> Can someone help me how to force via python API to deactivate host ?
> Or
> Can I stop background sync of host ?
> 
> Thanks,
> ~Rohit
> 

As far as I know there is no way to "force" moving the host to
maintenance, at least not with the API. I'd suggest that you check the
logs (/var/log/ovirt-engine/engine.log and
/var/log/ovirt-engine/server.log) and see if there is some relevant
message when you try that. If so, share those messages.

___
Users mailing list
Users@ovirt.org
http://lists.ovirt.org/mailman/listinfo/users


Re: [ovirt-users] JavaAPI exporting VM

2017-04-07 Thread Juan Hernández
On 04/07/2017 03:04 PM, David David wrote:
> Hello.
> 
> Can't reexport a VM if this VM is already present in the export domain
> 
> With Java api:
> 
> *VM vm = api.getVMs().get("vm01");
> 
> StorageDomain exportDomain = api.getStorageDomains().get("export");   *
>  
> *Action act = vm.exportVm(new Action() {
> {
> setExclusive(True);
> setDiscardSnapshots(True);
> setStorageDomain(exportDomain);
> }
> });*
> 
> And following error is returned:
> 
> Exception in thread "main"
> code  : 409
> reason: Conflict
> detail: Cannot export VM. VM with the same identifier already exists.
> at org.ovirt.engine.sdk.web.HttpProxy.execute(HttpProxy.java:120)
> at
> org.ovirt.engine.sdk.web.HttpProxyBroker.add(HttpProxyBroker.java:209)
> at
> org.ovirt.engine.sdk.web.HttpProxyBroker.action(HttpProxyBroker.java:153)
> at org.ovirt.engine.sdk.decorators.VM.exportVm(VM.java:784)
> 

That should have worked. What version of the SDK and what version of the
engine are you using? Can you run the example with debug model enabled
and share the debug output?

Also, are you completely sure you actual compiled and run that versoin
of the code? I ask because it uses "True" instead of "true", which
should fail to compile.

I see that you are using version 3.6 of the Java SDK. That version of
the SDK and the version of the API it uses (version 3) are deprecated
since version 4 of the engine. Please consider using version 4 of the
SDK instead. With version 4 of the SDK you can do that as follows:

---8<---
package org.ovirt.engine.sdk4.examples;

import static org.ovirt.engine.sdk4.ConnectionBuilder.connection;
import static org.ovirt.engine.sdk4.builders.Builders.storageDomain;

import org.ovirt.engine.sdk4.Connection;
import org.ovirt.engine.sdk4.services.SystemService;
import org.ovirt.engine.sdk4.services.VmService;
import org.ovirt.engine.sdk4.services.VmsService;
import org.ovirt.engine.sdk4.types.Vm;

// This example shows how to export a virtual machine.
public class ExportVm {
public static void main(String[] args) throws Exception {
// Create the connection to the server:
Connection connection = connection()
.url("https://engine40.local/ovirt-engine/api;)
.user("admin@internal")
.password("redhat123")
//.trustStoreFile("truststore.jks")
.insecure(true)
.build();

// Get the reference to the root of the services tree:
SystemService systemService = connection.systemService();

// Find the virtual machine:
VmsService vmsService = systemService.vmsService();
Vm vm = vmsService.list()
.search("name=myvm")
.send()
.vms()
.get(0);

// Export the virtual machine:
VmService vmService = vmsService.vmService(vm.id());
vmService.export()
.exclusive(true)
.discardSnapshots(true)
.storageDomain(
storageDomain()
.name("myexport")
)
.send();

// Close the connection to the server:
connection.close();
}
}
--->8---

The documentation of version 4 of the SDK is available here:

  https://github.com/oVirt/ovirt-engine-sdk-java/tree/master/sdk

https://github.com/oVirt/ovirt-engine-sdk-java/tree/master/sdk/src/test/java/org/ovirt/engine/sdk4/examples
  http://www.javadoc.io/doc/org.ovirt.engine.api/sdk/4.1.3

___
Users mailing list
Users@ovirt.org
http://lists.ovirt.org/mailman/listinfo/users


Re: [ovirt-users] Python-SDK4: How to list VM user sessions?

2017-04-07 Thread Juan Hernández
I have been trying to reproduce this and I wasn't able. In theory the
404 error that you get should only happen if the virtual machine doesn't
exist, but that isn't the case.

Can you check the server.log file and share the complete stack traces
that should appear after the "HTTP 404 Not Found" message?

On 03/31/2017 10:25 AM, Giulio Casella wrote:
> On 30/03/2017 20:05, Juan Hernández wrote:
>> On 03/30/2017 01:01 PM, Giulio Casella wrote:
>>> Hi,
>>> I'm trying to obtain a list of users connected to a VM, using python SDK
>>> v4.
>>> Here's what I'm doing:
>>>
>>> vm = vms_service.list(search="name=vmname")[0]
>>> vm_service = vms_service.vm_service(vm.id)
>>> sessions = vm_service.sessions_service().list()
>>>
>>> But "sessions" is None.
>>>
>>> Same result using:
>>>
>>> s = connection.follow_link(vm.sessions)
>>>
>>> "s" is None.
>>>
>>> I tried also using curl, and if I connect to:
>>>
>>> https://my.ovirt.host/ovirt-engine/api/v4/vms//sessions
>>>
>>> I get a beautiful 404.
>>>
>>> Also using v3 of python SDK I obtain the same behaviour.
>>>
>>> So I suspect that retrieving user sessions via API is not implemented,
>>> is it? If not, what I'm doing wrong?
>>>
>>> I'm using RHV 4.0.6.3-0.1.el7ev
>>>
>>> Thanks in advance,
>>> Giulio
>>>
>>
>> Giulio, you should never get a 404 error from that URL, unless the
>> virtual doesn't exist or isn't visible for you. What user name are you
>> to create the SDK connection? An administrator or a regular user?
>>
> 
> I tried with a regular domain user (with superuser role assigned) and
> admin@internal, with same result.
> 
>> Also, please check the /var/log/ovirt-engine/server.log and
>> /var/log/ovirt-engine/engine.log when you send that request. Do you see
>> there something relevant?
> 
> server.log reports:
> 
> 2017-03-31 10:03:11,346 ERROR [org.jboss.resteasy.resteasy_jaxrs.i18n]
> (default task-33) RESTEASY002010: Failed to execute:
> javax.ws.rs.WebApplicationException: HTTP 404 Not Found
> 
> (no surprise here, same message obtained by curl).
> 
> engine.log is full of:
> 
> ERROR [org.ovirt.engine.core.aaa.filters.SsoRestApiAuthFilter] (default
> task-7) [] Cannot authenticate using authentication Headers:
> invalid_grant: The provided authorization grant for the auth code has
> expired
> 
> (indipendently of my request)
> 
> It's quite strange I can perform almost every other operation (e.g.
> getting other VM parameters, running methods, etc.)
> 
> 
>>
>> Finally, please run your script with the 'debug=True' option in the
>> connection, and with a log file, like here:
>>
>>
>> https://github.com/oVirt/ovirt-engine-sdk/blob/master/sdk/examples/list_vms.py#L20-L37
>>
>>
>> Then share that log file so that we can check what the server is
>> returning exactly. Make sure to remove your password from that log file
>> before sharing it.
>>
> Find attached produced log (passwords purged).
> 
> BTW: VM is a Fedora 24, with guest agents correctly installed (I can see
> user sessions in admin portal and in postgresql DB).
> 
> Thanks,
> Giulio
> 
> 
> 
> ___
> Users mailing list
> Users@ovirt.org
> http://lists.ovirt.org/mailman/listinfo/users
> 

___
Users mailing list
Users@ovirt.org
http://lists.ovirt.org/mailman/listinfo/users


Re: [ovirt-users] Python-SDK4: Listing template by ID throws exception

2017-04-04 Thread Juan Hernández
On 04/04/2017 10:59 AM, nico...@devels.es wrote:
> Hi,
> 
> I'm using ovirt-engine-sdk-python 4.1.3 (ovirt ver is 4.1.0), and in a
> snippet I'm trying to get a template by its id. For that, I did this:
> 
> conn = ovirtsdk4.Connection(...)
> sys_serv = conn.system_service()
> tpl_serv = sys_serv.templates_service()
> 
> t = tpl_serv.list(search='id=fedff75f-635f-4790-9bbf-2ac389e14f93')
> 
> And it throws:
> 
> Error: Fault reason is "Operation Failed". Fault detail is
> "statementcallback; bad sql grammar [select * from (select * from vm
> templates view where ( vmt guid in (select distinct vm templates storage
> domain.vmt guid from  vm templates storage domain   where  (  vm
> templates storage domain.cluster name ilike
> '%id=fedff75f-635f-4790-9bbf-2ac389e14f93%' or  vm templates storage
> domain.description ilike '%id=fedff75f-635f-4790-9bbf-2ac389e14f93%' or 
> vm templates storage domain.free text comment ilike
> '%id=fedff75f-635f-4790-9bbf-2ac389e14f93%' or  vm templates storage
> domain.name ilike '%id=fedff75f-635f-4790-9bbf-2ac389e14f93%' or  vm
> templates storage domain.quota name ilike
> '%id=fedff75f-635f-4790-9bbf-2ac389e14f93%' or  vm templates storage
> domain.storage pool name ilike
> '%id=fedff75f-635f-4790-9bbf-2ac389e14f93%' or  vm templates storage
> domain.template version name,template version number ilike
> '%id=fedff75f-635f-4790-9bbf-2ac389e14f93%' ) ))  order by name asc ) as
> t1 offset (1 -1) limit 2147483647]; nested exception is
> org.postgresql.util.psqlexception: error: argument of or must be type
> boolean, not type character varying
>   position: 737". HTTP response code is 400.
> 
> I'm sure this template exists and it has this ID. If I search in the
> webadmin by this ID, the search seems to hang and never returns anything
> (I have to stop it by pressing the 'X' button).
> 
> Am I using this call improperly?
> 
> Thanks.

This should work, or at least it shouldn't generate that error. But it
isn't the best way to get a template (or any object) if you already know
the id. It is better to do this:

  conn = ovirtsdk4.Connection(...)
  sys_serv = conn.system_service()
  tpls_serv = sys_serv.templates_service()
  tpl_serv =
tpls_serv.tmeplate_service('fedff75f-635f-4790-9bbf-2ac389e14f93')
  tpl = tpl_serv.get()


___
Users mailing list
Users@ovirt.org
http://lists.ovirt.org/mailman/listinfo/users


Re: [ovirt-users] Python-SDK4: How to list VM user sessions?

2017-03-30 Thread Juan Hernández
On 03/30/2017 01:01 PM, Giulio Casella wrote:
> Hi,
> I'm trying to obtain a list of users connected to a VM, using python SDK
> v4.
> Here's what I'm doing:
> 
> vm = vms_service.list(search="name=vmname")[0]
> vm_service = vms_service.vm_service(vm.id)
> sessions = vm_service.sessions_service().list()
> 
> But "sessions" is None.
> 
> Same result using:
> 
> s = connection.follow_link(vm.sessions)
> 
> "s" is None.
> 
> I tried also using curl, and if I connect to:
> 
> https://my.ovirt.host/ovirt-engine/api/v4/vms//sessions
> 
> I get a beautiful 404.
> 
> Also using v3 of python SDK I obtain the same behaviour.
> 
> So I suspect that retrieving user sessions via API is not implemented,
> is it? If not, what I'm doing wrong?
> 
> I'm using RHV 4.0.6.3-0.1.el7ev
> 
> Thanks in advance,
> Giulio
> 

Giulio, you should never get a 404 error from that URL, unless the
virtual doesn't exist or isn't visible for you. What user name are you
to create the SDK connection? An administrator or a regular user?

Also, please check the /var/log/ovirt-engine/server.log and
/var/log/ovirt-engine/engine.log when you send that request. Do you see
there something relevant?

Finally, please run your script with the 'debug=True' option in the
connection, and with a log file, like here:


https://github.com/oVirt/ovirt-engine-sdk/blob/master/sdk/examples/list_vms.py#L20-L37

Then share that log file so that we can check what the server is
returning exactly. Make sure to remove your password from that log file
before sharing it.




___
Users mailing list
Users@ovirt.org
http://lists.ovirt.org/mailman/listinfo/users


Re: [ovirt-users] Python-SDK4: How to list user permissions?

2017-03-29 Thread Juan Hernández
On 03/29/2017 01:05 PM, nico...@devels.es wrote:
> Hi,
> 
> I'm trying to get a user's list of permissions, i.e., list all
> permissions a user have on VMs and VmPools.
> 
> In SDK3 that was easy as I could run (being 'u' a User object):
> 
> for perm in u.permissions.list():
> vm = perm.get_vm()
> vmpool = perm.get_vmpool()
> 
> if vm or vmpool:
> print "User has some permissions!"
> 
> In SDK4 I cannot reproduce the same logic. u.permissions returns an
> empty list ([]).
> 
> What I have so far is something like this:
> 
> for u in users_serv.list():
>  if u.user_name == 'admin@internal':
>  continue
> 
>  vms_service = sys_serv.vms_service()
>  for vm in vms_service.list():
>  vms = vms_service.vm_service(id=vm.id)
>  ps = vms.permissions_service()
>  for perm in ps.list():
>  perm_service = ps.permission_service(id=perm.id)
>  getperm = perm_service.get()
>  if getperm.user.user_name == u.user_name:
>  print "Permission for %s" % (u.user_name)
>  if getperm.vm:
>  print "VM: %s" % (getperm.vm.id)
>  if getperm.vm_pool:
>  print "VmPool: %s" % (getperm.vm_pool.id)
> 
> However, this seems a bit overkill. We have nearly 850 VMs and for a
> single user this takes about 25 minutes to run. Additionally, it doesn't
> seem to return any permission, although I know this user has some
> permissions over 2 VMs (not sure where is it messed up).
> 
> I also tried using the system_service.permissions_service() but it seems
> to return only the global permissions.
> 
> Is there an easier way to do this?
> 
> Thanks!

Version 4 of the SDK makes a clear distinction between what are pure
containers of data (like the User class) and what are services (like the
UsersService class). Therefore when you call 'u.permissions' in version
4 of the SD you get nothing, because the object that you retrieved
previously doesn't contain the permissions, only a link. That is exactly
how the API behaves. When you do this:

  GET /ovirt-engine/api/users/{user:id}

You only get the data of the user, and some links to other related data,
like the permissions:

  
myuser
...

  

In version 4 of the SDK the simple way to follow the link is to use the
Connection.follow_link method. So, you need something like this:

---8<---
# Find the user:
users_service = connection.system_service().users_service()
user = users_service.list(search='name=myuser')[0]

# Follow the link to the permissions of the user:
perms = connection.follow_link(user.permissions)
for perm in perms:
if perm.vm or perm.vm_pool:
print "User has some permissions!"
--->8---

___
Users mailing list
Users@ovirt.org
http://lists.ovirt.org/mailman/listinfo/users


Re: [ovirt-users] ovirt-shell backup

2017-03-23 Thread Juan Hernández
On 03/23/2017 02:40 PM, Marcin Kruk wrote:
> Hello is it possible to execute below actions from the ovirth-shell:
> 1. Make snapshot
> ( ovirt-shell -E 'add snapshot --parent-vm-name  --description
>  )
> 2. Make clone from snaphot above
> ( ? )
> 3. Export clone
> ( ? )
> 

The ovirt-shell tools is deprecated since version 4.0 of oVirt, and will
be removed in version 4.2. I suggest that you avoid using it, and
consider using the Ansible modules:

  http://docs.ansible.com/ansible/list_of_cloud_modules.html#ovirt

Or one of the SDKs:

  Python: https://github.com/oVirt/ovirt-engine-sdk
  Ruby: https://github.com/oVirt/ovirt-engine-sdk-ruby
  Java: https://github.com/oVirt/ovirt-engine-sdk-java

In particular these SDK examples may be of interest:


https://github.com/oVirt/ovirt-engine-sdk/blob/master/sdk/examples/add_vm_snapshot.py


https://github.com/oVirt/ovirt-engine-sdk/blob/master/sdk/examples/clone_vm_from_snapshot.py

If you still want to use ovirt-shell, then it should be something like this:

  add snapshot --parent-vm-name myvm --description mysnap

That will return the snapshot data, including the id, take note of it,
and then:

  add vm --name mynewvm --snapshots-snapshot
"snapshot.id=the_id_of_the_snapshot" --cluster-name mycluster

___
Users mailing list
Users@ovirt.org
http://lists.ovirt.org/mailman/listinfo/users


Re: [ovirt-users] How to set priority for HA VM via Python SDK ?

2017-03-23 Thread Juan Hernández
On 03/23/2017 08:59 AM, TranceWorldLogic . wrote:
> Hi,
> 
> I want to set priority of Highly Available VM as High via python SDK.
> I provided information as shown below:
> 
> vm = self.vms_service.add(
>   vm = types.Vm (
> high_availability = types.HighAvailability(
> enabled = True,
>priority = 1,
> ),
> ),
> )
> 
> As see above priority we have to provide as number but in GUI we can
> choose drop down menu as ("LOW", "MID" and "HIGH").
> I wan to set priority as "HIGH", which integer value I have to set in
> priority ?
> I tried with 1 and 3 it shows "LOW" in both cases.
> 
> Please help me.
> 
> Thanks,
> ~Rohit
> 

The priority is a value between 0 and 100, and the mapping to the text
displayed in the GUI is the following:

  0..25 -> LOW
  26..74 -> MID
  75..100 -> HIGH

In the reverse direction:

  LOW -> 1
  MID -> 50
  HIGH -> 100

So if you want to set it to HIGH use 'priority = 100'.

___
Users mailing list
Users@ovirt.org
http://lists.ovirt.org/mailman/listinfo/users


Re: [ovirt-users] Python-SDK: ovirtsdk4.Connection object autologout?

2017-03-22 Thread Juan Hernández
On 03/22/2017 01:50 PM, Juan Hernández wrote:
> On 03/22/2017 01:10 PM, nico...@devels.es wrote:
>> Hi,
>>
>> We've recently upgraded from oVirt 4.0.x to 4.1.0 and it seems that the
>> behavior of a script we wrote in Python-SDK has changed slightly. We
>> have a script that needs to be executed forever (daemon mode). This
>> daemon creates an ovirtsdk4.Connection object and uses the same
>> Connection object all the time.
>>
>> conn = sdk.Connection(
>>   url=URI,
>>   username=USERNAME,
>>   password=PASSWORD,
>>   ca_file=CAFILE
>> )
>>
>> Between iterations we have ~5 minutes delays which we accomplish with a
>> time.sleep(...) call.
>>
>> After some of these iterations (5 or 6), when trying to perform an
>> operation on the Connection object (in this case, listing all SDs):
>>
>> try:
>> sys_serv = conn.system_service()
>> sd_serv = sys_serv.storage_domains_service()
>> storages = sd_serv.list(search=sd_search_query)
>> except Error, e:
>> log('ERR: Error getting storage domains: %s' % (e))
>>
>> We start getting exceptions (i.e., the sd_serv.list() call throwing an
>> Error exception) with this message:
>>
>> ERR: Error getting storage domains: HTTP response code is 401.
>>
>> I believe this has something to do with the Connection object expiring
>> (even if it's not idle more than 5 minutes at any time). Is there a way
>> to "refresh" the Connection object so it doesn't auto-logout (assuming
>> this is the actual problem)?
>>
>> As I said, this started happening as of oVirt 4.1.0.
>> ovirt-engine-sdk-python version is 4.1.1.
>>
>> Any ideas?
>>
> 
> This sound like this bug, opened yesterday:
> 
>   SSO token used for the API expires when running only queries
>   https://bugzilla.redhat.com/1434605
> 
> But I thought the same happened in 4.0. Can you confirm that you don't
> see this problem in 4.0?
> 
> Open possible workaround is to force a refresh of the backend session
> sending an external event, like in this example:
> 
> 
> https://github.com/oVirt/ovirt-engine-sdk/blob/master/sdk/examples/vm_backup.py#L112-L131
> 
> I also think that we need to modify the SDKs so that they detect expired
> SSO tokens and renew them automatically. I will open another bug for that.
> 

Here is the bug for adding automatic SSO token renew to the SDK, in case
you want to follow/vote it:

  Implement automatic SSO token renew
  https://bugzilla.redhat.com/1434830


___
Users mailing list
Users@ovirt.org
http://lists.ovirt.org/mailman/listinfo/users


Re: [ovirt-users] Python-SDK: ovirtsdk4.Connection object autologout?

2017-03-22 Thread Juan Hernández
On 03/22/2017 01:10 PM, nico...@devels.es wrote:
> Hi,
> 
> We've recently upgraded from oVirt 4.0.x to 4.1.0 and it seems that the
> behavior of a script we wrote in Python-SDK has changed slightly. We
> have a script that needs to be executed forever (daemon mode). This
> daemon creates an ovirtsdk4.Connection object and uses the same
> Connection object all the time.
> 
> conn = sdk.Connection(
>   url=URI,
>   username=USERNAME,
>   password=PASSWORD,
>   ca_file=CAFILE
> )
> 
> Between iterations we have ~5 minutes delays which we accomplish with a
> time.sleep(...) call.
> 
> After some of these iterations (5 or 6), when trying to perform an
> operation on the Connection object (in this case, listing all SDs):
> 
> try:
> sys_serv = conn.system_service()
> sd_serv = sys_serv.storage_domains_service()
> storages = sd_serv.list(search=sd_search_query)
> except Error, e:
> log('ERR: Error getting storage domains: %s' % (e))
> 
> We start getting exceptions (i.e., the sd_serv.list() call throwing an
> Error exception) with this message:
> 
> ERR: Error getting storage domains: HTTP response code is 401.
> 
> I believe this has something to do with the Connection object expiring
> (even if it's not idle more than 5 minutes at any time). Is there a way
> to "refresh" the Connection object so it doesn't auto-logout (assuming
> this is the actual problem)?
> 
> As I said, this started happening as of oVirt 4.1.0.
> ovirt-engine-sdk-python version is 4.1.1.
> 
> Any ideas?
> 

This sound like this bug, opened yesterday:

  SSO token used for the API expires when running only queries
  https://bugzilla.redhat.com/1434605

But I thought the same happened in 4.0. Can you confirm that you don't
see this problem in 4.0?

Open possible workaround is to force a refresh of the backend session
sending an external event, like in this example:


https://github.com/oVirt/ovirt-engine-sdk/blob/master/sdk/examples/vm_backup.py#L112-L131

I also think that we need to modify the SDKs so that they detect expired
SSO tokens and renew them automatically. I will open another bug for that.

___
Users mailing list
Users@ovirt.org
http://lists.ovirt.org/mailman/listinfo/users


Re: [ovirt-users] ovirt-shell -- cannot even get started

2017-03-16 Thread Juan Hernández
On 03/16/2017 09:48 PM, Phil Meyer wrote:
> This is either some very obscure syntax, or it may not be working.
> 
> Difficult to tell, since the error message seems to be generic:
> 
> ...
> 
>    ERROR
> =
> "https://engine-tst/ovirt-engine/api; is invalid url format, valid
> format is http[s]://server:port/path, where path is usually
> "ovirt-engine/api" or, for older versions of the engine, just "api".
>  
> 
> ...
> 
> That error is reported no matter where it is run from, and no matter what
> 
> combination of manual or automated interaction is used.
> 
> 
> It should not be this hard.
> 
> 42 different combinations were tried.
> 
> 
> In one instance when using localhost as the hostname, it actually asked for
> 
> the certificate first, and then gave me the same error as above.
> 
> 
> Lets just say that the command line was very familiar to me when Larry Wall
> 
> wrote the Configure script (that was before the GNU configure scripts).
> 
> 
> A strait up actual example that works would be nice, or an explanation of
> 
> prerequisites, if there are any.  None are stated.
> 
> 
> There is lots of mention of port numbers, but no actual port numbers
> suggested.
> 
> Does not the ovirt-shell talk to the web server at port 443 if https is
> specified?
> 
> 
> The lsof command does not show any listeners that seem likely as a cli
> interface:
> 
> -> sudo lsof  -i | grep -i listen
> systemd   1root   42u  IPv6   9030  0t0  TCP
> *:sunrpc (LISTEN)
> systemd   1root   43u  IPv4   9031  0t0  TCP
> *:sunrpc (LISTEN)
> ovirt-ima   582root5u  IPv4   9196  0t0  TCP *:54323
> (LISTEN)
> ovirt-web   954   ovirt4u  IPv4  14915  0t0  TCP
> *:synchronet-db (LISTEN)
> httpd   959root4u  IPv6  18622  0t0  TCP *:http
> (LISTEN)
> httpd   959root6u  IPv6  18630  0t0  TCP *:https
> (LISTEN)
> sshd962 ovirt-vmconsole3u  IPv4  17902  0t0  TCP
> *:EtherNet/IP-1 (LISTEN)
> sshd962 ovirt-vmconsole4u  IPv6  17904  0t0  TCP
> *:EtherNet/IP-1 (LISTEN)
> sshd   1048root3u  IPv4  19474  0t0  TCP *:ssh
> (LISTEN)
> sshd   1048root4u  IPv6  19477  0t0  TCP *:ssh
> (LISTEN)
> postgres   1237postgres3u  IPv4  19552  0t0  TCP
> *:postgres (LISTEN)
> postgres   1237postgres4u  IPv6  19553  0t0  TCP
> *:postgres (LISTEN)
> java   3042   ovirt  371u  IPv6  20711  0t0  TCP
> localhost:8702 (LISTEN)
> java   3042   ovirt  389u  IPv6  24722  0t0  TCP
> localhost:8706 (LISTEN)
> 
> 
> And yes, the unfamiliar ones were tried. :)
> 
> 
> The last straw was when a packet sniffer failed to capture ANY traffic
> related to these
> 
> attempts.  Apparently the ovirt-shell command fails before even
> attempting a connection.
> 

This is a bug in the CLI:

  Invalid URL format when there are no dots in the host name
  https://bugzilla.redhat.com/1186365

The problem is that the CLI tries to verify the validity of the URL, and
it expects at least one dot in the host name:

  engine-tst.something

It was decided to not fix that bug because the CLI is deprecated since
version 4.0 of the engine, and will be removed in version 4.2.

As a workaround, try to use a fully qualified host name, which will most
probably include a dot anyhow. And you will need that fully qualified
host name anyhow, if you want to safely verify the certificate of the
server. See the bug for details. Alternatively you can use the IP
address directly.

As I said, the CLI is deprecated, so if you are starting from scratch,
I'd suggest you avoid it completely. Use one of the Ansible modules:

  https://docs.ansible.com/ansible/list_of_cloud_modules.html#ovirt

Or one of the SDKs:

  Python:
  https://github.com/oVirt/ovirt-engine-sdk/tree/master/sdk

  Ruby:
  https://github.com/oVirt/ovirt-engine-sdk-ruby/tree/master/sdk

  Java:
  https://github.com/oVirt/ovirt-engine-java/tree/master/sdk

___
Users mailing list
Users@ovirt.org
http://lists.ovirt.org/mailman/listinfo/users


Re: [ovirt-users] How to configure Cloud-init in Guest OS ?

2017-03-16 Thread Juan Hernández
On 03/16/2017 04:09 PM, TranceWorldLogic . wrote:
> Hi,
> 
> 
> I am trying to create file using same API, as shown below:
> --
> scontent="Hello World !!"
> 
> vm_service.start(
> use_cloud_init=True,
> vm = types.Vm(
> initialization=types.Initialization(
> cloud_init=types.CloudInit(
> files=[types.File(name="/root/hello.conf",
> content=scontent, type="PLAINTEXT")],
> ),
> ),
> ),
> )
> 
> 
> Can someone help me to understand ? why it is not working.
> Or Is that variable "cloud_init=" not handled in ovirt ?
> 

That may have been the initial design of the feature, but it doesn't
currently work. That 'files' element isn't used at all. The recommended
way to create a file is using the custom script, as explained in this
example:


https://github.com/oVirt/ovirt-engine-sdk/blob/master/sdk/examples/start_vm_with_cloud_init.py#L48-L57

The use of 'types.CloudInit' is also disencouraged, use directly the
attributes of 'types.Initialization', as explained here:


https://github.com/oVirt/ovirt-engine-sdk/blob/master/sdk/examples/start_vm_with_cloud_init.py#L59-L86

> 
> 
> On Thu, Mar 16, 2017 at 7:33 PM, Juan Hernández <jhern...@redhat.com
> <mailto:jhern...@redhat.com>> wrote:
> 
> On 03/16/2017 02:22 PM, TranceWorldLogic . wrote:
> > Hi,
> >
> > I am trying to use cloud-int to provide some text file in guest OS as
> > mention in below link. (tried using sdk)
> > But it is not working.
> > 
> http://www.ovirt.org/develop/release-management/features/cloud/cloud-init-integration/
> 
> <http://www.ovirt.org/develop/release-management/features/cloud/cloud-init-integration/>
> >
> 
> What SDK are you using? I guess that the Python SDK. Did you try this
> example:
> 
> 
> 
> https://github.com/oVirt/ovirt-engine-sdk/blob/master/sdk/examples/start_vm_with_cloud_init.py
> 
> <https://github.com/oVirt/ovirt-engine-sdk/blob/master/sdk/examples/start_vm_with_cloud_init.py>
> 
> > 1> Do I need to do some configure cloud-init in Guest OS ?
> > -> I hav just install cloud-init package in my 2 guest
> >   For centos 6.8 => yum install cloud-init
> >   For ubuntu 14.05 => apt-get install cloud-init
> >
> 
> That should be eough, at least in CentOS. Not sure about Ubuntu.
> 
> Note that you are using a quite old version of CentOS, so you may also
> be using an old or buggy version of cloud-init. Did you try with latest
> CentOS 7?
> 
> > 2> Do cloud-init permanently write network configuration in ifconfig
> > file(Centos) or interface file (ubuntu)?
> >
> 
> It does, in CentOS. Not sure about Ubuntu.
> 
> 
> 
> 
> ___
> Users mailing list
> Users@ovirt.org
> http://lists.ovirt.org/mailman/listinfo/users
> 

___
Users mailing list
Users@ovirt.org
http://lists.ovirt.org/mailman/listinfo/users


Re: [ovirt-users] How to configure Cloud-init in Guest OS ?

2017-03-16 Thread Juan Hernández
On 03/16/2017 02:22 PM, TranceWorldLogic . wrote:
> Hi,
> 
> I am trying to use cloud-int to provide some text file in guest OS as
> mention in below link. (tried using sdk)
> But it is not working.
> http://www.ovirt.org/develop/release-management/features/cloud/cloud-init-integration/
> 

What SDK are you using? I guess that the Python SDK. Did you try this
example:


https://github.com/oVirt/ovirt-engine-sdk/blob/master/sdk/examples/start_vm_with_cloud_init.py

> 1> Do I need to do some configure cloud-init in Guest OS ?
> -> I hav just install cloud-init package in my 2 guest
>   For centos 6.8 => yum install cloud-init
>   For ubuntu 14.05 => apt-get install cloud-init
> 

That should be eough, at least in CentOS. Not sure about Ubuntu.

Note that you are using a quite old version of CentOS, so you may also
be using an old or buggy version of cloud-init. Did you try with latest
CentOS 7?

> 2> Do cloud-init permanently write network configuration in ifconfig
> file(Centos) or interface file (ubuntu)?
> 

It does, in CentOS. Not sure about Ubuntu.

___
Users mailing list
Users@ovirt.org
http://lists.ovirt.org/mailman/listinfo/users


Re: [ovirt-users] cannot exceed maximum memory size

2017-03-09 Thread Juan Hernández
On 03/09/2017 04:00 PM, Jakub Niedermertl wrote:
> Based on the snipped provided at the beginning of the conversation I
> assume rest api v3 is used. I'm not sure, max memory property was
> backported there.
> 
> @Juan do we have some support for 4.1 changes in rest api v3?
> 
> In rest api v4 it's
> http://ovirt.github.io/ovirt-engine-api-model/4.1/#types/memory_policy/attributes/max
> .
> 
> 
> ...
> 
> amount in bytes
> ...
> 
> ...
> 
> 

Max memory is a version 4 feature, it isn't/won't be available in
version 3 of the API.

> 
> 
> On Thu, Mar 9, 2017 at 3:07 PM, Marcelo Leandro  wrote:
>> Thanks for reply Jakub Niedermertl,
>>
>>  I would like the explicitly specifying in my script , but i dont know
>> the parameters for use for max memory.
>> Can you help me ?
>>
>> Very Thanks.
>>
>> 2017-03-09 10:37 GMT-03:00 Jakub Niedermertl :
>>>
>>> Hi all,
>>>
>>> Since engine 4.1 there is new property of VMs/templates - max memory
>>> [1] that is required to be larger than (or equal to) memory size. The
>>> problem is probably caused by the fact that the specified memory (I
>>> assume that value of  `memo` is 20480MB) is larger that max memory
>>> that is implicitly copied from template (Blank in this case). I can
>>> see two possible solutions:
>>> * Explicitly specifying size of max memory in the script.
>>> * Increasing max memory in the template.
>>>
>>> Jakub
>>>
>>> [1]:
>>> http://www.ovirt.org/develop/release-management/features/engine/maximum-memory-size/
>>>
>>> On Thu, Mar 9, 2017 at 2:20 PM, Shahar Havivi  wrote:
 its not related to bug 1425089 (which is upgrading cluster issue) but
 its
 the same feature that cause this issue,
 Jakub what do we have bug on that issue?

 as for the default RAM limit you can find it via the engine-config tool:
 $ engine-config -g VM32BitMaxMemorySizeInMB
 $ engine-config -g VM64BitMaxMemorySizeInMB

 On Thu, Mar 9, 2017 at 2:44 PM, Maton, Brett 
 wrote:
>
> I have a similar problem creating VM's with the API, but no solution.
>
>   It seems that by default oVirt uses custom 'Instance Type' ( you can
> see
> it if you use the UI to create a VM ).
>   The default RAM limit for custom Instance Type is 4096MB.
>
>   I haven't found where you can change the settnigs for the custom
> instance type though.
>
>
>
> On 9 March 2017 at 11:52, Marcelo Leandro 
> wrote:
>>
>> can someone help me?
>>
>> 2017-03-07 16:25 GMT-03:00 Marcelo Leandro :
>>>
>>> Hello ,
>>>
>>> I am have an script that create VM , after upgrade to 4.1 I have this
>>> erro when trying create a new VM:
>>>
>>> detail: Cannot add VM. Memory size (20480MB) cannot exceed maximum
>>> memory size (4096MB).
>>>
>>> my commando fore create VM :
>>>
>>> api.vms.add(params.VM(name="teste", memory=memo , cpu=cpu,
>>> cluster=api.clusters.get(cluster),
>>> template=api.templates.get('Blank'),
>>> type_="server"))
>>>
>>> I dont how specific  the maximum memory size.
>>>
>>> Thanks
>>>
>>> Marcelo Leandro
>>
>>
>>
>> ___
>> Users mailing list
>> Users@ovirt.org
>> http://lists.ovirt.org/mailman/listinfo/users
>>
>
>
> ___
> Users mailing list
> Users@ovirt.org
> http://lists.ovirt.org/mailman/listinfo/users
>

>>
>>

___
Users mailing list
Users@ovirt.org
http://lists.ovirt.org/mailman/listinfo/users


Re: [ovirt-users] oVirt VM backup and restore

2017-03-09 Thread Juan Hernández
On 03/09/2017 02:10 PM, Nathanaël Blanchet wrote:
> 
> 
> Le 09/03/2017 à 12:10, Juan Hernández a écrit :
>> On 03/09/2017 11:57 AM, Gianluca Cecchi wrote:
>>> On Thu, Mar 9, 2017 at 11:39 AM, Nathanaël Blanchet <blanc...@abes.fr
>>> <mailto:blanc...@abes.fr>> wrote:
>>>
>>>
>>>
>>>  Le 09/03/2017 à 10:25, Gianluca Cecchi a écrit :
>>>>  On Wed, Mar 8, 2017 at 6:05 PM, Gianluca Cecchi
>>>>  <gianluca.cec...@gmail.com <mailto:gianluca.cec...@gmail.com>>
>>>> wrote:
>>>>
>>>>
>>>>
>>>>  NOTE: during the snapshot creation I see in web admin console
>>>>  the VM in paused state and also not responsive in both console
>>>>  and ssh session.
>>>>  After a couple of seconds it comes back and as a confirmation
>>>>  I see this in its messages:
>>>>
>>>>  Mar  8 17:38:57 T-ORACLE73 chronyd[616]: System clock wrong by
>>>>  19.077230 seconds, adjustment started
>>>>
>>>>  Is this expected?
>>>>
>>>>
>>>>
>>>>
>>>>  Possibly the default changed at some point in time, so that now it
>>>>  saves memory and so this implies pause of VM
>>>  Saving memory is essential in some apàplications like DB, so you
>>>  won't bypass vm pauses for such a stuff
>>>
>>>
>>> Yes, indeed, the important thing is to have an option so that you can
>>> set it True or False, depending on the VM you are saving, the
>>> application that is running isnide it and the way you want to do backup
>>> of the application.
>>> Nevertheless, RDBMS and also other applications often have some
>>> mechanism to be "frozen in a consistent state" so that you can save what
>>> you have on disk without need to save memory to have a consistent
>>> backup.
>>> Oracle for example has functionality to be put in "backup mode" where
>>> you issue "begin backup" before the snapshot and "end backup" right
>>> after snapshot completion.
>>> I see that POstgreSQL has similar functionality (not tested myself):
>>> https://www.postgresql.org/docs/9.4/static/continuous-archiving.html#BACKUP-LOWLEVEL-BASE-BACKUP
>>>
>>> and the same for other ones.
>>>
>>> Gianluca
>>>
>> Just wanted to add that freezing activity is not only important for
>> databases, but also for plain file systems. In order to do a consistent
>> backup it is important to freeze the file systems before creating a live
>> snapshot, and thaw it afterwards. oVirt does that automatically, but
>> only if the guest agent is installed and running. So, remember to have
>> the guest agent installed and running in the virtual machines that you
>> plan to backup using this mechanism.
> Very useful piece of information, so does that mean memory save feature
> not to be really useful? if so, it shouldn't be the default, so that vm
> never go into pause state unusefully.

I didn't mean that saving memory isn't useful. It is very useful, for
certain use cases. For the backup use case I think it is better to
disable it.

___
Users mailing list
Users@ovirt.org
http://lists.ovirt.org/mailman/listinfo/users


Re: [ovirt-users] oVirt VM backup and restore

2017-03-09 Thread Juan Hernández
On 03/09/2017 11:57 AM, Gianluca Cecchi wrote:
> On Thu, Mar 9, 2017 at 11:39 AM, Nathanaël Blanchet  > wrote:
> 
> 
> 
> Le 09/03/2017 à 10:25, Gianluca Cecchi a écrit :
>> On Wed, Mar 8, 2017 at 6:05 PM, Gianluca Cecchi
>> > wrote:
>>
>>
>>
>> NOTE: during the snapshot creation I see in web admin console
>> the VM in paused state and also not responsive in both console
>> and ssh session.
>> After a couple of seconds it comes back and as a confirmation
>> I see this in its messages:
>>
>> Mar  8 17:38:57 T-ORACLE73 chronyd[616]: System clock wrong by
>> 19.077230 seconds, adjustment started
>>
>> Is this expected?
>>
>>
>>
>>
>> Possibly the default changed at some point in time, so that now it
>> saves memory and so this implies pause of VM
> Saving memory is essential in some apàplications like DB, so you
> won't bypass vm pauses for such a stuff
> 
> 
> Yes, indeed, the important thing is to have an option so that you can
> set it True or False, depending on the VM you are saving, the
> application that is running isnide it and the way you want to do backup
> of the application.
> Nevertheless, RDBMS and also other applications often have some
> mechanism to be "frozen in a consistent state" so that you can save what
> you have on disk without need to save memory to have a consistent backup.
> Oracle for example has functionality to be put in "backup mode" where
> you issue "begin backup" before the snapshot and "end backup" right
> after snapshot completion.
> I see that POstgreSQL has similar functionality (not tested myself):
> https://www.postgresql.org/docs/9.4/static/continuous-archiving.html#BACKUP-LOWLEVEL-BASE-BACKUP
> and the same for other ones.
> 
> Gianluca 
> 

Just wanted to add that freezing activity is not only important for
databases, but also for plain file systems. In order to do a consistent
backup it is important to freeze the file systems before creating a live
snapshot, and thaw it afterwards. oVirt does that automatically, but
only if the guest agent is installed and running. So, remember to have
the guest agent installed and running in the virtual machines that you
plan to backup using this mechanism.


___
Users mailing list
Users@ovirt.org
http://lists.ovirt.org/mailman/listinfo/users


Re: [ovirt-users] oVirt VM backup and restore

2017-03-09 Thread Juan Hernández
On 03/09/2017 11:11 AM, Gianluca Cecchi wrote:
> On Thu, Mar 9, 2017 at 10:58 AM, Juan Hernández <jhern...@redhat.com
> <mailto:jhern...@redhat.com>> wrote:
> 
> 
> 
> Very good point Gialuca, you are right, the 'persist_memorystate' flag
> is 'true' by default, and that makes the pause longer. Would you be so
> kind to add it to the 'vm_backup.py' example that is part of version 4
> of the SDK?
> 
> 
> 
> https://github.com/oVirt/ovirt-engine-sdk/blob/master/sdk/examples/vm_backup.py#L143-L151
> 
> <https://github.com/oVirt/ovirt-engine-sdk/blob/master/sdk/examples/vm_backup.py#L143-L151>
> 
> (Note that that Gibhub is just a mirror, the change needs to be submited
> using gerrit.ovirt.org <http://gerrit.ovirt.org>).
> 
> 
> 
> I already verified (on a 4.1 infra) that changing vm_backup.py
> downloaded yesterday from master this way (apart connection paramters):
> 
> $ diff vm_backup.py vm_backup.py.orig 
>  150d149
> < persist_memorystate=False,
> 
> I get the backup result and snapshot is correctly without memory saved
> (and no pause at VM side)
> 
> In engine events I get:
> 
> Mar 9, 2017 10:50:39 AM Snapshot
> 'Oracle7-backup-c6bf637e-cdeb-4923-a39f-55a14d7bad7b' deletion for VM
> 'Oracle7' has been completed.
> Mar 9, 2017 10:49:48 AM Backup of virtual machine 'Oracle7' using
> snapshot 'Oracle7-backup-c6bf637e-cdeb-4923-a39f-55a14d7bad7b' is completed.
> Mar 9, 2017 10:49:48 AM Snapshot
> 'Oracle7-backup-c6bf637e-cdeb-4923-a39f-55a14d7bad7b' deletion for VM
> 'Oracle7' was initiated by admin@internal-authz.
> Mar 9, 2017 10:49:47 AM  Disk Oracle7_Disk1 was successfully detached
> from VM c7testovn1 by admin@internal-authz.
> Mar 9, 2017 10:49:45 AM Disk Oracle7_Disk1 was successfully attached to
> VM c7testovn1 by admin@internal-authz.
> Mar 9, 2017 10:49:41 AM Snapshot
> 'Oracle7-backup-c6bf637e-cdeb-4923-a39f-55a14d7bad7b' creation for VM
> 'Oracle7' has been completed.
> Mar 9, 2017 10:49:29 AM Snapshot
> 'Oracle7-backup-c6bf637e-cdeb-4923-a39f-55a14d7bad7b' creation for VM
> 'Oracle7' was initiated by admin@internal-authz.
> Mar 9, 2017 10:49:28 AM Backup of virtual machine 'Oracle7' using
> snapshot 'Oracle7-backup-c6bf637e-cdeb-4923-a39f-55a14d7bad7b' is starting.
> 
> 
> I have almost no experience in gerrit/github, unfortunately... only a
> beginner experience in svn ... ;-)
> If you give me some pointers I can try to apply what you asked...
> 
> Gianluca

I see that you already have a gerrit.ovirt.org, so it shouldn't be
difficult. The initial setup should be like this:

  $ git config --global user.name youruser
  $ git config --global user.email your@email
  $ git clone ssh://youru...@gerrit.ovirt.org:29418/ovirt-engine-sdk
  $ gitdir=$(git rev-parse --git-dir); scp -p -P 29418
youru...@gerrit.ovirt.org:hooks/commit-msg ${gitdir}/hooks/

Then, to submit the patch:

  $ cd ovirt-engine-sdk
  $ Edit the vm_backup.py file, and make your changes.
  $ git commit -a -s
  $ git push origin HEAD:refs/for/master

___
Users mailing list
Users@ovirt.org
http://lists.ovirt.org/mailman/listinfo/users


Re: [ovirt-users] oVirt VM backup and restore

2017-03-09 Thread Juan Hernández
On 03/09/2017 10:25 AM, Gianluca Cecchi wrote:
> On Wed, Mar 8, 2017 at 6:05 PM, Gianluca Cecchi
> > wrote:
> 
> 
> 
> NOTE: during the snapshot creation I see in web admin console the VM
> in paused state and also not responsive in both console and ssh session.
> After a couple of seconds it comes back and as a confirmation I see
> this in its messages:
> 
> Mar  8 17:38:57 T-ORACLE73 chronyd[616]: System clock wrong by
> 19.077230 seconds, adjustment started
> 
> Is this expected?
> 
> 
> 
> 
> Possibly the default changed at some point in time, so that now it saves
> memory and so this implies pause of VM
> 
> In the mean time I verified changing backup.py this way solves the
> problem (the 3.6 api deprecation still in place... ;-):
> 
> $ diff backup.py backup.py.orig 
> 123c123
> <
> vm.snapshots.add(params.Snapshot(description=config.get_snapshot_description(),
> vm=vm,persist_memorystate=False))
> ---
>>
> vm.snapshots.add(params.Snapshot(description=config.get_snapshot_description(),
> vm=vm))
> 
> The snapshot doesn't include memory and no problem at VM OS side now
> 
> Tested also getting the parameter from config file
> 
> Modifications needed in this case:
> 
> 1)
> $ diff backup.py backup.py.orig 
> 123c123
> <
> vm.snapshots.add(params.Snapshot(description=config.get_snapshot_description(),
> vm=vm,persist_memorystate=config.get_persist_memorystate()))
> ---
>>
> vm.snapshots.add(params.Snapshot(description=config.get_snapshot_description(),
> vm=vm))
> 
> 
> 2)
> $ diff config.py config.py.orig 
> 34d33
> < self.__persist_memorystate =
> config_parser.getboolean(section, "persist_memorystate")
> 113,116d111
> < 
> < 
> < def get_persist_memorystate(self):
> < return self.__persist_memorystate
> 
> 
> And in config file called add:
> 
> # Save Memory in snapshot
> persist_memorystate=False
> 
> It could be further improved if one wants to differentiate save memory
> for some VMs and not for other ones
> 
> HIH other ones,
> Gianluca
> 

Very good point Gialuca, you are right, the 'persist_memorystate' flag
is 'true' by default, and that makes the pause longer. Would you be so
kind to add it to the 'vm_backup.py' example that is part of version 4
of the SDK?


https://github.com/oVirt/ovirt-engine-sdk/blob/master/sdk/examples/vm_backup.py#L143-L151

(Note that that Gibhub is just a mirror, the change needs to be submited
using gerrit.ovirt.org).





___
Users mailing list
Users@ovirt.org
http://lists.ovirt.org/mailman/listinfo/users


Re: [ovirt-users] ovirt-engine-sdk-python-4.1 clone a vm from snapshot

2017-03-08 Thread Juan Hernández
On 03/08/2017 06:53 PM, Niyazi Elvan wrote:
> Hi Folks !
> 
> I am looking for a documentation for ovirt-engine-sdk-python-4.1 but
> could not find anything yet. Looks like there are many changes compared
> to 4.0.
> 

Version 4.1 of the SDK isn't very different for version 4.0. It is very
different from version 3.6.

Note that version 3 of the API, and version 3 of the SDK are deprecated
since version 4.0 of the engine, and they will be removed in version 4.2
of the engine.

There is a general description of version 4 of the SDK here:

  https://github.com/oVirt/ovirt-engine-sdk/blob/master/sdk/README.adoc

A collection of examples here:

  https://github.com/oVirt/ovirt-engine-sdk/tree/master/sdk/examples

And reference documentation here:

  http://ovirt.github.io/ovirt-engine-sdk/4.1

You may also find useful the documentation of the API itself:

  http://ovirt.github.io/ovirt-engine-api-model/4.1

Specially the section that describes how to add virtual machines, as
there is an example of how to add a virtual machine from a snapshot there:


http://ovirt.github.io/ovirt-engine-api-model/4.1/#services/vms/methods/add

> Can anyone help me about how to clone a VM from a snapshot using the
> latest sdk ?
> 

To create a virtual machine from a snapshot with the latest version of
the SDK you will need something like this:

---8<---
import time

import ovirtsdk4 as sdk
import ovirtsdk4.types as types

# This example shows how to clone a virtual machine from an snapshot.

# Create the connection to the server:
connection = sdk.Connection(
url='https://engine.example.com/ovirt-engine/api',
username='admin@internal',
password='...',
ca_file='ca.pem'
)

# Get the reference to the root of the tree of services:
system_service = connection.system_service()

# Find the virtual machine:
vms_service = system_service.vms_service()
vm = vms_service.list(search='name=myvm')[0]

# Find the service that manages the virtual machine:
vm_service = vms_service.vm_service(vm.id)

# Find the snapshot. Note that the snapshots collection doesn't support
# search, so we need to retrieve the complete list and the look for the
# snapshot that has the description that we are looking for.
snaps_service = vm_service.snapshots_service()
snaps = snaps_service.list()
snap = next(
  (s for s in snaps if s.description == 'mysnap'),
  None
)

# Create a new virtual machine, cloning it from the snapshot:
cloned_vm = vms_service.add(
vm=types.Vm(
name='myclonedvm',
snapshots=[
types.Snapshot(
id=snap.id
)
],
cluster=types.Cluster(
name='mycluster'
)
)
)

# Find the service that manages the cloned virtual machine:
cloned_vm_service = vms_service.vm_service(cloned_vm.id)

# Wait till the virtual machine is down, as that means that the creation
# of the disks of the virtual machine has been completed:
while True:
time.sleep(5)
cloned_vm = cloned_vm_service.get()
if cloned_vm.status == types.VmStatus.DOWN:
break

# Close the connection to the server:
connection.close()
--->8---
___
Users mailing list
Users@ovirt.org
http://lists.ovirt.org/mailman/listinfo/users


Re: [ovirt-users] Python sdk 4 for Fedora 25 where?

2017-03-08 Thread Juan Hernández
On 03/08/2017 06:23 PM, Nathanaël Blanchet wrote:
> 
> 
> Le 08/03/2017 à 18:17, Juan Hernández a écrit :
>> On 03/08/2017 06:15 PM, Barak Korren wrote:
>>> On 8 March 2017 at 19:07, Juan Hernández <jhern...@redhat.com> wrote:
>>>> The best way to get the latest versions of those packages is to install
>>>> the oVirt release RPM:
>>>>
>>>>dnf install
>>>> http://resources.ovirt.org/pub/yum-repo/ovirt-release41.rpm
>>>>
>>>> Then install the required packages. The names of the packages are
>>>> different for version 3 of the SDK and version 4 of the SDK, so you can
>>>> install both simultaneously:
>>>>
>>>>Version 3: ovirt-engine-sdk-python
>>>>Version 4: python-ovirt-engine-sdk4
>>>>
>>>>yum -y install ovirt-engine-sdk-python python-ovirt-engine-sdk4
>>>>
>>>> Note that version 3 of the API, and version 3 of the SDK, are
>>>> deprecated
>>>> since version 4 of the engine, and that they will be removed in version
>>>> 4.2 of the engine, so prepare to migrate to version 4.
>>>>
>>> Juan, it seems that we did not build SDK4 for FC25 in 4.1 or older
>>> versions:
>>> http://jenkins.ovirt.org/search/?q=python-ovirt-engine-sdk4_4.1_build-artifacts
>>>
>>>
>>> So as far as I can tell there is no released SDK4 for FC25 ATM. Only a
>>> pre-released one in the master snapshot.
>>>
>> Sorry, I forgot you are using Fedora 25, and Fedora 25 isn't yet a
>> supported platform :-( .
>>
>> For Fedora 25 you can either build the packages yourself, or else
>> install using 'pip':
> previously
> 
> sudo dnf install gcc python3-devel libxml2-devel

That is correct, thanks Nathanaël. I have just submitted a patch to
document this in the README.adoc file of the SDK:

  Add installation instructions
  https://gerrit.ovirt.org/73796

Would be nice if you can review that patch.

>>pip install ovirt-engine-sdk
>>
>> But you can't install version 3 and 4 in this way, as in the PyPI world
>> they are the same package.
>>
>> Another thing you can do is get the latest builds from the master
>> branch, which already support Fedora 25:
>>
>>Version 3:
>>
>> http://jenkins.ovirt.org/view/All/job/ovirt-engine-sdk_master_build-artifacts-fc25-x86_64/lastSuccessfulBuild/artifact/exported-artifacts/ovirt-engine-sdk-python-3.6.9.2-0.1.20170209.gite99bbd1.fc25.noarch.rpm
>>
>>
>>Version 4:
>>
>> http://jenkins.ovirt.org/view/All/job/python-ovirt-engine-sdk4_master_build-artifacts-fc25-x86_64/lastSuccessfulBuild/artifact/exported-artifacts/python-ovirt-engine-sdk4-4.2.0-1.a0.20170308git9add66c.fc25.x86_64.rpm
>>
>>
>> That pre-releases are that, pre-releases, but there are no big changes,
>> should be very usable.
>>
>> ___
>> Users mailing list
>> Users@ovirt.org
>> http://lists.ovirt.org/mailman/listinfo/users
> 

___
Users mailing list
Users@ovirt.org
http://lists.ovirt.org/mailman/listinfo/users


Re: [ovirt-users] Python sdk 4 for Fedora 25 where?

2017-03-08 Thread Juan Hernández
On 03/08/2017 06:15 PM, Barak Korren wrote:
> On 8 March 2017 at 19:07, Juan Hernández <jhern...@redhat.com> wrote:
>>
>> The best way to get the latest versions of those packages is to install
>> the oVirt release RPM:
>>
>>   dnf install http://resources.ovirt.org/pub/yum-repo/ovirt-release41.rpm
>>
>> Then install the required packages. The names of the packages are
>> different for version 3 of the SDK and version 4 of the SDK, so you can
>> install both simultaneously:
>>
>>   Version 3: ovirt-engine-sdk-python
>>   Version 4: python-ovirt-engine-sdk4
>>
>>   yum -y install ovirt-engine-sdk-python python-ovirt-engine-sdk4
>>
>> Note that version 3 of the API, and version 3 of the SDK, are deprecated
>> since version 4 of the engine, and that they will be removed in version
>> 4.2 of the engine, so prepare to migrate to version 4.
>>
> 
> Juan, it seems that we did not build SDK4 for FC25 in 4.1 or older versions:
> http://jenkins.ovirt.org/search/?q=python-ovirt-engine-sdk4_4.1_build-artifacts
> 
> So as far as I can tell there is no released SDK4 for FC25 ATM. Only a
> pre-released one in the master snapshot.
> 

Sorry, I forgot you are using Fedora 25, and Fedora 25 isn't yet a
supported platform :-( .

For Fedora 25 you can either build the packages yourself, or else
install using 'pip':

  pip install ovirt-engine-sdk

But you can't install version 3 and 4 in this way, as in the PyPI world
they are the same package.

Another thing you can do is get the latest builds from the master
branch, which already support Fedora 25:

  Version 3:

http://jenkins.ovirt.org/view/All/job/ovirt-engine-sdk_master_build-artifacts-fc25-x86_64/lastSuccessfulBuild/artifact/exported-artifacts/ovirt-engine-sdk-python-3.6.9.2-0.1.20170209.gite99bbd1.fc25.noarch.rpm

  Version 4:

http://jenkins.ovirt.org/view/All/job/python-ovirt-engine-sdk4_master_build-artifacts-fc25-x86_64/lastSuccessfulBuild/artifact/exported-artifacts/python-ovirt-engine-sdk4-4.2.0-1.a0.20170308git9add66c.fc25.x86_64.rpm

That pre-releases are that, pre-releases, but there are no big changes,
should be very usable.

___
Users mailing list
Users@ovirt.org
http://lists.ovirt.org/mailman/listinfo/users


Re: [ovirt-users] Python sdk 4 for Fedora 25 where?

2017-03-08 Thread Juan Hernández
On 03/08/2017 05:58 PM, Gianluca Cecchi wrote:
> Hello,
> it seems that on my Fedora 25 I'm able to find
> only ovirt-engine-sdk-python that is 3.6.9.1
> What should I execute to get sdk 4 on Fedora 25?
> Can I have both the sdk 3 and 4 for test an a single machine?
> 
> Thanks in advance,
> Gianluca
> 

The best way to get the latest versions of those packages is to install
the oVirt release RPM:

  dnf install http://resources.ovirt.org/pub/yum-repo/ovirt-release41.rpm

Then install the required packages. The names of the packages are
different for version 3 of the SDK and version 4 of the SDK, so you can
install both simultaneously:

  Version 3: ovirt-engine-sdk-python
  Version 4: python-ovirt-engine-sdk4

  yum -y install ovirt-engine-sdk-python python-ovirt-engine-sdk4

Note that version 3 of the API, and version 3 of the SDK, are deprecated
since version 4 of the engine, and that they will be removed in version
4.2 of the engine, so prepare to migrate to version 4.

___
Users mailing list
Users@ovirt.org
http://lists.ovirt.org/mailman/listinfo/users


Re: [ovirt-users] ovirt_nics problem at ansible module

2017-03-08 Thread Juan Hernández
On 03/08/2017 03:44 PM, Oğuz Yarımtepe wrote:
> Hi,
> 
> Below is my playbook
> 
> ---
> - name: Setup oVirt environment
>   hosts: vms
>   tasks:
> - block:
> - name: Include oVirt password
>   #no_log: true
>   include_vars: vars.yml
> 
> - name: Obtain SSO token
>   no_log: true
>   ovirt_auth:
> url: "{{ url }}"
> username: "{{ username }}"
> password: "{{ password }}"
> ca_file: "{{ ca_file }}"
> 
> - name: Create and run VM from template
>   ovirt_vms:
> auth: "{{ ovirt_auth }}"
> name: "{{ vm }}"
> template: "{{ template }}"
> cluster: "{{ cluster }}"
> memory: "{{ memory }}"
> memory_guaranteed: "{{ memory_guaranteed }}"
> high_availability: true
> cpu_cores: "{{ cpu_cores }}"
> cpu_sockets: "{{ cpu_sockets }}"
> type: server
> name: "{{ vm }}"
> operating_system: other_linux
> state: stopped
> wait: yes
> 
> #- name: Add nic
> #  ovirt_nics:
> #auth: "{{ ovirt_auth }}"
> #name: "{{ nic_name }}"
> #profile: "{{ profile_name }}"
> #state: plugged
> #vm: "{{ vm }}"
> #wait: yes
> 
>   always:
> - name: Revoke the SSO token
>   ovirt_auth:
> state: absent
> ovirt_auth: "{{ ovirt_auth }}"
> 
> When i remove the commented lines here is what i got:
> 
> ERROR! no action detected in task. This often indicates a misspelled
> module name, or incorrect module path.
> 
> The error appears to have been in
> '/Users/oyarimtepe/test/ovirt-ansible/create_vm_from_template/playbook.yml':
> line 35, column 11, but may
> be elsewhere in the file depending on the exact syntax problem.
> 
> The offending line appears to be:
> 
> 
> - name: Add nic
>   ^ here
> 
> 
> The error appears to have been in
> '/Users/oyarimtepe/test/ovirt-ansible/create_vm_from_template/playbook.yml':
> line 35, column 11, but may
> be elsewhere in the file depending on the exact syntax problem.
> 
> The offending line appears to be:
> 
> 
> - name: Add nic
>   ^ here
> 
> I tried using the nics attribute of ovirt_vms module but this time i got
> Nic[Name] is required although i defined as below:
> 
> nics:
>   - name: "{{ nic_name }}"
>   - profile_name: "{{ profile_name }}"
> 
> without comments it works. Any idea? Any way to set the nic and profile
> via SDK? An example will be great.
> 

If what you are looking for is a way to add a NIC to an existing VM,
using a specific vNIC profile, you can use this example:


https://github.com/oVirt/ovirt-engine-sdk/blob/master/sdk/examples/add_vm_nic.py

___
Users mailing list
Users@ovirt.org
http://lists.ovirt.org/mailman/listinfo/users


Re: [ovirt-users] ovirt ansible module

2017-03-08 Thread Juan Hernández
On 03/08/2017 10:08 AM, Oğuz Yarımtepe wrote:
> I didn't see any parameter at the current ansible documentation related
> with these features. How can i set these feature if i am using ansible?
> Any possibility to set them via SDK after the vm is opened via ansible?
> 

The target storage domain for the lease can be set using the Python SDK,
like this:

---8<---
import ovirtsdk4 as sdk
import ovirtsdk4.types as types

# This example shows how to set the storage domain where the lease of a
# virtual machine should be created.

# Create the connection to the server:
connection = sdk.Connection(
url='https://engine.example.com/ovirt-engine/api',
username='admin@internal',
password='...',
ca_file='ca.pem'
)

# Get the reference to the root of the tree of services:
system_service = connection.system_service()

# Find the virtual machine:
vms_service = system_service.vms_service()
vm = vms_service.list(search='name=myvm')[0]

# Find the storage domain:
sds_service = system_service.storage_domains_service()
sd = sds_service.list(search='name=mydata')[0]

# Update the storage machine so that high availability is enabled and
# the lease is created in the selected storage domain:
vm_service = vms_service.vm_service(vm.id)
vm_service.update(
vm=types.Vm(
high_availability=types.HighAvailability(
enabled=True
),
lease=types.StorageDomainLease(
storage_domain=types.StorageDomain(
id=sd.id
)
)
)
)

# Close the connection to the server:
connection.close()
--->8---

~
> On Wed, Mar 8, 2017 at 8:46 AM, Oved Ourfali  > wrote:
> 
> The VM leases feature is a new feature in 4.1, and I'm not sure
> whether it was included in the ansible modules or not.
> CC-ing Ondra as he will know for sure.
> 
> 
> On Wed, Mar 8, 2017 at 3:20 AM, Oğuz Yarımtepe
> > wrote:
> 
> Hi,
> 
> I am ttesting the ovirt ansible module. Couldn't figured ot how
> to open a new vm from template with thin provisioning and Target
> Storage Domain for VM Lease definition. Any idea how can i set
> these values at the ansible playbook?
>  
> 
> -- 
> Oğuz Yarımtepe
> http://about.me/oguzy
> 
> ___
> Users mailing list
> Users@ovirt.org 
> http://lists.ovirt.org/mailman/listinfo/users
> 
> 
> 
> 
> 
> 
> -- 
> Oğuz Yarımtepe
> http://about.me/oguzy
> 
> 
> ___
> Users mailing list
> Users@ovirt.org
> http://lists.ovirt.org/mailman/listinfo/users
> 

___
Users mailing list
Users@ovirt.org
http://lists.ovirt.org/mailman/listinfo/users


Re: [ovirt-users] restapi

2017-03-07 Thread Juan Hernández
On 03/07/2017 12:50 PM, qinglong.d...@horebdata.cn wrote:
> Hi, all
> I have a cloud foundry environment. I have noticed that cloud
> foundry can schedule vitual machines created by vmware or openstack
> using restapi. Ovirt supports restapi, too. So I want to know if it is
> possible to schedule vitual machines which created by ovirt
> using cloud foundry. Anyone can help? Thanks!
> 

Your words may me think that you believe that there is an standard REST
API that VMware and OpenStack both implement, and your question is if
oVirt implements it as well. But that isn't correct, VMware and
OpenStack have different REST APIs, and so does oVirt. Cloud Foundry can
talk to the VMware and OpenStack APIs, but not to the oVirt API, as far
as I know.
___
Users mailing list
Users@ovirt.org
http://lists.ovirt.org/mailman/listinfo/users


Re: [ovirt-users] ansible ovirt-vms

2017-02-23 Thread Juan Hernández
On 02/23/2017 01:58 PM, Norman Lamponi wrote:
> Hello all,
> 
> i'm trying to implement automatic deploy of vm on a rhevm/ovirt platform
> using ansible and ovirt_vms module.
> 
> I take rhel 7.3 kvm guest with cloud init like template, i can deploy vm
> with no problem but when i try using ansible to power up and configure
> it with cloud init the process fail.
> 
> My playbook is this: 
> ---
> - hosts: ovirt
>   tasks:
> - name: Parti e configura
>   ovirt_vms:
>   auth:
> username: admin@internal
> password: 
> url: https://webaddress/ovirt-engine

Try to add /api to the 'url' parameter.

> ca_file: /etc/pki/ovirt-engine/ca.pem
>   name: rh7conf
>   cluster: Sviluppo
>   high_availability: true
>   cloud_init:
> nic_boot_protocol: static
> nic_ip_address: 10.x.xx.xxx
> nic_netmask: 255.255.252.0
> nic_gateway: 10.x.xx.xxx
> nic_name: eth0
> nic_on_boot: true
> host_name: sticameca
> user_name: root
> root_password: stapera
> 
> my host file is:
> [ovirt]
> webaddress ansible_user=root
> 
> and  error is:
> 
> nsible-playbook -i ~/ansible/ovirt_hosts orig.testovirt_vms.yml -
> Using /etc/ansible/ansible.cfg as config file
> Loading callback plugin default of type stdout, v2.0 from
> /usr/lib/python2.7/dist-packages/ansible/plugins/callback/__init__.pyc
> 
> PLAYBOOK: orig.testovirt_vms.yml
> ***
> 1 plays in orig.testovirt_vms.yml
> 
> PLAY [ovirt]
> ***
> 
> TASK [setup]
> ***
> Using module file
> /usr/lib/python2.7/dist-packages/ansible/modules/core/system/setup.py
>  ESTABLISH SSH CONNECTION FOR USER: root
>  SSH: EXEC ssh -vvv -C -o ControlMaster=auto -o
> ControlPersist=60s -o KbdInteractiveAuthentication=no -o
> PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o
> PasswordAuthentication=no -o User=root -o ConnectTimeout=10 -o
> ControlPath=/home/lamponin/.ansible/cp/ansible-ssh-%h-%p-%r
> webaddress'/bin/sh -c '"'"'( umask 77 && mkdir -p "` echo
> ~/.ansible/tmp/ansible-tmp-1487853056.88-81930174841084 `" && echo
> ansible-tmp-1487853056.88-81930174841084="` echo
> ~/.ansible/tmp/ansible-tmp-1487853056.88-81930174841084 `" ) && sleep
> 0'"'"''
>  PUT /tmp/tmp0wuXiN TO
> /root/.ansible/tmp/ansible-tmp-1487853056.88-81930174841084/setup.py
>  SSH: EXEC sftp -b - -vvv -C -o ControlMaster=auto -o
> ControlPersist=60s -o KbdInteractiveAuthentication=no -o
> PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o
> PasswordAuthentication=no -o User=root -o ConnectTimeout=10 -o
> ControlPath=/home/lamponin/.ansible/cp/ansible-ssh-%h-%p-%r '[webaddress]'
>  ESTABLISH SSH CONNECTION FOR USER: root
>  SSH: EXEC ssh -vvv -C -o ControlMaster=auto -o
> ControlPersist=60s -o KbdInteractiveAuthentication=no -o
> PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o
> PasswordAuthentication=no -o User=root -o ConnectTimeout=10 -o
> ControlPath=/home/lamponin/.ansible/cp/ansible-ssh-%h-%p-%r
> webaddress'/bin/sh -c '"'"'chmod u+x
> /root/.ansible/tmp/ansible-tmp-1487853056.88-81930174841084/
> /root/.ansible/tmp/ansible-tmp-1487853056.88-81930174841084/setup.py &&
> sleep 0'"'"''
>  ESTABLISH SSH CONNECTION FOR USER: root
>  SSH: EXEC ssh -vvv -C -o ControlMaster=auto -o
> ControlPersist=60s -o KbdInteractiveAuthentication=no -o
> PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o
> PasswordAuthentication=no -o User=root -o ConnectTimeout=10 -o
> ControlPath=/home/lamponin/.ansible/cp/ansible-ssh-%h-%p-%r -tt
> webaddress'/bin/sh -c '"'"'/usr/bin/python
> /root/.ansible/tmp/ansible-tmp-1487853056.88-81930174841084/setup.py; rm
> -rf "/root/.ansible/tmp/ansible-tmp-1487853056.88-81930174841084/" >
> /dev/null 2>&1 && sleep 0'"'"''
> ok: [webaddress]
> 
> TASK [Parti e configura]
> ***
> task path: /home/lamponin/ansible/playbook/orig.testovirt_vms.yml:4
> Using module file
> /usr/lib/python2.7/dist-packages/ansible/modules/extras/cloud/ovirt/ovirt_vms.py
>  ESTABLISH SSH CONNECTION FOR USER: root
>  SSH: EXEC ssh -vvv -C -o ControlMaster=auto -o
> ControlPersist=60s -o KbdInteractiveAuthentication=no -o
> PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o
> PasswordAuthentication=no -o User=root -o ConnectTimeout=10 -o
> ControlPath=/home/lamponin/.ansible/cp/ansible-ssh-%h-%p-%r
> webaddress'/bin/sh -c '"'"'( umask 77 && mkdir -p "` echo
> ~/.ansible/tmp/ansible-tmp-1487853058.27-257942678666870 `" && echo
> ansible-tmp-1487853058.27-257942678666870="` echo
> ~/.ansible/tmp/ansible-tmp-1487853058.27-257942678666870 `" ) && sleep
> 0'"'"''
>  PUT /tmp/tmphQzpox 

Re: [ovirt-users] How to manage to update the Quota limits parameters (cpu, memory and disk)

2017-02-17 Thread Juan Hernández
On 02/17/2017 01:21 PM, Manuel Luis Aznar wrote:
> Hello there,
> 
> I want to update the quota limit parameters for vcpu, memory and disk,
> but I dont find the way.
> 
> I manage to get the actual values but I am unable to manage how to
> update this values.
> 
> I am doing the following (I ommit the imports and conection stuff):
> 
>   system_service = connection.system_service()
> 
>   data_centers_service = system_service.data_centers_service()
> 
>   data_center = data_centers_service.list(search='name=Prueba2')[0]
> 
>   data_center_service =
> data_centers_service.data_center_service(id=data_center.id
> )
> 
>   quotas_service = data_center_service.quotas_service()
> 
>   quota = quotas_service.list()[0]
> 
>   quota_service = quotas_service.quota_service(id=quota.id
> )
> 
>   quota_cluster_limits_service =
> quota_service.quota_cluster_limits_service()
> 
>   quotaclusterlimit = quota_cluster_limits_service.list()[0]
> 
>   quota_storage_limits_service =
> quota_service.quota_storage_limits_service()
> 
> quotastoragelimit = quota_storage_limits_service.list()[0]
> 
> if after that I print the following:
>   quotaclusterlimit.memory_limit
>   quotaclusterlimit.vcpu_limit
>   quotastoragelimit.limit
> 
> i see the actual values of the limits, but, I m not able to update that
> values (I have been testing on how to do it). It seems that the only
> method that let you update anything on a quota is using:
> 
>quota_service.add(quota=...)
> 
> I start creating a new quota object with these new limits by doing the
> following:
> 
>   new_quotastoragelimit = ovirtsdk4.types.QuotaStorageLimit(limit=100)
>   new_quotaclusterlimit =
> ovirtsdk4.types.QuotaClusterLimit(memory_limit=100,vcpu_limit=10)
> 
>   new_quota =
> ovirtsdk4.types.Quota(quota_cluster_limits=new_quotaclusterlimit,
> quota_storage_limits=new_quotastoragelimit)
> 
>   quota_service.update(quota=new_quota)
> 
> I have directly tried to edit the printed values directly and then doing
> the update but I got nothing (got event in the engine but the limit did
> not change)
> 
>   quotaclusterlimit.memory_limit =100
>   quotaclusterlimit.vcpu_limit = 10
>   quotastoragelimit.limit = 100
>   quota_service.update(quota=quota) # updating quota with itself
> 
> I suppose that there would be a way on how to this, so if you can help,
> i will really appreciate you.
> 
> Thanks for all in advance to all
> Manuel
> 

The API doesn't currently have a method to update a quota limit, so you
will have to remove the existing one and add a new one. For example, if
you want to change the storage quota of the 'mydata' storage domain to
100 GiB, you can do something like this:

---8<---
# Find the reference to the root of services:
system_service = connection.system_service()

# Find the data center and the service that manages it:
dcs_service = system_service.data_centers_service()
dc = dcs_service.list(search='name=mydc')[0]
dc_service = dcs_service.data_center_service(dc.id)

# Find the storage domain and the service that manages it:
sds_service = system_service.storage_domains_service()
sd = sds_service.list(search='name=mydata')[0]
sd_service = sds_service.storage_domain_service(sd.id)

# Find the quota and the service that manages it. Note that the service
# that manages the quota doesn't support search, so we need to retrieve
# all the quotas and filter explicitly. If the quota doesn't exist,
# create it.
quotas_service = dc_service.quotas_service()
quotas = quotas_service.list()
quota = next(
(q for q in quotas if q.name == 'myquota'),
None
)
if quota is None:
quota = quotas_service.add(
quota=types.Quota(
name='myquota',
description='My quota',
cluster_hard_limit_pct=20,
cluster_soft_limit_pct=80,
storage_hard_limit_pct=20,
storage_soft_limit_pct=80
)
)
quota_service = quotas_service.quota_service(quota.id)

# Find the quota limits for the storage domain that we are interested
# on. If that limit exists we will delete it, and create it again with
# the desired limit, in this example it will be 100 GiB.
limits_service = quota_service.quota_storage_limits_service()
limits = limits_service.list()
limit = next(
(l for l in limits if l.id == sd.id),
None
)
if limit is not None:
limit_service = limits_service.limit_service(limit.id)
limit_service.remove()
limit = limits_service.add(
limit=types.QuotaStorageLimit(
name='mydatalimit',
description='My storage domain limit',
limit=100,
storage_domain=types.StorageDomain(
id=sd.id
)
),
)
--->8---

___
Users mailing list
Users@ovirt.org
http://lists.ovirt.org/mailman/listinfo/users


Re: [ovirt-users] Getting error while trying to add VmPool using ovirtsdk4 version of the python api

2017-02-10 Thread Juan Hernández
On 02/10/2017 01:43 PM, Manuel Luis Aznar wrote:
> Hello there,
> 
> I am trying to add a VmPool to oVirt using the python ovirtSDK4 with
> following lines:
> 
> I am omitting the import packages lines and connection lines.
> 
> 
> 
> system_service = connection.system_service()
> 
> vm_pools_service = system_service.vm_pools_service()
> 
> templates_service = system_service.templates_service()
> 
> clusters_service = system_service.clusters_service()
> 
> tplist = templates_service.list(search='name=prueba')
> 
> tpl=None
> biggest=-1
> fort intplist:
>  ver = t.version
>  ifver.version_number > biggest:
>  biggest = ver.version_number
>  tid = t.id 
>  tpl = t  
> 
> c = None
> forcluster inclusters_service.list():
> ifcluster.name  == 'Pruebacluster':
> c = cluster
> 
> pool =
> ovirtsdk4.types.VmPool(name='PRUEBA',size=1,type=ovirtsdk4.types.VmPoolType('manual'),template=tpl,cluster=c)
>  
> vm_pools_service.add(pool=pool)
> 
> 
> 
> I am getting the following error:
> 
>Fault reason is "Request syntactically incorrect.". Fault detail is
> "For correct usage, see:
> https://ovirt.example.com/ovirt-engine/api/v4/model#services/vm-pools/methods/add;.
> HTTP  response code is 400.
> 
> I am a newbie in using this version of the API, suppose this is quite
> easy problem.
> 
> Thanks for all the answers to come,
> Manuel
> 

This look like this bug, fixed in version 4.1 of the SDK:

  Importing a VM using the SDK fails
  https://bugzilla.redhat.com/1408839

However there is a good practice that I recommend you to apply, which
will probably avoid the issue. That good practice is avoid sending to
the server the complete objects that you got from other requests. For
example, in this case you are sending to the server the complethe 'tpl'
and 'c' clusters that you got from other requests. Instead of that, try
to send only what is required:

  pool = ovirttsdk4.types.VmPool(
name='PRUEBA',
size=1,
type=ovirtsdk4.types.VmPoolType.MANUAL,
template=ovirtsdk4.types.Template(id=tpl.id),
cluster=ovirtsdk4.types.Cluster(id=c.id)
  )
  vm_pools_servcie.add(pool=pool)

The key point here is creating new 'Template' and 'Cluster' objects that
only contain the 'id', as that is all what the server needs. If you send
the complete template and cluster you are wasting resources, and
exposing yourself to bugs like the mentioned above.

Please try that and let us know if it solves your issue.

___
Users mailing list
Users@ovirt.org
http://lists.ovirt.org/mailman/listinfo/users


Re: [ovirt-users] Ovirt FQDN

2017-01-28 Thread Juan Hernández
On 01/28/2017 09:28 AM, Yaniv Kaul wrote:
> 
> 
> On Jan 27, 2017 12:32 PM, "Juan Hernández" <jhern...@redhat.com
> <mailto:jhern...@redhat.com>> wrote:
> 
> On 01/27/2017 11:56 AM, Alex wrote:
> > Hi,
> >
> > I added the IP address at 11-setup-sso.conf (found at
> > /etc/ovirt-engine/engine.conf.d), at line
> SSO_ALTERNATE_ENGINE_FQDNS="IP".
> > Then restarted engine.
> > I can access now engine vm using IP, but I cannot when connecting
> > remotely using localhost and port forwarding through ssh. I tried
> to add
> > also localhost as alternate fqdn without any luck.
> > Any idea?
> >
> > Many thanx,
> > Alex
> >
> 
> Make sure to include also the port number that you are using. For
> example, if you are using port 1 then you will need this:
> 
>   SSO_ALTERNATE_ENGINE_FQDNS="localhost:1"
> 
> I'd also suggest to avoid modifying the 11-setup-sso.conf file, as it
> will be overwritten if you run 'engine-setup' again, during an upgrade,
> for example. Instead of that try to create your own 99-my.conf file, for
> example.
> 
> Also, if you want this just for SSH, I'd suggest to use the SSH SOCKS
> proxy support instead. For example, I reach all my systems via SSH,
> using 'server.example.com <http://server.example.com>' as the SSH
> gateway. I start SSH like this:
> 
>   ssh -D 127.0.0.1:1 <http://127.0.0.1:1> server.example.com
> <http://server.example.com>
> 
> And then I configure my browser to use 127.0.0.1:1
> <http://127.0.0.1:1> as SOCKS proxy
> for *.example.com <http://example.com>.
> 
> 
> +1 to the SOCKS proxy - I use it too. You still need to be able to DNS
> resolve on your host -  though I believe there is a way to resolve over
> SOCKS as well. 
> Y. 
> 

I use Firefox, and it has a "Proxy DNS when using SOCKS 5" option that
you can tick/untick. I am not 100% sure, but I believe that other
browsers just enable it by default when a SOCKS5 proxy is used.

> 
> >
> > On January 27, 2017 1:10:33 AM GMT+02:00, Alex
> <rightkickt...@gmail.com <mailto:rightkickt...@gmail.com>>
> > wrote:
> >
> > Thank you Martin.
> > I will check that.
> >
> > On January 26, 2017 9:39:42 PM GMT+02:00, Martin Perina
> > <mper...@redhat.com <mailto:mper...@redhat.com>> wrote:
> >
> > Hi,
> >
> > please take a look at [1], since oVirt 4.0.4 you can defined
> > alternate names (or IPs) to access engine.
> >
> > Regards
> >
> > Martin Perina
> >
> > [1] https://bugzilla.redhat.com/show_bug.cgi?id=1325746
> <https://bugzilla.redhat.com/show_bug.cgi?id=1325746>
> >
> >
> > On Thu, Jan 26, 2017 at 6:59 PM, rightkicktech.gmail.com
> <http://rightkicktech.gmail.com>
> > <http://rightkicktech.gmail.com
> <http://rightkicktech.gmail.com>> <rightkickt...@gmail.com
> <mailto:rightkickt...@gmail.com>
> > <mailto:rightkickt...@gmail.com
> <mailto:rightkickt...@gmail.com>>> wrote:
> >
> > Hi all,
> >
> > Is there any way to bypass the FQDN access requirement on
> > ovirt 4? On previous versions I was able to access ovirt
> > engine using IP. It is impractical to access with FQDN
> when
> > doing remote port forwarding.
> >
> > Thanx,
> > Alex
> > --
> > Sent from my Android device with K-9 Mail. Please
> excuse my
> > brevity.
> > ___
> > Users mailing list
> > Users@ovirt.org <mailto:Users@ovirt.org>
> <mailto:Users@ovirt.org <mailto:Users@ovirt.org>>
> > http://lists.ovirt.org/mailman/listinfo/users
> <http://lists.ovirt.org/mailman/listinfo/users>
> > <http://lists.ovirt.org/mailman/listinfo/users
> <http://lists.ovirt.org/mailman/listinfo/users>>
> >
> >
> >
> >
> > --
> > Sent from my Android device with K-9 Mail. Please excuse my brevity.
> >
> >
> > ___
> > 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 <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


Re: [ovirt-users] Ovirt FQDN

2017-01-27 Thread Juan Hernández
On 01/27/2017 01:40 PM, rightkicktech.gmail.com wrote:
> Hi,
> 
> To clarify my previous. When adding localhost at
> SSO_ALTERNATE_ENGINE_FQDNS="localhost", then i was able to access
> through port forwarding. I tried to add IP and localhost, comma
> separated SSO_ALTERNATE_ENGINE_FQDNS="10.0.0.10
> <http://10.0.0.10>,localhost", and in this case i could not use localhost.
> Does this variable accepts comma separated values?
> 

It is a space separated list. It is documented here:


https://github.com/oVirt/ovirt-engine/blob/master/packaging/services/ovirt-engine/ovirt-engine.conf.in#L363-L366

> Thanx for the socks proxy. Yes, thats my last tactic when facing issues
> with port forwarding, though i need to go through two hops and makes it
> a bit more complex. The first hop does not have direct access to
> destination network and I dont have direct SSH access to final hop.
> 
> I will also add a custom config next to 11-setup-sso.conf file. Thanx
> for pointing it out.
> 
> Alex
> 
> 
> On January 27, 2017 1:32:14 PM EET, "Juan Hernández"
> <jhern...@redhat.com> wrote:
> 
> On 01/27/2017 11:56 AM, Alex wrote:
> 
> Hi,
> 
> I added the IP address at 11-setup-sso.conf (found at
> /etc/ovirt-engine/engine.conf.d), at line
> SSO_ALTERNATE_ENGINE_FQDNS="IP".
> Then restarted engine.
> I can access now engine vm using IP, but I cannot when connecting
> remotely using localhost and port forwarding through ssh. I
> tried to add
> also localhost as alternate fqdn without any luck.
> Any idea?
> 
> Many thanx,
> Alex
> 
> 
> Make sure to include also the port number that you are using. For
> example, if you are using port 1 then you will need this:
> 
>   SSO_ALTERNATE_ENGINE_FQDNS="localhost:1"
> 
> I'd also suggest to avoid modifying the 11-setup-sso.conf file, as it
> will be overwritten if you run 'engine-setup' again, during !
>  an
> upgrade,
> for example. Instead of that try to create your own 99-my.conf file, for
> example.
> 
> Also, if you want this just for SSH, I'd suggest to use the SSH SOCKS
> proxy support instead. For example, I reach all my systems via SSH,
> using 'server.example.com <http://server.example.com>' as the SSH 
> gateway. I start SSH like this:
> 
>   ssh -D 127.0.0.1:1 server.example.com <http://server.example.com>
> 
> And then I configure my browser to use 127.0.0.1:1 as SOCKS proxy
> for *.example.com <http://example.com>.
> 
> 
> On January 27, 2017 1:10:33 AM GMT+02:00, Alex
> <rightkickt...@gmail.com>
> wrote:
> 
> Thank you Martin.
> I will check that.
> 
> On January 26, 2! 017 9:39:42 PM GMT+02:00, Martin Perina
> <mper...@redhat.com> wrote:
> 
> Hi,
> 
> please take a look at [1], since oVirt 4.0.4 you can defined
> alternate names (or IPs) to access engine.
> 
> Regards
> 
> Martin Perina
> 
> [1] https://bugzilla.redhat.com/show_bug.cgi?id=1325746
> 
> 
> On Thu, Jan 26, 2017 at 6:59 PM, rightkicktech.gmail.com
> <http://rightkicktech.gmail.com>
> <http://rightkicktech.gmail.com> <rightkickt...@gmail.com
> <mailto:rightkickt...@gmail.com>> wrote:
> 
> Hi all,
> 
> Is there any way to bypass the FQDN access requirement on
> ovirt 4? On previous versions I was able to access ovirt
> engine us! ing IP. It is impractical to access with FQDN when
> doing remote port forwarding.
> 
> Thanx,
> Alex
> -- 
> Sent from my Android device with K-9 Mail. Please excuse my
> brevity.
> 
> 
> 
> Users mailing list
> Users@ovirt.org <mailto:Users@ovirt.org>
> http://lists.ovirt.org/mailman/listinfo/users
> <http://lists.ovirt.org/mailman/listinfo/users>
> 
> 
> 
> 
> -- 
> Sent from my Android device with K-9 Mail. Please excuse my brevity.
> 
> 
> 
> 
> 
> Users mailing list
> Users@ovirt.org
> http://lists.ovirt.org/mailman/listinfo/users
> 
> 
> 
> -- 
> Sent from my Android device with K-9 Mail. Please excuse my brevity.

___
Users mailing list
Users@ovirt.org
http://lists.ovirt.org/mailman/listinfo/users


Re: [ovirt-users] Ovirt FQDN

2017-01-27 Thread Juan Hernández
On 01/27/2017 11:56 AM, Alex wrote:
> Hi,
> 
> I added the IP address at 11-setup-sso.conf (found at
> /etc/ovirt-engine/engine.conf.d), at line SSO_ALTERNATE_ENGINE_FQDNS="IP".
> Then restarted engine.
> I can access now engine vm using IP, but I cannot when connecting
> remotely using localhost and port forwarding through ssh. I tried to add
> also localhost as alternate fqdn without any luck.
> Any idea?
> 
> Many thanx,
> Alex
> 

Make sure to include also the port number that you are using. For
example, if you are using port 1 then you will need this:

  SSO_ALTERNATE_ENGINE_FQDNS="localhost:1"

I'd also suggest to avoid modifying the 11-setup-sso.conf file, as it
will be overwritten if you run 'engine-setup' again, during an upgrade,
for example. Instead of that try to create your own 99-my.conf file, for
example.

Also, if you want this just for SSH, I'd suggest to use the SSH SOCKS
proxy support instead. For example, I reach all my systems via SSH,
using 'server.example.com' as the SSH gateway. I start SSH like this:

  ssh -D 127.0.0.1:1 server.example.com

And then I configure my browser to use 127.0.0.1:1 as SOCKS proxy
for *.example.com.

> 
> On January 27, 2017 1:10:33 AM GMT+02:00, Alex 
> wrote:
> 
> Thank you Martin.
> I will check that.
> 
> On January 26, 2017 9:39:42 PM GMT+02:00, Martin Perina
>  wrote:
> 
> Hi,
> 
> please take a look at [1], since oVirt 4.0.4 you can defined
> alternate names (or IPs) to access engine.
> 
> Regards
> 
> Martin Perina
> 
> [1] https://bugzilla.redhat.com/show_bug.cgi?id=1325746
> 
> 
> On Thu, Jan 26, 2017 at 6:59 PM, rightkicktech.gmail.com
>   > wrote:
> 
> Hi all,
> 
> Is there any way to bypass the FQDN access requirement on
> ovirt 4? On previous versions I was able to access ovirt
> engine using IP. It is impractical to access with FQDN when
> doing remote port forwarding.
> 
> Thanx,
> Alex
> -- 
> Sent from my Android device with K-9 Mail. Please excuse my
> brevity.
> ___
> Users mailing list
> Users@ovirt.org 
> http://lists.ovirt.org/mailman/listinfo/users
> 
> 
> 
> 
> 
> -- 
> Sent from my Android device with K-9 Mail. Please excuse my brevity.
> 
> 
> ___
> Users mailing list
> Users@ovirt.org
> http://lists.ovirt.org/mailman/listinfo/users
> 

___
Users mailing list
Users@ovirt.org
http://lists.ovirt.org/mailman/listinfo/users


Re: [ovirt-users] get UI working throug ALIAS and real hostname

2017-01-24 Thread Juan Hernández
On 01/24/2017 03:49 PM, Doug Ingham wrote:
> On 24 January 2017 at 15:15, emanuel.santosvar...@mahle.com
> <mailto:emanuel.santosvar...@mahle.com> wrote:
> 
> If I access the UI via "ALIAS" I get the Error-Page "The client is
> not authorized to request an authorization. It's required to access
> the system using FQDN.
> 
> What can I do to get UI working through ALIAS and real hostname?
> 
> 
> The Hosted-Engine should be installed & configured with the correct FQDN
> to begin with. Changing it post install is currently unsupported & can
> cause a whole host of problems. There are a couple of documented cases
> where people have attempted to do so with varying success, but non have
> come out problem free.
> 
> I'm currently in the same situation after a company domain change and
> have decided that the risk of unforeseen issues & potential problems
> down the line, are far greater than the pain of redeploying & migrating
> to a new environment.
> 
> A really hacky hack, without interfering with the engine, would be to
> try & put a reverse proxy in front, but that'll require a load of
> dynamic rewriting filters to work.
> 
> 
> On 24 January 2017 at 11:41, Juan Hernández <jhern...@redhat.com
> <mailto:jhern...@redhat.com>> wrote:
> 
> Create a 99-whatever-you-like.conf file in
> /etc/ovirt-engine/engine.conf.d with the following content:
> 
>   SSO_ALTERNATE_ENGINE_FQDNS="thealias"
> 
> Then restart the engine:
> 
>   systemctl restart ovirt-engine
> 
> This setting is documented here:
> 
> 
> 
> https://github.com/oVirt/ovirt-engine/blob/master/packaging/services/ovirt-engine/ovirt-engine.conf.in#L363-L366
> 
> <https://github.com/oVirt/ovirt-engine/blob/master/packaging/services/ovirt-engine/ovirt-engine.conf.in#L363-L366>
> 
> 
> AFAIK, the SSL certificates will still need updating & I've read of
> people still having other issues due to differing FQDNs. Being able to
> update the HE's FQDN would be of big interest to me, but I've not yet
> seen one case where it didn't end with anomalies...
> 

Correct, if the FQDN of the engine changes it is a completely different
story. But in this case my understanding is that the objective is
accessing the engine using an alternative name, probably a DNS CNAME. In
that case changing the configuration as proposed should work.

___
Users mailing list
Users@ovirt.org
http://lists.ovirt.org/mailman/listinfo/users


Re: [ovirt-users] get UI working throug ALIAS and real hostname

2017-01-24 Thread Juan Hernández
On 01/24/2017 03:15 PM, emanuel.santosvar...@mahle.com wrote:
> If I access the UI via "ALIAS" I get the Error-Page "The client is not
> authorized to request an authorization. It's required to access the
> system using FQDN.
> 
> What can I do to get UI working through ALIAS and real hostname?
> 
> Thx,
> Emanuel
> 

Create a 99-whatever-you-like.conf file in
/etc/ovirt-engine/engine.conf.d with the following content:

  SSO_ALTERNATE_ENGINE_FQDNS="thealias"

Then restart the engine:

  systemctl restart ovirt-engine

This setting is documented here:


https://github.com/oVirt/ovirt-engine/blob/master/packaging/services/ovirt-engine/ovirt-engine.conf.in#L363-L366

___
Users mailing list
Users@ovirt.org
http://lists.ovirt.org/mailman/listinfo/users


Re: [ovirt-users] [PySDK v3] Choose storage domain

2017-01-24 Thread Juan Hernández
On 01/24/2017 01:18 PM, Nicolas Ecarnot wrote:
> Juan,
> 
> Thank you very much for your help, this is working.
> 
> Some comments below.
> 
> Le 24/01/2017 à 11:04, Juan Hernández a écrit :
>> In order to do that you need to specify that you want to clone the disks
>> of the template, and for each disk you need to specify the storage
>> domain where you want to create it.
> 
> This is what I feared, and it was not really obvious at first sight (to
> prepare a disks list...).
> I think I saw it was less weird in V4.
> 
>> [...]
> 
>> Also, please be careful when specifying the cluster and the template.
>> You are currently doing this:
>>
>>   cluster=vm_cluster,
>>   template=vm_template,
>>
>> Not sure how you are assigning the values to those 'vm_cluster' and
>> 'vm_template' variables, but you are probably doing this:
>>
>>   vm_cluster = api.vms.get(name='mycluster')
>>   vm_template = api.vms.get(name='mytemplate')
> 
> Here is what I was doing (please don't laugh) :
> 
> c_list = api.clusters.list()
> # At present (2017), each datacenter contains only one cluster
> vm_cluster = c_list[0]
> 
> vm_template = api.templates.get(name=template_name)
> 
>> That combination isn't ideal, because you will be sending with the 'add'
>> request the complete representation of the cluster and the template,
>> when the server only needs the id or the name. Consider doing this
>> instead:
>>
>>   cluster=params.Cluster(
>> id=vm_cluster.get_id()
>>   ),
>>   template=params.Cluster(
>> id=vm_template.get_id()
>>   ),
> 
> Is it right to say that this last method is only valid in the api
> context, and would not work outside of the api object scope?
> I mean : if I want to use your method, I can no longer separate the
> preparation of a vm_params object before calling the vms.add, right?
> 
> 
> 
> 
> OK, just one second before sending this e-mail, I made a quick test with
> the template object and it is working anyway.
> Does it mean nothing is instantiated before the api.vms.add call?
> 

The concern is not about preparing the objects before calling vms.add,
that is perfectly OK. The concern is what that prepared object contains.
With the code you are using currently you will be sending to the server
the complete representation of the cluster and the template. Run debug
on, with the "debug=True" parameter of the API constructor, and you will
see it, you will be sending a request like this:

  POST /ovirt-engine/api/vms

With a request body like this:

  

  mycluster
  My cluster
  ...
  ...
  


  

...
  

All those cluster and template attributes aren't needed, the server will
just ignore them, because it only needs the name (or id):

  

  mycluster


  mytemplate

...
  

So it is a waste of resources, and in some cases it may trigger hidden bugs.

If you still want to prepare the variables before calling the vms.add
method, just build their values so that they contain only the values (in
this case is better to use the id instead of the name, as it is more
specific):

  vm_template=api.templates.get(name=template_name)
  vm_template=params.Template(
id=vm_template.get_id()
  )

This isn't very convenient if you want to use other attributes of the
'vm_template' object later. That is why my recommendation is to create
this temporary 'params.Template' object within the call to the 'vms.add'
method:

  vms.add(
vm=params.Vm(
  template=params.Template(
id=vm_template.get_id()
  ),
  ...
)
  )

Just consider this as a good practice.

___
Users mailing list
Users@ovirt.org
http://lists.ovirt.org/mailman/listinfo/users


Re: [ovirt-users] [PySDK v3] Choose storage domain

2017-01-24 Thread Juan Hernández
On 01/24/2017 10:13 AM, Nicolas Ecarnot wrote:
> Hello,
> 
> When trying to create a VM by cloning a template, I found out I couldn't
> choose the target storage domain :
> 
> [...]
> vm_storage_domain = api.storagedomains.get(name=storage_domain)
> vm_params = params.VM(name=vm_name,
> memory=vm_memory,
> cluster=vm_cluster,
> template=vm_template,
> os=vm_os,
> storage_domain=vm_storage_domain,
> )
> try:
> api.vms.add(vm=vm_params)
> [...]
> 
> I'm getting :
> Failed to create VM from Template:
> 
> status: 400
> reason: Bad Request
> detail: Cannot add VM. The selected Storage Domain does not contain the
> VM Template.
> 
> ... which I know, but I thought that, as with the GUI, I could specify
> the target storage domain.
> 
> I made my homework, and I found a nice answer from Juan :
> http://lists.ovirt.org/pipermail/users/2016-January/037321.html
> but this relates to snapshots, and not to template usage, so I'm still
> stuck.
> May I ask an advice?
> 

In order to do that you need to specify that you want to clone the disks
of the template, and for each disk you need to specify the storage
domain where you want to create it. Should be something like this:

---8<---
# Find the identifiers of the disks of the template:
template = api.templates.get(name='mytemplate')
disk_ids = [disk.get_id() for disk in template.disks.list()]

# Find the target storage domain:
sd = api.storagedomains.get(name='yourdata')

# Prepare a list of disks that specifies the target storage domain
# for each disk of the template:
disks = []
for disk_id in disk_ids:
disk = params.Disk(
id=disk_id,
storage_domains=params.StorageDomains(
storage_domain=[
params.StorageDomain(
id=sd.get_id()
)
]
)
)
disks.append(disk)

# Create the virtual machine, specifying that the list should
# be cloned, and to which storage domain they should be cloned:
api.vms.add(
vm=params.VM(
name='myvm',
cluster=params.Cluster(
name='mycluster'
),
template=params.Template(
name='mytemplate',
),
disks=params.Disks(
clone=True,
disk=disks
)
)
)
--->8---

Also, please be careful when specifying the cluster and the template.
You are currently doing this:

  cluster=vm_cluster,
  template=vm_template,

Not sure how you are assigning the values to those 'vm_cluster' and
'vm_template' variables, but you are probably doing this:

  vm_cluster = api.vms.get(name='mycluster')
  vm_template = api.vms.get(name='mytemplate')

That combination isn't ideal, because you will be sending with the 'add'
request the complete representation of the cluster and the template,
when the server only needs the id or the name. Consider doing this instead:

  cluster=params.Cluster(
id=vm_cluster.get_id()
  ),
  template=params.Cluster(
id=vm_template.get_id()
  ),

Or just the names, as in the example above.

___
Users mailing list
Users@ovirt.org
http://lists.ovirt.org/mailman/listinfo/users


Re: [ovirt-users] oVirt Python SDK on Ubuntu

2017-01-23 Thread Juan Hernández
On 01/23/2017 03:05 PM, Ondra Machacek wrote:
> On Mon, Jan 23, 2017 at 2:53 PM, Nicolas Ecarnot  wrote:
>> Le 23/01/2017 à 13:38, Ondra Machacek a écrit :
>>>
>>> On Mon, Jan 23, 2017 at 1:23 PM, Nicolas Ecarnot 
>>> wrote:

 Hello,

 I'm trying to follow

 http://www.ovirt.org/develop/release-management/features/infra/python-sdk/
 and I'm successfully discovering Python + oVirt SDK on CentOS.

 I'd like to do the same on Ubuntu, but the instructions seem incomplete :

 "
 easy_install ovirt-engine-sdk-python
 "

 is working, but "import ovirtsdk" doen't give anything.
>>>
>>>
>>> Note that the wiki page is about SDK version 3, which will be deprecated
>>> in 4.2.
>>> When you run 'easy_install ovirt-engine-sdk-python' it will install
>>> Python SDK version
>>> 4, which is different from SDK version 3.
>>
>>
>> You're right, and I haven't noticed : import ovirtsdk4 is working.
>>
>>>
>>> You may find few examples of Python SDK version 4 here:
>>>
>>>  https://github.com/oVirt/ovirt-engine-sdk/tree/master/sdk/examples
>>
>>
>> Yes, this list of examples is a treasure, and I'm grateful to the
>> maintainers.
>>
>> Alas, though we already have one DC in V4, most of our production DCs are
>> still in V3 for one year, and I have to maintain them.
>> So far, I have no clue how to add ovirtsdk v3 to my Ubuntu.
> 
> You just need to specify which version you would like to install, in your 
> case:
> 
>  easy_install ovirt-engine-sdk-python==3.6.9.2
> 
>>
>> Another point : is the compatibility between ovirtsdk and oVirt completely
>> obvious (ie 3 -> 3 and 4 -> 4), or is there any kind of backward
>> compatibility?
> 
> Unfortunatelly no, there is no backward compatibility between SDK v3 and v4.
> 

Just to clarify this:

1. Version 3 of the SDK only works with version 3 of the API.

2. Version 4 of the SDK only works with version 4 of the API.

3. Version 3 of the engine only supports version 3 of the API.

4. Versions 4.0 and 4.1 of the engine support both version 3 and 4 of
the API. This means that with version 4 of the engine you can use both
versions of the SDK. This will change with version 4.2 of the engine.
There we will remove support for version 3 of the API, so you will need
to use version 4 of the SDK.

___
Users mailing list
Users@ovirt.org
http://lists.ovirt.org/mailman/listinfo/users


Re: [ovirt-users] Attach Storage via CLI

2017-01-21 Thread Juan Hernández
On 01/20/2017 03:30 PM, Steffen Nolden wrote:
> Hi,
> 
> i have create a storagedomain with ovirt-shell:
> 
> add storagedomain --host-name  --type data --storage-type
> glusterfs --storage-path :/data --storage-vfs_type glusterfs --name
> Data-Domain
> 
> 
> Now i try to attach it to the data-center. I found this command
> 
> add storagedomain --datacenter-identifier Default --name Data-Domain
> 
> 
> But i got this Error-MSG:
> 
> ===
> ERROR
> ===
> cannot construct collection/member view, checked variants are:
> [('--datacenter-identifier',)].
> ===
> 
> 
> What is wrong..  or how can i attach a storagedomain to a data-center
> via CLI?
> 
> Thanks
> 

Should be this command:

  add storagedomain --parent-datacenter-name Default --name Data-Domain

Please note that the CLI is based on version 3 of the API, which is
deprecated since version 4 of the engine, and will be removed in versoin
4.2. Consider using one of the version 4 SDKs for your scripts. Here you
have some examples:

  Python:

https://github.com/oVirt/ovirt-engine-sdk/blob/master/sdk/examples/attach_nfs_data_storage_domain.py

  Ruby:

https://github.com/oVirt/ovirt-engine-sdk-ruby/blob/master/sdk/examples/attach_nfs_data_storage_domain.rb

  Java:

https://github.com/oVirt/ovirt-engine-sdk-java/blob/master/sdk/src/test/java/org/ovirt/engine/sdk4/examples/AttachNfsDataStorageDomain.java
___
Users mailing list
Users@ovirt.org
http://lists.ovirt.org/mailman/listinfo/users


Re: [ovirt-users] Delay difference between queries (Python vs REST)

2017-01-18 Thread Juan Hernández
On 01/17/2017 08:42 PM, Yaniv Kaul wrote:
> 
> 
> On Tue, Jan 17, 2017 at 6:03 PM, Juan Hernández <jhern...@redhat.com
> <mailto:jhern...@redhat.com>> wrote:
> 
> On 01/17/2017 04:59 PM, Nicolas Ecarnot wrote:
>     > Le 17/01/2017 à 16:26, Juan Hernández a écrit :
> >> On 01/17/2017 03:56 PM, Nicolas Ecarnot wrote:
> >>> Hello,
> >>>
> >>> On a 3.6.5 DC, I'm trying to figure out how many VMs there are,
> using
> >>> two methods :
> >>>
> >>> _*Python SDK :*_
> >>>
> >>> *from ovirtsdk.xml import params
> >>> from ovirtsdk.api import API
> >>> api = API(url='https://engine.fqdn/ovirt-engine/api
> <https://engine.fqdn/ovirt-engine/api>',
> >>> username='admin@internal', password='xxx', insecure=True)
> >>> print len(api.vms.list())*
> >>>
> >>> time ./getMvm.py
> >>> 62
> >>>
> >>> real0m23.016s
> >>> user0m22.288s
> >>> sys0m0.054s
> >>>
> >>>
> >>> _*REST :*_
> >>>
> >>> *time curl -H "Version: 3" -H "Prefer: persistent-auth" -H "Filter:
> >>> false" -H "Accept: application/xml" -H "Content-Type:
> application/xml"
> >>> -k -u 'admin@internal:xxx'
> https://***engine.fqdn*/ovirt-engine/api/vms*
> >>>
> >>> (Then grep or anything that would get the values from the xml
> returned.)
> >>>
> >>> real0m0.383s
> >>> user0m0.036s
> >>> sys0m0.038s
> >>>
> >>>
> >>> I am a beginner in both methods, but I would prefer play with
> Python.
> >>> I'm very surprised to have to wait more than 20 seconds to get an
> >>> answer.
> >>> Looking at the engine log, I see that the authentication part is
> >>> finished after say 3 seconds, then 20 seconds with absolutely no
> error
> >>> message, no CPU load, no RAM burst, no nothing.
> >>> On the SPM, exactly triple null nothing nada niet void is obviously
> >>> explaining such a delay.
> >>>
> >>> I'm wondering if this super hyper sluggishness is somewhat
> related to
> >>> the GUI global slowness I'm experiencing like other users since
> we left
> >>> 3.2.x, and I would love that some oVirt ninja uses the
> comparison above
> >>> to tell what parts in oVirt is used or not that could explain such a
> >>> difference (database, access to SPM, LVM, network access,
> whatever...)
> >>>
> >>> --
> >>> Nicolas ECARNOT
> >>>
> >>
> >> The performance problem is inside version 3 of the Python SDK.
> That is
> >> one of the reasons that we had to do a new version of the Python
> SDK for
> >> version 4 of the engine. If you are using version 4 of the engine
> then
> >> you can use version 4 of the SDK:
> >>
> >>   https://github.com/oVirt/ovirt-engine-sdk/tree/master/sdk
> <https://github.com/oVirt/ovirt-engine-sdk/tree/master/sdk>
> >>
> >>
> 
> https://github.com/oVirt/ovirt-engine-sdk/blob/master/sdk/examples/list_vms.py
> 
> <https://github.com/oVirt/ovirt-engine-sdk/blob/master/sdk/examples/list_vms.py>
> >>
> >>
> >> It should be much faster. Would be nice if you can repeat your
> test and
> >> report the results.
> >>
> >
> > Hello Juan,
> >
> > Indeed, you were right. I tried the same from a recent server with a
> > recent SDK, and I let you have a look :
> >
> > # rpm -q python-ovirt-engine-sdk4
> > python-ovirt-engine-sdk4-4.0.1-1.el7.centos.x86_64
> >
> > # time ./getMvm.py
> > 62
> >
> > real0m1.004s
> > user0m0.234s
> > sys0m0.031s
> >
> > And repeating the same test gives a very decent average, so thank you.
> >
> 
> Twenty times faster, approx, good to know. Thanks. By the way, if you
> want even better performance, then make sure to disable debug and enable
> compression:
> 
>   connection = sdk.Connection(
> ...
> debug=False,
> compress=True,
>   )
> 
> 
> Shouldn't it be the default?
> Y.
>  

Debug is disabled by default, but in is enabled in almost all the
examples. As I suggested an example I also suggest to makes sure to
disable it.

Compression is enabled by default in version 4.1 of the SDK, which isn't
released yet. In version 4.0 it needs to be enabled explicitly.
___
Users mailing list
Users@ovirt.org
http://lists.ovirt.org/mailman/listinfo/users


Re: [ovirt-users] Delay difference between queries (Python vs REST)

2017-01-17 Thread Juan Hernández
On 01/17/2017 04:59 PM, Nicolas Ecarnot wrote:
> Le 17/01/2017 à 16:26, Juan Hernández a écrit :
>> On 01/17/2017 03:56 PM, Nicolas Ecarnot wrote:
>>> Hello,
>>>
>>> On a 3.6.5 DC, I'm trying to figure out how many VMs there are, using
>>> two methods :
>>>
>>> _*Python SDK :*_
>>>
>>> *from ovirtsdk.xml import params
>>> from ovirtsdk.api import API
>>> api = API(url='https://engine.fqdn/ovirt-engine/api',
>>> username='admin@internal', password='xxx', insecure=True)
>>> print len(api.vms.list())*
>>>
>>> time ./getMvm.py
>>> 62
>>>
>>> real0m23.016s
>>> user0m22.288s
>>> sys0m0.054s
>>>
>>>
>>> _*REST :*_
>>>
>>> *time curl -H "Version: 3" -H "Prefer: persistent-auth" -H "Filter:
>>> false" -H "Accept: application/xml" -H "Content-Type: application/xml"
>>> -k -u 'admin@internal:xxx' https://***engine.fqdn*/ovirt-engine/api/vms*
>>>
>>> (Then grep or anything that would get the values from the xml returned.)
>>>
>>> real0m0.383s
>>> user0m0.036s
>>> sys0m0.038s
>>>
>>>
>>> I am a beginner in both methods, but I would prefer play with Python.
>>> I'm very surprised to have to wait more than 20 seconds to get an
>>> answer.
>>> Looking at the engine log, I see that the authentication part is
>>> finished after say 3 seconds, then 20 seconds with absolutely no error
>>> message, no CPU load, no RAM burst, no nothing.
>>> On the SPM, exactly triple null nothing nada niet void is obviously
>>> explaining such a delay.
>>>
>>> I'm wondering if this super hyper sluggishness is somewhat related to
>>> the GUI global slowness I'm experiencing like other users since we left
>>> 3.2.x, and I would love that some oVirt ninja uses the comparison above
>>> to tell what parts in oVirt is used or not that could explain such a
>>> difference (database, access to SPM, LVM, network access, whatever...)
>>>
>>> -- 
>>> Nicolas ECARNOT
>>>
>>
>> The performance problem is inside version 3 of the Python SDK. That is
>> one of the reasons that we had to do a new version of the Python SDK for
>> version 4 of the engine. If you are using version 4 of the engine then
>> you can use version 4 of the SDK:
>>
>>   https://github.com/oVirt/ovirt-engine-sdk/tree/master/sdk
>>
>> https://github.com/oVirt/ovirt-engine-sdk/blob/master/sdk/examples/list_vms.py
>>
>>
>> It should be much faster. Would be nice if you can repeat your test and
>> report the results.
>>
> 
> Hello Juan,
> 
> Indeed, you were right. I tried the same from a recent server with a
> recent SDK, and I let you have a look :
> 
> # rpm -q python-ovirt-engine-sdk4
> python-ovirt-engine-sdk4-4.0.1-1.el7.centos.x86_64
> 
> # time ./getMvm.py
> 62
> 
> real0m1.004s
> user0m0.234s
> sys0m0.031s
> 
> And repeating the same test gives a very decent average, so thank you.
> 

Twenty times faster, approx, good to know. Thanks. By the way, if you
want even better performance, then make sure to disable debug and enable
compression:

  connection = sdk.Connection(
...
debug=False,
compress=True,
  )

___
Users mailing list
Users@ovirt.org
http://lists.ovirt.org/mailman/listinfo/users


Re: [ovirt-users] Delay difference between queries (Python vs REST)

2017-01-17 Thread Juan Hernández
On 01/17/2017 03:56 PM, Nicolas Ecarnot wrote:
> Hello,
> 
> On a 3.6.5 DC, I'm trying to figure out how many VMs there are, using
> two methods :
> 
> _*Python SDK :*_
> 
> *from ovirtsdk.xml import params
> from ovirtsdk.api import API
> api = API(url='https://engine.fqdn/ovirt-engine/api',
> username='admin@internal', password='xxx', insecure=True)
> print len(api.vms.list())*
> 
> time ./getMvm.py
> 62
> 
> real0m23.016s
> user0m22.288s
> sys0m0.054s
> 
> 
> _*REST :*_
> 
> *time curl -H "Version: 3" -H "Prefer: persistent-auth" -H "Filter:
> false" -H "Accept: application/xml" -H "Content-Type: application/xml"
> -k -u 'admin@internal:xxx' https://***engine.fqdn*/ovirt-engine/api/vms*
> 
> (Then grep or anything that would get the values from the xml returned.)
> 
> real0m0.383s
> user0m0.036s
> sys0m0.038s
> 
> 
> I am a beginner in both methods, but I would prefer play with Python.
> I'm very surprised to have to wait more than 20 seconds to get an answer.
> Looking at the engine log, I see that the authentication part is
> finished after say 3 seconds, then 20 seconds with absolutely no error
> message, no CPU load, no RAM burst, no nothing.
> On the SPM, exactly triple null nothing nada niet void is obviously
> explaining such a delay.
> 
> I'm wondering if this super hyper sluggishness is somewhat related to
> the GUI global slowness I'm experiencing like other users since we left
> 3.2.x, and I would love that some oVirt ninja uses the comparison above
> to tell what parts in oVirt is used or not that could explain such a
> difference (database, access to SPM, LVM, network access, whatever...)
> 
> -- 
> Nicolas ECARNOT
> 

The performance problem is inside version 3 of the Python SDK. That is
one of the reasons that we had to do a new version of the Python SDK for
version 4 of the engine. If you are using version 4 of the engine then
you can use version 4 of the SDK:

  https://github.com/oVirt/ovirt-engine-sdk/tree/master/sdk

https://github.com/oVirt/ovirt-engine-sdk/blob/master/sdk/examples/list_vms.py

It should be much faster. Would be nice if you can repeat your test and
report the results.

___
Users mailing list
Users@ovirt.org
http://lists.ovirt.org/mailman/listinfo/users


Re: [ovirt-users] Max number of api calls per user?

2017-01-12 Thread Juan Hernández
T
> /ovirt-engine/api HTTP/1.1" 200 4395
> 2001:67c:1933:c01:faba:c0de:ba5e:4522 - - [11/Jan/2017:14:57:23 +0100] "GET
> /ovirt-engine/api/vms;case_sensitive=True HTTP/1.1" 200 1012092
> 2001:67c:1933:c01:faba:c0de:ba5e:4522 - - [11/Jan/2017:14:57:24 +0100] "GET
> /ovirt-engine/api HTTP/1.1" 200 4395
> 2001:67c:1933:c01:faba:c0de:ba5e:4522 - - [11/Jan/2017:14:57:24 +0100] "GET
> /ovirt-engine/api/vms;case_sensitive=True HTTP/1.1" 200 1012092
> 2001:67c:1933:c01:faba:c0de:ba5e:4522 - - [11/Jan/2017:14:57:25 +0100] "GET
> /ovirt-engine/api HTTP/1.1" 200 4395
> 2001:67c:1933:c01:faba:c0de:ba5e:4522 - - [11/Jan/2017:14:57:25 +0100] "GET
> /ovirt-engine/api/vms;case_sensitive=True HTTP/1.1" 200 1012092
> 2001:67c:1933:c01:faba:c0de:ba5e:4522 - - [11/Jan/2017:14:57:26 +0100] "GET
> /ovirt-engine/api HTTP/1.1" 200 4395
> 2001:67c:1933:c01:faba:c0de:ba5e:4522 - - [11/Jan/2017:14:57:26 +0100] "GET
> /ovirt-engine/api/vms;case_sensitive=True HTTP/1.1" 200 1012092
> 2001:67c:1933:c01:faba:c0de:ba5e:4522 - - [11/Jan/2017:14:57:27 +0100] "GET
> /ovirt-engine/api HTTP/1.1" 200 4395
> 2001:67c:1933:c01:faba:c0de:ba5e:4522 - - [11/Jan/2017:14:57:29 +0100] "GET
> /ovirt-engine/api HTTP/1.1" 200 4395
> 2001:67c:1933:c01:faba:c0de:ba5e:4522 - - [11/Jan/2017:14:57:29 +0100] "GET
> /ovirt-engine/api/vms;case_sensitive=True HTTP/1.1" 200 1012092
> 2001:67c:1933:c01:faba:c0de:ba5e:4522 - - [11/Jan/2017:14:57:29 +0100] "GET
> /ovirt-engine/api/vms;case_sensitive=True HTTP/1.1" 200 1012092
> 2001:67c:1933:c01:faba:c0de:ba5e:4522 - - [11/Jan/2017:14:57:29 +0100] "GET
> /ovirt-engine/api HTTP/1.1" 200 4395
> 2001:67c:1933:c01:faba:c0de:ba5e:4522 - - [11/Jan/2017:14:57:30 +0100] "GET
> /ovirt-engine/api HTTP/1.1" 200 4395
> 2001:67c:1933:c01:faba:c0de:ba5e:4522 - - [11/Jan/2017:14:57:30 +0100] "GET
> /ovirt-engine/api/vms;case_sensitive=True HTTP/1.1" 200 1012092
> 2001:67c:1933:c01:faba:c0de:ba5e:4522 - - [11/Jan/2017:14:57:30 +0100] "GET
> /ovirt-engine/api/vms;case_sensitive=True HTTP/1.1" 200 1012092
> 2001:67c:1933:c01:faba:c0de:ba5e:4522 - - [11/Jan/2017:14:57:31 +0100] "GET
> /ovirt-engine/api HTTP/1.1" 200 4395
> 2001:67c:1933:c01:faba:c0de:ba5e:4522 - - [11/Jan/2017:14:57:31 +0100] "GET
> /ovirt-engine/api/vms;case_sensitive=True HTTP/1.1" 200 1012092
> 2001:67c:1933:c01:faba:c0de:ba5e:4522 - - [11/Jan/2017:14:57:32 +0100] "GET
> /ovirt-engine/api HTTP/1.1" 200 4395
> 2001:67c:1933:c01:faba:c0de:ba5e:4522 - - [11/Jan/2017:14:57:32 +0100] "GET
> /ovirt-engine/api/vms;case_sensitive=True HTTP/1.1" 200 990370
> 2001:67c:1933:c01:faba:c0de:ba5e:4522 - - [11/Jan/2017:14:57:33 +0100] "GET
> /ovirt-engine/api HTTP/1.1" 200 4395
> 2001:67c:1933:c01:faba:c0de:ba5e:4522 - - [11/Jan/2017:14:57:33 +0100] "GET
> /ovirt-engine/api/vms;case_sensitive=True HTTP/1.1" 200 1012092
> 2001:67c:1933:c01:faba:c0de:ba5e:4522 - - [11/Jan/2017:14:57:34 +0100] "GET
> /ovirt-engine/api HTTP/1.1" 200 4395
> 2001:67c:1933:c01:faba:c0de:ba5e:4522 - - [11/Jan/2017:14:57:35 +0100] "GET
> /ovirt-engine/api/vms;case_sensitive=True HTTP/1.1" 401 155
> 2001:67c:1933:c01:faba:c0de:ba5e:4522 - - [11/Jan/2017:14:57:35 +0100] "GET
> /ovirt-engine/api HTTP/1.1" 200 4395
> 2001:67c:1933:c01:faba:c0de:ba5e:4522 - - [11/Jan/2017:14:57:36 +0100] "GET
> /ovirt-engine/api/vms;case_sensitive=True HTTP/1.1" 200 1012092
> 2001:67c:1933:c01:faba:c0de:ba5e:4522 - - [11/Jan/2017:14:57:37 +0100] "GET
> /ovirt-engine/api HTTP/1.1" 200 4395
> 2001:67c:1933:c01:faba:c0de:ba5e:4522 - - [11/Jan/2017:14:57:37 +0100] "GET
> /ovirt-engine/api HTTP/1.1" 200 4395
> 2001:67c:1933:c01:faba:c0de:ba5e:4522 - - [11/Jan/2017:14:57:37 +0100] "GET
> /ovirt-engine/api/vms;case_sensitive=True HTTP/1.1" 200 1012092
> 2001:67c:1933:c01:faba:c0de:ba5e:4522 - - [11/Jan/2017:14:57:37 +0100] "GET
> /ovirt-engine/api/vms;case_sensitive=True HTTP/1.1" 200 1012092
> 2001:67c:1933:c01:faba:c0de:ba5e:4522 - - [11/Jan/2017:14:57:38 +0100] "GET
> /ovirt-engine/api HTTP/1.1" 200 4395
> 2001:67c:1933:c01:faba:c0de:ba5e:4522 - - [11/Jan/2017:14:57:38 +0100] "GET
> /ovirt-engine/api/vms;case_sensitive=True HTTP/1.1" 200 1012092
> 2001:67c:1933:c01:faba:c0de:ba5e:4522 - - [11/Jan/2017:14:57:39 +0100] "GET
> /ovirt-engine/api HTTP/1.1" 200 4395
> 
> 
> 
> Thx Christian
> 
> -Ursprüngliche Nachricht-
> Von: Juan Hernández [mailto:jhern...@redhat.com] 
> Gesendet: Mittwoch, 11. Jänner 2017 15:26
> An: Grundmann, Christian <christian.grundm...@fabasoft.com>;
> 'users@ov

Re: [ovirt-users] Specifying the datastore on a VmPool creation via Python-SDK?

2017-01-12 Thread Juan Hernández
On 01/11/2017 03:53 PM, nico...@devels.es wrote:
> Any ideas to this?
> 

My understanding is that there is no way to this with the API currently.
If you need it, please open a RFE. Meanwhile, I'd suggest to copy the
templates to the storage domain that you want to use, and then use the
copied templates. I don't see any other alternative.

> El 2017-01-10 08:43, nico...@devels.es escribió:
>> Hi,
>>
>> We've several templates that have their disks replicated (copied) on
>> all our Storage Domains. Problem is that we create our VmPools using
>> PythonSDK, and it usually creates the pool on one of our Storage
>> Domains that has a small amount of free disk space.
>>
>> Some of the Data Stores have plenty of space and when creating the
>> VmPool, we'd like to be able to specify on which of these Storage
>> Domains to create the VmPool. So far I see no parameter on the
>> params.VmPool class to do that. I've tried using an Action, but the
>> request is not correct:
>>
>>   action =
>> params.Action(storage_domain=api.storagedomains.get(name='...'))
>>
>>   pool = params.VmPool(name='testlarge',
>> cluster=api.clusters.get(name='...'),
>> template=api.templates.get(name='Blank'), max_user_vms=1, size=1,
>> type_='manual', actions=action)
>>   pool = params.VmPool(name='testlarge',
>> cluster=api.clusters.get(name='...'),
>> template=api.templates.get(name='Blank'), max_user_vms=1, size=1,
>> type_='manual', actions=[action])
>>
>>   api.vmpools.add(pool)
>>
>> Both tries fail.
>>
>> This is Python-SDK 3.x.
>>
>> Is there a way to specify the destination Storage Domain onto where to
>> create the VmPool?
>>
>> Thanks
>> ___
>> Users mailing list
>> Users@ovirt.org
>> http://lists.ovirt.org/mailman/listinfo/users
> ___
> Users mailing list
> Users@ovirt.org
> http://lists.ovirt.org/mailman/listinfo/users

___
Users mailing list
Users@ovirt.org
http://lists.ovirt.org/mailman/listinfo/users


Re: [ovirt-users] Max number of api calls per user?

2017-01-11 Thread Juan Hernández
On 01/11/2017 03:16 PM, Grundmann, Christian wrote:
> Hi,
> 
> is there a maximum number of sessions per user?
> 

There is no limit, except the available memory.

>  
> 
> I am doing python-api calls to remove VMs
> 
> If I call my script 30 times simultaneously, one or two get an error.
>

What does 'simultaneously' mean exactly? Are you sending the requests in
parallel from different threads? Or from different processes? Or just
sending them in a loop?

The /var/log/ovirt-engine/server.log, /var/log/ovirt-engine/engine.log
and /var/log/httpd/ssl_access_log files can help determine what is
happening. Can you check and maybe share the relevant part of those files?

>  
> 
> Traceback (most recent call last):
> 
>   File "remove_vm.py", line 24, in 
> 
> if VMNAME in [vm.name for vm in api.vms.list()]:
> 
>   File
> "/usr/lib/python2.7/site-packages/ovirtsdk/infrastructure/brokers.py",
> line 35761, in list
> 
> headers={"All-Content":all_content}
> 
>   File
> "/usr/lib/python2.7/site-packages/ovirtsdk/infrastructure/proxy.py",
> line 46, in get
> 
> return self.request(method='GET', url=url, headers=headers, cls=cls)
> 
>   File
> "/usr/lib/python2.7/site-packages/ovirtsdk/infrastructure/proxy.py",
> line 122, in request
> 
> persistent_auth=self.__persistent_auth
> 
>   File
> "/usr/lib/python2.7/site-packages/ovirtsdk/infrastructure/connectionspool.py",
> line 79, in do_request
> 
> persistent_auth)
> 
>   File
> "/usr/lib/python2.7/site-packages/ovirtsdk/infrastructure/connectionspool.py",
> line 162, in __do_request
> 
> raise errors.RequestError(response_code, response_reason, response_body)
> 
> ovirtsdk.infrastructure.errors.RequestError:
> 
> status: 401
> 
> reason: Unauthorized
> 
> detail: User is not logged in.
> 
>  
> 
>  
> 
> Is there some setting I can tune?
> 
>  
> 
> Thx Christian
> 
> 
> 
> ___
> Users mailing list
> Users@ovirt.org
> http://lists.ovirt.org/mailman/listinfo/users
> 

___
Users mailing list
Users@ovirt.org
http://lists.ovirt.org/mailman/listinfo/users


Re: [ovirt-users] Request for oVirt Ansible modules testing feedback

2017-01-10 Thread Juan Hernández
On 01/06/2017 02:44 PM, Nathanaël Blanchet wrote:
> 
> 
> Le 06/01/2017 à 13:39, Juan Hernández a écrit :
>> On 01/06/2017 12:20 PM, Nathanaël Blanchet wrote:
>>>
>>> Le 04/01/2017 à 18:55, Juan Hernández a écrit :
>>>> On 01/04/2017 05:38 PM, Nathanaël Blanchet wrote:
>>>>> Le 04/01/2017 à 15:41, Juan Hernández a écrit :
>>>>>> On 01/04/2017 12:30 PM, Yaniv Kaul wrote:
>>>>>>> On Wed, Jan 4, 2017 at 1:04 PM, Nicolas Ecarnot <nico...@ecarnot.net
>>>>>>> <mailto:nico...@ecarnot.net>> wrote:
>>>>>>>
>>>>>>>Hello,
>>>>>>>
>>>>>>>Le 04/01/2017 à 11:49, Nathanaël Blanchet a écrit :
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>Le 04/01/2017 à 10:09, Andrea Ghelardi a écrit :
>>>>>>>
>>>>>>>
>>>>>>>Personally I don’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 “Software as a Code”
>>>>>>> environment.
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>On the other hand, ovirt-shell can and is a fast/easy
>>>>>>> way to
>>>>>>>perform
>>>>>>>“normal daily tasks”.
>>>>>>>
>>>>>>>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 under
>>>>>>> https:///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-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 = connection.system_service().name.service()
>>>>>
>>>>> So logically it should be doable with snapshot like
>>>>> snapshots_service = 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
>>>

Re: [ovirt-users] Request for oVirt Ansible modules testing feedback

2017-01-06 Thread Juan Hernández
On 01/06/2017 12:20 PM, Nathanaël Blanchet wrote:
> 
> 
> Le 04/01/2017 à 18:55, Juan Hernández a écrit :
>> On 01/04/2017 05:38 PM, Nathanaël Blanchet wrote:
>>>
>>> Le 04/01/2017 à 15:41, Juan Hernández a écrit :
>>>> On 01/04/2017 12:30 PM, Yaniv Kaul wrote:
>>>>> On Wed, Jan 4, 2017 at 1:04 PM, Nicolas Ecarnot <nico...@ecarnot.net
>>>>> <mailto:nico...@ecarnot.net>> wrote:
>>>>>
>>>>>   Hello,
>>>>>
>>>>>   Le 04/01/2017 à 11:49, Nathanaël Blanchet a écrit :
>>>>>
>>>>>
>>>>>
>>>>>   Le 04/01/2017 à 10:09, Andrea Ghelardi a écrit :
>>>>>
>>>>>
>>>>>   Personally I don’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 “Software as a Code” environment.
>>>>>
>>>>>
>>>>>
>>>>>   On the other hand, ovirt-shell can and is a fast/easy
>>>>> way to
>>>>>   perform
>>>>>   “normal daily tasks”.
>>>>>
>>>>>   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 under
>>>>> https:///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-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 = connection.system_service().name.service()
>>>
>>> So logically it should be doable with snapshot like
>>> snapshots_service = 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 = 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 = 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 object

Re: [ovirt-users] Request for oVirt Ansible modules testing feedback

2017-01-04 Thread Juan Hernández
On 01/04/2017 05:38 PM, Nathanaël Blanchet wrote:
> 
> 
> Le 04/01/2017 à 15:41, Juan Hernández a écrit :
>> On 01/04/2017 12:30 PM, Yaniv Kaul wrote:
>>>
>>> On Wed, Jan 4, 2017 at 1:04 PM, Nicolas Ecarnot <nico...@ecarnot.net
>>> <mailto:nico...@ecarnot.net>> wrote:
>>>
>>>  Hello,
>>>
>>>  Le 04/01/2017 à 11:49, Nathanaël Blanchet a écrit :
>>>
>>>
>>>
>>>  Le 04/01/2017 à 10:09, Andrea Ghelardi a écrit :
>>>
>>>
>>>  Personally I don’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 “Software as a Code” environment.
>>>
>>>
>>>
>>>  On the other hand, ovirt-shell can and is a fast/easy
>>> way to
>>>  perform
>>>  “normal daily tasks”.
>>>
>>>  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 under https:///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-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 = connection.system_service().name.service()
> 
> So logically it should be doable with snapshot like
> snapshots_service = 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 = 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 = 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 = connection.system_service()

  # Find the virtual machine:
  vms_service = system_service.vms_service()
  vm = vms_service.list(search='name=myvm')[0]

  # Find the snapshot:
  vm_service = vms_service.vm_service(vm.id)
  snaps_service = vm_service.snapshots_service()
  snaps = snaps_service.list()
  snap = [s for s in snaps where s.description == 'My snap'][0]

  # Remove the snapshot:
  snap_service = snaps_service.snap_service(snap.id)
  snap_service.remove()

> I saw an example into the ansible [ working ] way to do the same thing
> and I found this :
> snapshot =
> snapshots_service.snapshot_service(module.params['snapshot_id']).get()
> 
> How can I get this working with sdk, I mean giving snapshot_id as a
> parameter?
> 
> 
>> Also the complete reference documentat

Re: [ovirt-users] Request for oVirt Ansible modules testing feedback

2017-01-04 Thread Juan Hernández
On 01/04/2017 12:30 PM, Yaniv Kaul wrote:
> 
> 
> On Wed, Jan 4, 2017 at 1:04 PM, Nicolas Ecarnot  > wrote:
> 
> Hello,
> 
> Le 04/01/2017 à 11:49, Nathanaël Blanchet a écrit :
> 
> 
> 
> Le 04/01/2017 à 10:09, Andrea Ghelardi a écrit :
> 
> 
> Personally I don’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 “Software as a Code” environment.
> 
> 
> 
> On the other hand, ovirt-shell can and is a fast/easy way to
> perform
> “normal daily tasks”.
> 
> 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 under https:///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-sdk/tree/master/sdk/examples
> 

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

There also SDKs for Ruby and Java, in case Python is not your preferred
language:

  Ruby:
  https://github.com/oVirt/ovirt-engine-sdk-ruby/tree/master/sdk
  https://github.com/oVirt/ovirt-engine-sdk-ruby/tree/master/sdk/examples
  http://www.rubydoc.info/gems/ovirt-engine-sdk

  Java:
  https://github.com/oVirt/ovirt-engine-sdk-java/tree/master/sdk

https://github.com/oVirt/ovirt-engine-sdk-java/tree/master/sdk/src/test/java/org/ovirt/engine/sdk4/examples
  http://www.javadoc.io/doc/org.ovirt.engine.api/sdk

> 
> 
> -- 
> Nicolas ECARNOT
> 
> ___
> Users mailing list
> Users@ovirt.org 
> http://lists.ovirt.org/mailman/listinfo/users
> 
> 
> 
> 
> 
> ___
> Users mailing list
> Users@ovirt.org
> http://lists.ovirt.org/mailman/listinfo/users
> 

___
Users mailing list
Users@ovirt.org
http://lists.ovirt.org/mailman/listinfo/users


Re: [ovirt-users] I wrote an oVirt thing

2016-12-28 Thread Juan Hernández
On 12/28/2016 06:47 PM, Nathanaël Blanchet wrote:
> Hi,
> 
> I understand that ovirt-shell is deprecated, but I need it for the moment.
> 
> I've just done a pip install upgrade ovirt-engine-sdk-python on my
> ubuntu laptop and now ovirt-shell is totally broken, saying :
> ImportError: No module named ovirtsdk.xml.
> 
> Can I go back to the previous SDK? How can I fix it?
> 
> Thanks.
> 

The CLI depends completely on version 3 of the SDK, and it won't work
with version 4. You need to explicitly install version 3 of the SDK:

  pip install ovirt-engine-sdk-python==3.6.9.2

> 
> Le 29/11/2016 à 17:19, Juan Hernández a écrit :
>> On 11/29/2016 04:51 PM, Juan Hernández wrote:
>>> On 11/29/2016 03:19 PM, Sandro Bonazzola wrote:
>>>>
>>>> On Mon, Nov 28, 2016 at 11:01 PM, Oved Ourfali <oourf...@redhat.com
>>>> <mailto:oourf...@redhat.com>> wrote:
>>>>
>>>>  BTW, the ovirt-shell is something we deprecated.
>>>>
>>>> Can you please point me to the deprecation bug for it?
>>>> I can't see it
>>>> here: https://bugzilla.redhat.com/buglist.cgi?quicksearch=ovirt-shell
>>>>
>>>>  
>>>>  It is working on top of the v3 api, which we plan to remove in
>>>> 4.2.
>>>>
>>>> Haven't seen a deprecation bug for this as well
>>>> in
>>>> https://bugzilla.redhat.com/buglist.cgi?quicksearch=classification%3Aovirt%20v3%20api
>>>>
>>>>
>>>> If we want people to know about it we need to publish it somehow and
>>>> for
>>>> the way we build release notes we need deprecation bugs for it to be
>>>> published.
>>>>   
>>> There were no such bugs. I have just created them:
>>>
>>>Deprecate version 3 of the API
>>>https://bugzilla.redhat.com/1399724
>>>
>> This ^ bug had an important typo in the description that Martin Sivak
>> pointed out. I have closed it and replaced with this one, which is
>> hopefully more correct:
>>
>>Deprecate version 3 of the API
>>https://bugzilla.redhat.com/1399750
>>
>>>Deprecate version 3 of the Python SDK
>>>https://bugzilla.redhat.com/1399714
>>>
>>>Deprecate version 3 of the Java SDK
>>>https://bugzilla.redhat.com/1399717
>>>
>>>Deprecate the ovirt-shell tool
>>>https://bugzilla.redhat.com/1399709
>>>
>>>>  So better not use it.
>>>>
>>>>  Alternatives are to use the SDKs according to your preference (we
>>>>  have Java, python and Ruby SDKs) or the ansible modules mentioned
>>>>  above by Moran (instead of writing scripts you can write playbooks
>>>>  to do various operations ).
>>>>
>>>>  Regards,
>>>>  Oved
>>>>
>>>>
>>>>  On Nov 28, 2016 13:02, "Nathanaël Blanchet" <blanc...@abes.fr
>>>>  <mailto:blanc...@abes.fr>> wrote:
>>>>
>>>>
>>>>
>>>>  Le 26/11/2016 à 22:40, Chris Cowley a écrit :
>>>>>  A few reasons really. I fancied playing around with Click,
>>>>> so I made
>>>>>  this as I was also digging around the oVirt API. My
>>>>> workstation at work
>>>>>  is running Ubuntu, and I do not believe that ovirt-shell
>>>>> is packaged for it.
>>>>  sudo apt-get install -y python-pip
>>>>  sudo pip install kitchen
>>>>  sudo pip install ply
>>>>  sudo pip install ovirt-shell
>>>>>  Also, choice is good.
>>>>>
>>>>>  Finally: because I didn't think of it.
>>>>>
>>>>>  On 26/11/16 22:24, Derek Atkins wrote:
>>>>>>  Hi Chris,
>>>>>>
>>>>>>  Just a quick question, but, why not just use ovirt-shell?
>>>>>>  Or make this a wrapper around ovirt-shell?
>>>>>>
>>>>>>  -derek
>>>>>>
>>>>>>  On Sat, November 26, 2016 4:10 pm, Chris Cowley wrote:
>>>>>>>  Hi all
>>>>>>>
>>>>>>>  I started hacking together something last night to use
>>>>>>> as a CLI to
>>>>>>>  manage my oVirt clusters.
&g

Re: [ovirt-users] How to setup OVS using python SDK ?

2016-12-20 Thread Juan Hernández
On 12/20/2016 02:19 PM, TranceWorldLogic . wrote:
> Hi,
> 
> I am trying to setup OVS network using ovirt and found guide as shown below:
> https://www.ovirt.org/networking/ovs/
> 
> Then, I tried to explore "vNic Profile" in sdk but not found any ovs
> profile in types.py.
> Can anyone help me how to setup ovs using python sdk ?
> I am using ovirtsdk4 (4.0 version).
> 

Should be something like this:

---8<---
#!/usr/bin/env python
# -*- coding: utf-8 -*-

#
# Copyright (c) 2016 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#   http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

import logging

import ovirtsdk4 as sdk
import ovirtsdk4.types as types

logging.basicConfig(level=logging.DEBUG, filename='example.log')

# This example will connect to the server and create a logical network
# that using Open vSwitch. Note that in order for this to work the
# engine has to be configured to use Open vSwitch, as described here:
#
#   https://www.ovirt.org/networking/ovs
#
# Specifcally you need to run the following commands in the machine
# where the engine is running:
#
#   engine-config -s CustomDeviceProperties="{type=interface;prop={ovs=.*}}"
#   engine-config -s
'UserDefinedNetworkCustomProperties=ovs=.*;ovs_aa_sid=.*'
#   systemctl restart ovirt-engine

# Create the connection to the server:
connection = sdk.Connection(
url='https://engine41.example.com/ovirt-engine/api',
username='admin@internal',
password='redhat123',
ca_file='ca.pem',
debug=True,
log=logging.getLogger(),
)

# Get the reference to the root of the tree of services:
system_service = connection.system_service()

# Get the reference to the service that manages the logical networks:
nets_service = system_service.networks_service()

# Create a logical network, which will automatically create a virtual
# NIC profile:
net = nets_service.add(
network=types.Network(
name='myovsnetwork',
data_center=types.DataCenter(
name='mydc'
)
)
)

# Retrieve the details of the virtual NIC profile that was created for
# the network (assuming that there is only one):
profile = connection.follow_link(net.vnic_profiles)[0]

# Get the reference to the service that manages the virtual NIC profile:
profiles_service = system_service.vnic_profiles_service()
profile_service = profiles_service.profile_service(profile.id)

# Update the custom properties of the virtual NIC profile in order to
# enable Open vSwitch:
profile_service.update(
profile=types.VnicProfile(
custom_properties=[
types.CustomProperty(
name='ovs',
value='true'
)
]
)
)

# Close the connection to the server:
connection.close()
--->8---

Note that it isn't complete, and that I didn't test if the OVS network
does work. But at least the creation of the network and the modification
of the VNIC profile does work.

I am suggesting to add this to the collection of examples of the SDK:

  Add example of how to create OVS network
  https://gerrit.ovirt.org/68825

You may want to review it.

___
Users mailing list
Users@ovirt.org
http://lists.ovirt.org/mailman/listinfo/users


Re: [ovirt-users] Python SDK .remove() does not return True?

2016-12-18 Thread Juan Hernández
On 12/18/2016 05:32 PM, Yaniv Kaul wrote:
> I'd expect, like other actions, add() for example, that I can ensure
> .remove() (for clusters, DCs, etc.) will return True as a sign for success.
> Is that a bug or a design choice?
> TIA,
> Y.
> 

It is by design. The method returns nothing, because in HTTP the DELETE
method doesn't receive or return a body: it only returns the HTTP status
code. In the SDK, success HTTP status code results in returning nothing,
and failures result in throwing an exception. So, if the methods doesn't
throw an exception then you can assume that it worked successfully.

___
Users mailing list
Users@ovirt.org
http://lists.ovirt.org/mailman/listinfo/users


Re: [ovirt-users] Requesting Python SDK example for VDSM

2016-12-13 Thread Juan Hernández
On 12/13/2016 03:36 PM, TranceWorldLogic . wrote:
> Hi,
> 
> I had install ovirt relase 40 .
> 
> Now I want to write a python script to interact with VDSM.
> Can some one point me to a tutorial guide for ovirtsdk4 ?
> [Document, tutorial, blog ...]
> 
> I tried google search but not got good reference.
> 
> Thanks,
> ~Rohit
> 

The Python SDK doesn't directly talk to VDSM, it talks to the engine,
which in turn talks to VDSM for certain things. There is documentation
of the SDK here:

  https://github.com/oVirt/ovirt-engine-sdk/tree/master/sdk

And a collection of examples here:

  https://github.com/oVirt/ovirt-engine-sdk/tree/master/sdk/examples
___
Users mailing list
Users@ovirt.org
http://lists.phx.ovirt.org/mailman/listinfo/users


Re: [ovirt-users] API req to update power mgmt options

2016-12-08 Thread Juan Hernández
On 12/06/2016 10:19 AM, Emil Flink wrote:
> Hi,
> 
> Can someone please provide an example request to edit the power
> management options of a host?
> 
> Ie. the options contained in
> host['power_management']['agents']['agent'][0]['options']['option'] and
> host['power_management']['options']['option']
> 
> Currently I have:
> 
> "option": [
>   {
> "name": "power_wait",
> "value": "4"
>   },
>   {
> "name": "lanplus",
> "value": ""
>   }
> ]
> 
> I need to change the value of "lanplus" from nothing to 1 or "on".
> 
> I have tried replacing the entire host['power_management']['options']
> set and the host['power_management']['agents'] set with PUT requests to
> the API endpoint for the host, with no change or errors - I just get a
> 200 OK response with the details of the host as if I had just done a GET
> request.
> 
> 
> Br.
> 
> Emil
> 

Apparently you are using version 3.6 or older of the engine, because in
newer versions (4.0 and newer) the 'power_management/agents' and
'power_management/options' aren't populated. Anyhow, that information is
read only. To write it you need to use the
hosts/{host:id}/fenceagents/{agent:id} endpoint. For example, to change
the value of 'lanplus' to 1 you can use an script like this (using curl):

---8<---
#!/bin/sh -ex

url="https://rhevm36.example.com/ovirt-engine/api;
user="admin@internal"
password="redhat123"

curl \
--verbose \
--cacert /etc/pki/ovirt-engine/ca.pem \
--request PUT \
--user "${user}:${password}" \
--header "Version: 3" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data '
{
  "options" : {
"option" : [ {
  "name" : "power_wait",
  "value" : "4"
}, {
  "name" : "lanplus",
  "value" : "1"
} ]
  }
}
' \
"${url}/hosts/136e39d6-7047-4ad0-87c8-d3028189ae8a/fenceagents/a16ff2fe-066c-4837-8b96-bd393bd7d3d7"
--->8---

Note that this is using version 3 of the API, which is deprecated since
version 4.0 of the engine, and will be removed in version 4.2. Consider
migrating to version 4 of the API once you upgrade your environment to
version 4.0 or newer of the engine.


___
Users mailing list
Users@ovirt.org
http://lists.ovirt.org/mailman/listinfo/users


Re: [ovirt-users] I wrote an oVirt thing

2016-11-29 Thread Juan Hernández
On 11/29/2016 04:51 PM, Juan Hernández wrote:
> On 11/29/2016 03:19 PM, Sandro Bonazzola wrote:
>>
>>
>> On Mon, Nov 28, 2016 at 11:01 PM, Oved Ourfali <oourf...@redhat.com
>> <mailto:oourf...@redhat.com>> wrote:
>>
>> BTW, the ovirt-shell is something we deprecated.
>>
>> Can you please point me to the deprecation bug for it?
>> I can't see it
>> here: https://bugzilla.redhat.com/buglist.cgi?quicksearch=ovirt-shell
>>
>>  
>>
>> It is working on top of the v3 api, which we plan to remove in 4.2.
>>
>> Haven't seen a deprecation bug for this as well
>> in 
>> https://bugzilla.redhat.com/buglist.cgi?quicksearch=classification%3Aovirt%20v3%20api
>>
>> If we want people to know about it we need to publish it somehow and for
>> the way we build release notes we need deprecation bugs for it to be
>> published.
>>  
> 
> There were no such bugs. I have just created them:
> 
>   Deprecate version 3 of the API
>   https://bugzilla.redhat.com/1399724
> 

This ^ bug had an important typo in the description that Martin Sivak
pointed out. I have closed it and replaced with this one, which is
hopefully more correct:

  Deprecate version 3 of the API
  https://bugzilla.redhat.com/1399750

>   Deprecate version 3 of the Python SDK
>   https://bugzilla.redhat.com/1399714
> 
>   Deprecate version 3 of the Java SDK
>   https://bugzilla.redhat.com/1399717
> 
>   Deprecate the ovirt-shell tool
>   https://bugzilla.redhat.com/1399709
> 
>>
>> So better not use it.
>>
>> Alternatives are to use the SDKs according to your preference (we
>> have Java, python and Ruby SDKs) or the ansible modules mentioned
>> above by Moran (instead of writing scripts you can write playbooks
>> to do various operations ).
>>
>> Regards,
>> Oved
>>
>>
>> On Nov 28, 2016 13:02, "Nathanaël Blanchet" <blanc...@abes.fr
>> <mailto:blanc...@abes.fr>> wrote:
>>
>>
>>
>> Le 26/11/2016 à 22:40, Chris Cowley a écrit :
>>> A few reasons really. I fancied playing around with Click, so I made
>>> this as I was also digging around the oVirt API. My workstation at 
>>> work
>>> is running Ubuntu, and I do not believe that ovirt-shell is 
>>> packaged for it.
>> sudo apt-get install -y python-pip
>> sudo pip install kitchen
>> sudo pip install ply
>> sudo pip install ovirt-shell
>>> Also, choice is good.
>>>
>>> Finally: because I didn't think of it.
>>>
>>> On 26/11/16 22:24, Derek Atkins wrote:
>>>> Hi Chris,
>>>>
>>>> Just a quick question, but, why not just use ovirt-shell?
>>>> Or make this a wrapper around ovirt-shell?
>>>>
>>>> -derek
>>>>
>>>> On Sat, November 26, 2016 4:10 pm, Chris Cowley wrote:
>>>>> Hi all
>>>>>
>>>>> I started hacking together something last night to use as a CLI to
>>>>> manage my oVirt clusters.
>>>>>
>>>>> https://gogs.chriscowley.me.uk/chriscowley/ovirtmanage
>>>>> <https://gogs.chriscowley.me.uk/chriscowley/ovirtmanage>
>>>>>
>>>>> Currently it can create/delete a VM, list the VMS, and I started a
>>>>> function to show the details, but all that does for now is return 
>>>>> the ID.
>>>>>
>>>>> The plan is for it to evolve with my own needs, but I am open to
>>>>> ideas/PRs from the community.
>>>>>
>>>>> Disclaimer #1: I am a SysAdmin, not a developer. If you a proper
>>>>> developer, what you see may cause you physical pain.
>>>>>
>>>>> Disclaimer #2: My Gogs repo is behind my ADSL in rural France, be
>>>>> patient and I withold the right to not respect any sort of SLA :-)
>>>>>
>>>>>
>>>>> --
>>>>> Regards
>>>>>
>>>>> Chris Cowley
>>>>> http://about.me/chriscowley
>>>>>
>>>>> ___
>>>>> Users mailing list
>>>>> Users@ovirt.org <mailto:Users@ov

Re: [ovirt-users] I wrote an oVirt thing

2016-11-29 Thread Juan Hernández
On 11/29/2016 05:02 PM, Martin Sivak wrote:
> Juan, you can't say something was deprecated since 4.0 in a bug that
> is created close to feature freeze of 4.1. Neither SDK nor RESTv3 are
> considered deprecated in 4.0, period. Internal plans do not count if
> nobody knows about them.
> 

Yes, I can say it, because I have been telling everybody to avoid using
version 3 of the API, version 3 of the SDKs and the CLI. That is the
meaning of "deprecate", according to the dictionary.

> 
> On Tue, Nov 29, 2016 at 4:51 PM, Juan Hernández <jhern...@redhat.com> wrote:
>> On 11/29/2016 03:19 PM, Sandro Bonazzola wrote:
>>>
>>>
>>> On Mon, Nov 28, 2016 at 11:01 PM, Oved Ourfali <oourf...@redhat.com
>>> <mailto:oourf...@redhat.com>> wrote:
>>>
>>> BTW, the ovirt-shell is something we deprecated.
>>>
>>> Can you please point me to the deprecation bug for it?
>>> I can't see it
>>> here: https://bugzilla.redhat.com/buglist.cgi?quicksearch=ovirt-shell
>>>
>>>
>>>
>>> It is working on top of the v3 api, which we plan to remove in 4.2.
>>>
>>> Haven't seen a deprecation bug for this as well
>>> in 
>>> https://bugzilla.redhat.com/buglist.cgi?quicksearch=classification%3Aovirt%20v3%20api
>>>
>>> If we want people to know about it we need to publish it somehow and for
>>> the way we build release notes we need deprecation bugs for it to be
>>> published.
>>>
>>
>> There were no such bugs. I have just created them:
>>
>>   Deprecate version 3 of the API
>>   https://bugzilla.redhat.com/1399724
>>
>>   Deprecate version 3 of the Python SDK
>>   https://bugzilla.redhat.com/1399714
>>
>>   Deprecate version 3 of the Java SDK
>>   https://bugzilla.redhat.com/1399717
>>
>>   Deprecate the ovirt-shell tool
>>   https://bugzilla.redhat.com/1399709
>>
>>>
>>> So better not use it.
>>>
>>> Alternatives are to use the SDKs according to your preference (we
>>> have Java, python and Ruby SDKs) or the ansible modules mentioned
>>> above by Moran (instead of writing scripts you can write playbooks
>>> to do various operations ).
>>>
>>> Regards,
>>> Oved
>>>
>>>
>>> On Nov 28, 2016 13:02, "Nathanaël Blanchet" <blanc...@abes.fr
>>> <mailto:blanc...@abes.fr>> wrote:
>>>
>>>
>>>
>>> Le 26/11/2016 à 22:40, Chris Cowley a écrit :
>>>> A few reasons really. I fancied playing around with Click, so I 
>>>> made
>>>> this as I was also digging around the oVirt API. My workstation at 
>>>> work
>>>> is running Ubuntu, and I do not believe that ovirt-shell is 
>>>> packaged for it.
>>> sudo apt-get install -y python-pip
>>> sudo pip install kitchen
>>> sudo pip install ply
>>> sudo pip install ovirt-shell
>>>> Also, choice is good.
>>>>
>>>> Finally: because I didn't think of it.
>>>>
>>>> On 26/11/16 22:24, Derek Atkins wrote:
>>>>> Hi Chris,
>>>>>
>>>>> Just a quick question, but, why not just use ovirt-shell?
>>>>> Or make this a wrapper around ovirt-shell?
>>>>>
>>>>> -derek
>>>>>
>>>>> On Sat, November 26, 2016 4:10 pm, Chris Cowley wrote:
>>>>>> Hi all
>>>>>>
>>>>>> I started hacking together something last night to use as a CLI 
>>>>>> to
>>>>>> manage my oVirt clusters.
>>>>>>
>>>>>> https://gogs.chriscowley.me.uk/chriscowley/ovirtmanage
>>>>>> <https://gogs.chriscowley.me.uk/chriscowley/ovirtmanage>
>>>>>>
>>>>>> Currently it can create/delete a VM, list the VMS, and I started 
>>>>>> a
>>>>>> function to show the details, but all that does for now is 
>>>>>> return the ID.
>>>>>>
>>>>>> The plan is for it to evolve with my own needs, but I am open to
>>>>>> ideas/PRs from the community.
>>>>>>
>>>>>> Disclaimer #1: I am a SysAdmin, not a developer. If you a

Re: [ovirt-users] I wrote an oVirt thing

2016-11-29 Thread Juan Hernández
On 11/29/2016 03:19 PM, Sandro Bonazzola wrote:
> 
> 
> On Mon, Nov 28, 2016 at 11:01 PM, Oved Ourfali  > wrote:
> 
> BTW, the ovirt-shell is something we deprecated.
> 
> Can you please point me to the deprecation bug for it?
> I can't see it
> here: https://bugzilla.redhat.com/buglist.cgi?quicksearch=ovirt-shell
> 
>  
> 
> It is working on top of the v3 api, which we plan to remove in 4.2.
> 
> Haven't seen a deprecation bug for this as well
> in 
> https://bugzilla.redhat.com/buglist.cgi?quicksearch=classification%3Aovirt%20v3%20api
> 
> If we want people to know about it we need to publish it somehow and for
> the way we build release notes we need deprecation bugs for it to be
> published.
>  

There were no such bugs. I have just created them:

  Deprecate version 3 of the API
  https://bugzilla.redhat.com/1399724

  Deprecate version 3 of the Python SDK
  https://bugzilla.redhat.com/1399714

  Deprecate version 3 of the Java SDK
  https://bugzilla.redhat.com/1399717

  Deprecate the ovirt-shell tool
  https://bugzilla.redhat.com/1399709

> 
> So better not use it.
> 
> Alternatives are to use the SDKs according to your preference (we
> have Java, python and Ruby SDKs) or the ansible modules mentioned
> above by Moran (instead of writing scripts you can write playbooks
> to do various operations ).
> 
> Regards,
> Oved
> 
> 
> On Nov 28, 2016 13:02, "Nathanaël Blanchet"  > wrote:
> 
> 
> 
> Le 26/11/2016 à 22:40, Chris Cowley a écrit :
>> A few reasons really. I fancied playing around with Click, so I made
>> this as I was also digging around the oVirt API. My workstation at 
>> work
>> is running Ubuntu, and I do not believe that ovirt-shell is packaged 
>> for it.
> sudo apt-get install -y python-pip
> sudo pip install kitchen
> sudo pip install ply
> sudo pip install ovirt-shell
>> Also, choice is good.
>>
>> Finally: because I didn't think of it.
>>
>> On 26/11/16 22:24, Derek Atkins wrote:
>>> Hi Chris,
>>>
>>> Just a quick question, but, why not just use ovirt-shell?
>>> Or make this a wrapper around ovirt-shell?
>>>
>>> -derek
>>>
>>> On Sat, November 26, 2016 4:10 pm, Chris Cowley wrote:
 Hi all

 I started hacking together something last night to use as a CLI to
 manage my oVirt clusters.

 https://gogs.chriscowley.me.uk/chriscowley/ovirtmanage
 

 Currently it can create/delete a VM, list the VMS, and I started a
 function to show the details, but all that does for now is return 
 the ID.

 The plan is for it to evolve with my own needs, but I am open to
 ideas/PRs from the community.

 Disclaimer #1: I am a SysAdmin, not a developer. If you a proper
 developer, what you see may cause you physical pain.

 Disclaimer #2: My Gogs repo is behind my ADSL in rural France, be
 patient and I withold the right to not respect any sort of SLA :-)


 --
 Regards

 Chris Cowley
 http://about.me/chriscowley

 ___
 Users mailing list
 Users@ovirt.org 
 http://lists.ovirt.org/mailman/listinfo/users
 

>>
>>
>> ___
>> Users mailing list
>> Users@ovirt.org 
>> http://lists.ovirt.org/mailman/listinfo/users
>> 
> 
> -- 
> Nathanaël Blanchet
> 
> Supervision réseau
> Pôle Infrastrutures Informatiques
> 227 avenue Professeur-Jean-Louis-Viala
> 34193 MONTPELLIER CEDEX 5 
> Tél. 33 (0)4 67 54 84 55
> Fax  33 (0)4 67 54 84 14
> blanc...@abes.fr  
> 
> 
> ___
> Users mailing list
> Users@ovirt.org 
> http://lists.ovirt.org/mailman/listinfo/users
> 
> 
> 
> ___
> Users mailing list
> Users@ovirt.org 
> http://lists.ovirt.org/mailman/listinfo/users
> 
> 
> 
> 
> 
> -- 
> Sandro Bonazzola
> Better technology. Faster innovation. Powered by community collaboration.
> See how it works at redhat.com 
> 
> 
> 

Re: [ovirt-users] Checking VmPool status with Python-SDK?

2016-11-08 Thread Juan Hernández
On 11/08/2016 09:46 AM, nico...@devels.es wrote:
> Hi,
> 
> We're running oVirt 4.0.4.4 with engine python SDK version 3.6.7, and 
> currently we're developing an application that first creates a VmPool 
> and afterwards it updates it. However, sometimes happens that both 
> operations occur at the same time, which results in an oVirt error 
> claiming that a VmPool cannot be updated if there are still pending 
> operations to do.
> 
> We want to control this situation, so we've checked if the VmPool class 
> has a .get_status() method but it seems it doesn't, so I'm asking for 
> alternative ways of handling this. Would it be enough to say a VmPool is 
> not "busy" if all its VMs are not in a blocked state (for example, with 
> a blocked disk due to clonation)?
> 

You are right, there is no "status" attribute in VM pools, the only way
to check if the pool is busy is as you suggest.

I take the opportunity to remind you that we will drop version 3 of the
API and version 3 of the SDKs in oVirt 4.2. Consider switching to versin
4 of the API and version 4 of the SDK. There are documentation and
examples here:

  https://github.com/oVirt/ovirt-engine-sdk/tree/master/sdk
  https://github.com/oVirt/ovirt-engine-sdk/tree/master/sdk/examples

Also, when checking what attributes are available in the API you can use
the documentation that is included in the system itself. For example, to
see the attributes of the "vm_pool" type you can go here:

  https://myengine.example.com/ovirt-engine/api/model#types/vm_pool

-- 
Dirección Comercial: C/Jose Bardasano Baos, 9, Edif. Gorbea 3, planta
3ºD, 28016 Madrid, Spain
Inscrita en el Reg. Mercantil de Madrid – C.I.F. B82657941 - Red Hat S.L.
___
Users mailing list
Users@ovirt.org
http://lists.ovirt.org/mailman/listinfo/users


Re: [ovirt-users] RHEVM3.3 java SDK on RHEV3.6

2016-11-08 Thread Juan Hernández
On 11/06/2016 09:39 AM, Tejesh M wrote:
> Hi All,
> 
> I'm facing an issue in invoking Cloudinit while customization in RHEV
> 3.6 using RHEV Java SDK 3.6.
> 
> Below link says we need to explicitly call *use_cloud_init=True*, but
> i'm not sure how to pass this value as parameter while creating VM.
> 
> http://users.ovirt.narkive.com/BGUkanAk/ovirt-users-cloud-init-not-apply-when-v-create-from-api
> 

You need to use version 3.6.0.0 of the SDK, or newer, as that is where
the support for this "use_cloud_init" parameter was added.

The new parameter is part of the "Action" class, so in your code you
need to set it:

  actionData.setUseCloudInit(true);

I take the opportunity to remind you that in version 4.2 of the engine
we will drop support for version 3 of the API and of version 3 of the
SDKs. So, once you migrate to version 4 of the engine consider using
version 4 of the SDK. There is an example of how to use cloud-init with
version 4 of the SDK here:


https://github.com/oVirt/ovirt-engine-sdk-java/blob/master/sdk/src/test/java/org/ovirt/engine/sdk4/examples/StartVmWithCloudInit.java

Note that this won't work with version 3.6 of the engine, for that you
need to keep using version 3 of the SDK.

> 
> _*My Code:*_
> String password = "password"; //"password"
> 
> String templateName = "centos6.7-final";
> String clusterName = "Default";
> String vmName = "testVM3";
> 
> //Prepare the data to create the VM from the template:
> org.ovirt.engine.sdk.entities.Template templateData = new Template();
> templateData.setName(templateName);
> org.ovirt.engine.sdk.entities.Cluster clusterData = new Cluster();
> clusterData.setName(clusterName);
> org.ovirt.engine.sdk.entities.VM vmDataForCreate = new VM();
> vmDataForCreate.setName(vmName);
> vmDataForCreate.setCluster(clusterData);
> vmDataForCreate.setTemplate(templateData);
> 
> api.getVMs().add(vmDataForCreate);
> String state;
> for (;;) {
>  state = api.getVMs().get(vmName).getStatus().getState();
> if ("down".equals(state)) {
>   break;
> }
> Thread.sleep(1000);
> }
> System.out.println("System Status:"+state); 
> org.ovirt.engine.sdk.entities.User userData = new User();
> userData.setUserName("root");
> userData.setPassword(password);
> Users usersData = new Users();
> usersData.getUsers().add(userData);
> CloudInit cloudData = new CloudInit();
> 
> 
> cloudData.setUsers(usersData);
> Host hostData = new Host();
> hostData.setAddress(vmName);
> cloudData.setHost(hostData);
> 
> org.ovirt.engine.sdk.entities.NetworkConfiguration
> networkConfiguration=new NetworkConfiguration();
> 
> networkConfiguration.setNics(new Nics());
> 
> Nics nics = networkConfiguration.getNics();
> nics.getNics().add(createNic("eth0", "STATIC",
> createNetwork("192.168.1.102", "255.255.0.0", "192.168.2.1"), true));
> 
> networkConfiguration.setNics(nics);
> 
> cloudData.setNetworkConfiguration(networkConfiguration);
> 
> Initialization initData = new Initialization();
> 
> initData.setCloudInit(cloudData);
> 
> VM vmDataForStart = new VM();
> vmDataForStart.setInitialization(initData);
> Action actionData = new Action();
> 
> actionData.setVm(vmDataForStart);
> 
> // Send the request to start the VM to the server:
> api.getVMs().get(vmName).start(actionData);
> 
> -- 
> Thanks & Regards
> Tejesh
> 
-- 
Dirección Comercial: C/Jose Bardasano Baos, 9, Edif. Gorbea 3, planta
3ºD, 28016 Madrid, Spain
Inscrita en el Reg. Mercantil de Madrid – C.I.F. B82657941 - Red Hat S.L.
___
Users mailing list
Users@ovirt.org
http://lists.ovirt.org/mailman/listinfo/users


Re: [ovirt-users] oVirt SDK v4 backwards compatibility

2016-11-08 Thread Juan Hernández
On 11/07/2016 07:06 PM, Rafael Martins wrote:
> - Original Message -
>> From: "Karli Sjöberg" 
>> To: "Rafael Martins" 
>> Cc: users@ovirt.org
>> Sent: Monday, November 7, 2016 6:13:33 PM
>> Subject: Re: [ovirt-users] oVirt SDK v4 backwards compatibility
>>
>>
>> Den 7 nov. 2016 15:53 skrev Rafael Martins :
>>>
>>> - Original Message -
 From: "Karli Sjöberg" 
 To: users@ovirt.org
 Sent: Monday, November 7, 2016 3:06:10 PM
 Subject: [ovirt-users] oVirt SDK v4 backwards compatibility

 Heya!

 Quick question, if I have on my computer installed a newer version
 Python SDK than what´s installed on the engine (4.0.3 locally and 3.6.X
 in engine), is it possible to connect?
>>>
>>> It is not possible, but you can still install the RPM for the version 3 of
>>> the SDK. Please note that the code of the SDK versions is not compatible.
>>
>> Ok, as I thought. But how does others handle that, like moVirt e.g? Is there
>> a best-practice for backwards compatibility?
> 
> Right now if you use the old SDK you should be able to "talk" with both 3.6 
> and 4.0, because 4.0 api provides backward compatibility with 3.6. But I'm 
> not sure if you can rely on this. Juan may have more details for you.
> 

It is important to understand the following:

* There are two different versions of the API: version 3 and version 4.

* Version 3 of the engine implements only version 3 of the API.

* Version 4 of the engine implements versions 3 and 4 of the API. This
is the current situation. In version 4.2 we will probably drop suport
for version 3 of the API completely.

* Version 3 of the SDK implements only version 3 of the SDK. The name of
the package is "ovirt-engine-sdk-python".

* Version 4 of the SDK implements only version 4 of the SDK. The name of
the package is "python-ovirt-engine-sdk4".

In your specific use case, version 4.0.3 of the
"python-ovirt-engine-sdk4" package can't talk to version 3.6.X of the
engine. But as Rafael says, you can install version 3 of the SDK, the
"ovirt-engine-sdk-python" package, and then it will version 3.6.X of the
engine.

-- 
Dirección Comercial: C/Jose Bardasano Baos, 9, Edif. Gorbea 3, planta
3ºD, 28016 Madrid, Spain
Inscrita en el Reg. Mercantil de Madrid – C.I.F. B82657941 - Red Hat S.L.
___
Users mailing list
Users@ovirt.org
http://lists.ovirt.org/mailman/listinfo/users


Re: [ovirt-users] ovirt-shell show vm doesn't show all vm properties

2016-10-11 Thread Juan Hernández
On 10/11/2016 03:47 PM, Nathanaël Blanchet wrote:
> Hi,
> 
> since ovirt 4.0, I can't use "--all_content" combined with "show vm" 
> anymore. The option si still available with the key tab, but when 
> applying, ovirt-shell complains : option "--all_content" is not supported.
> 
> I wrote some script using the console-enabled  option, how can I 
> retrieve this now?
> 

This is a bug in the CLI, I opened the following BZ to track it:

  The "--all_content true" option isn't accepted
  https://bugzilla.redhat.com/1383735

It will be fixed by this patch:

  cli: Base should be None when there is no base
  https://gerrit.ovirt.org/65371

That will hopefully be included in release 4.0.6 of the oVirt project.

> 
> Le 22/04/2016 à 11:39, Juan Hernández a écrit :
>> On 04/22/2016 10:14 AM, Nathanaël Blanchet wrote:
>>> Hi all,
>>>
>>> I'd like to find any vms with some defined properties like
>>> (console-enabled or serial_number-policy for example) with ovirt-shell
>>> -E "show vm name", but I can't find all information that I can get with
>>> edit vm popupin the UI.
>>> I belevied these kind of properties were unvailable because the flag was
>>> by default to false, but after updating the flag to true, it is still
>>> not visible. Does it exist an extended way to get those feature with
>>> ovirt-shell?
>>> Thank you.
>>>
>> The console information isn't reported by default because it requires an
>> additional query to the database, which is expensive, and not useful in
>> general. You can enable these expensive items using the "all_content"
>> parameter:
>>
>>$ ovirt-shell "show vm name --all_content true"
>>
>> The serial number properties are only present if there is one serial
>> number policy enabled.
>>
> 


-- 
Dirección Comercial: C/Jose Bardasano Baos, 9, Edif. Gorbea 3, planta
3ºD, 28016 Madrid, Spain
Inscrita en el Reg. Mercantil de Madrid – C.I.F. B82657941 - Red Hat S.L.
___
Users mailing list
Users@ovirt.org
http://lists.ovirt.org/mailman/listinfo/users


  1   2   3   >