Re: [ovirt-users] API: detailed quota information, where's it at?

2016-02-04 Thread Tim Bielawa
In case anyone else out there is reading this looking for the answer, after
rooting around on IRC I've found out that the feature I described is
available in upcoming 3.6 release.

On Wed, Feb 3, 2016 at 3:37 PM, Tim Bielawa <tbiel...@redhat.com> wrote:

> I've been able to run the simple commands to enumerate quotas in a
> datacenter, and to select a quota by name.
>
> What I can not figure out how to do is how to receive detailed information
> about a quota from the API.
>
> Here's how I queried the basic information (using the python ovirtsdk
> module):
>
> import ovirtsdk.api
>> api = ovirtsdk.api.API(url=url, username=name, password=password, ...)
>> datacenter = api.datacenters.get(name="my-data-center")
>> team_quota = datacenter.quotas.get(name="my-teams-quota")
>
>
> Which works well enough, but doesn't really provide any actual *valuable*
> information (just the name, id, description, that kind of stuff).
>
> So where is the useful stuff hidden? The stuff of real value? I have not
> found any useful resources while scouring the Internet for this answer.
>
>
> I want to be able to hit this API and ask for detailed information about
> the usage of a quota: How much capacity is my team allotted on a given
> storage domain? How much capacity are we presently consuming? Likewise with
> CPU/Memory allocation type quotas.
>
> Is this possible, or a pipe dream?
>
>
> Environment:
>
> RHEVM Version: 3.5.6.0-1
> Python SDK Version: 3.5.6.0-1
>
>
> Thanks again folks!
>
>
> --
> Tim Bielawa, Sr. ${::title}
> Cell: 919.332.6411  | IRC: tbielawa (#platops)
> 1BA0 4FAB 4C13 FBA0 A036  4958 AD05 E75E 0333 AE37
>



-- 
Tim Bielawa, Sr. ${::title}
Cell: 919.332.6411  | IRC: tbielawa (#platops)
1BA0 4FAB 4C13 FBA0 A036  4958 AD05 E75E 0333 AE37
___
Users mailing list
Users@ovirt.org
http://lists.ovirt.org/mailman/listinfo/users


[ovirt-users] API: detailed quota information, where's it at?

2016-02-03 Thread Tim Bielawa
I've been able to run the simple commands to enumerate quotas in a
datacenter, and to select a quota by name.

What I can not figure out how to do is how to receive detailed information
about a quota from the API.

Here's how I queried the basic information (using the python ovirtsdk
module):

import ovirtsdk.api
> api = ovirtsdk.api.API(url=url, username=name, password=password, ...)
> datacenter = api.datacenters.get(name="my-data-center")
> team_quota = datacenter.quotas.get(name="my-teams-quota")


Which works well enough, but doesn't really provide any actual *valuable*
information (just the name, id, description, that kind of stuff).

So where is the useful stuff hidden? The stuff of real value? I have not
found any useful resources while scouring the Internet for this answer.


I want to be able to hit this API and ask for detailed information about
the usage of a quota: How much capacity is my team allotted on a given
storage domain? How much capacity are we presently consuming? Likewise with
CPU/Memory allocation type quotas.

Is this possible, or a pipe dream?


Environment:

RHEVM Version: 3.5.6.0-1
Python SDK Version: 3.5.6.0-1


Thanks again folks!


-- 
Tim Bielawa, Sr. ${::title}
Cell: 919.332.6411  | IRC: tbielawa (#platops)
1BA0 4FAB 4C13 FBA0 A036  4958 AD05 E75E 0333 AE37
___
Users mailing list
Users@ovirt.org
http://lists.ovirt.org/mailman/listinfo/users


Re: [ovirt-users] API Importing a VM from an export domain fails

2016-01-13 Thread Tim Bielawa
Beautiful!!

Oh man, thanks so much. I never would have figured that out on my own.

On Wed, Jan 13, 2016 at 12:28 PM, Juan Hernández <jhern...@redhat.com>
wrote:

> On 01/13/2016 05:54 PM, Tim Bielawa wrote:
> >
> > On Wed, Jan 13, 2016 at 5:01 AM, Juan Hernández <jhern...@redhat.com
> > <mailto:jhern...@redhat.com>> wrote:
> >
> > On 01/12/2016 08:44 PM, Tim Bielawa wrote:
> > > Hello virt folks,
> > >
> > > Background:
> > >
> > > I'm using the REST API to import a VM from an attached export
> domain.
> > > The VM was imported using the virt-v2v tool. I've tried this with
> cURL
> > > and with the python SDK, both yield the same error message.
> > >
> > > RHEVM Version: 3.5.6.0-1
> > > Python SDK Version: 3.5.6.0-1
> > >
> > > According to the documentation, importing should follow this
> syntax:
> > >
> > >> POST
> > >
> /ovirt-engine/api/storagedomains/{storagedomain:id}/vms/{vm:id}/import
> > >
> > > With a small  body attached. In theory (by the
> > documentation and
> > > bug tracker [1]) either of these XML documents (both in the same
> > paste)
> > > should work:
> > >
> > > http://fpaste.org/309944/52627148/
> > >
> > > However, this fails with the following error message (full
> > response in [2])
> > >
> > >> Cannot import VM. Storage Domain type not specified.
> > >
> > >
> > > Steps to reproduce:
> > >
> > > 1. Import a VM into an export storage domain
> > > 2. Create an XML document with an action like this (filling in the
> > > correct values for the ID variables)
> > >
> > > 
> > >   
> > >   
> > > export
> > >   
> > >   True
> > >   
> > > IMPORTED_VM
> > >   
> > > 
> > >
> > >
> > > 3. POST to the import location (again, substitute the correct ID
> > > variables in the location)
> > >
> > >
> >
> /ovirt-engine/api/storagedomains//vms//import
> > >
> > >
> > >
> > > Where is this storage domain type supposed to be defined, if not
> > inside
> > > of the storage_domain element as demonstrated in the documentation?
> > >
> > > I would appreciate any advice you can offer or pointers to useful
> > > resources/documentation.
> > >
> > > Thanks!
> > >
> > >
> > > [1] https://bugzilla.redhat.com/show_bug.cgi?id=1147011#c13
> > > [2] http://fpaste.org/309949/14526274/
> > >
> > > --
> > > Tim Bielawa
> > > 1BA0 4FAB 4C13 FBA0 A036  4958 AD05 E75E 0333 AE37
> > >
> >
> > The bug that you are referring to (bug 1147011) isn't fixed in
> version
> > 3.5, and there are no plans to fix it, as far as I know. It will be
> > fixed on only in 3.6. This means that you have to apply the
> workaround
> > that Sven Kieske mentions in the description of the bug. So the XML
> > document to send should look like this:
> >
> >   
> > 
> > 
> > true
> > 
> >   TBIELAWA_IMPORTED_VM
> >
> >   
> >   
> > true
> >   
> >
> > 
> >   
> >
> > With the Python SDK should be something like this:
> >
> >   # Find the target cluster and storage domain:
> >   target_cluster_id = api.clusters.get(name="mycluster").get_id()
> >   target_sd_id = api.storagedomains.get(name="mydata").get_id()
> >
> >   # Find the export storage domain:
> >   export_sd = api.storagedomains.get(name="myexport")
> >
> >   # Find the VM:
> >   vm = export_sd.vms.get(name="myvm")
> >
> >   # Import the VM:
> >   vm.import_vm(
> >   params.Action(
> >   cluster=params.Cluster(id=target_cluster_id),
> >   storage_domain=params.StorageDomain(id=target_sd_id),
> >   clone=True,
> >   vm=params.VM(
> > 

Re: [ovirt-users] API Importing a VM from an export domain fails

2016-01-13 Thread Tim Bielawa
On Wed, Jan 13, 2016 at 5:01 AM, Juan Hernández <jhern...@redhat.com> wrote:

> On 01/12/2016 08:44 PM, Tim Bielawa wrote:
> > Hello virt folks,
> >
> > Background:
> >
> > I'm using the REST API to import a VM from an attached export domain.
> > The VM was imported using the virt-v2v tool. I've tried this with cURL
> > and with the python SDK, both yield the same error message.
> >
> > RHEVM Version: 3.5.6.0-1
> > Python SDK Version: 3.5.6.0-1
> >
> > According to the documentation, importing should follow this syntax:
> >
> >> POST
> > /ovirt-engine/api/storagedomains/{storagedomain:id}/vms/{vm:id}/import
> >
> > With a small  body attached. In theory (by the documentation and
> > bug tracker [1]) either of these XML documents (both in the same paste)
> > should work:
> >
> > http://fpaste.org/309944/52627148/
> >
> > However, this fails with the following error message (full response in
> [2])
> >
> >> Cannot import VM. Storage Domain type not specified.
> >
> >
> > Steps to reproduce:
> >
> > 1. Import a VM into an export storage domain
> > 2. Create an XML document with an action like this (filling in the
> > correct values for the ID variables)
> >
> > 
> >   
> >   
> > export
> >   
> >   True
> >   
> > IMPORTED_VM
> >   
> > 
> >
> >
> > 3. POST to the import location (again, substitute the correct ID
> > variables in the location)
> >
> >
>  /ovirt-engine/api/storagedomains//vms//import
> >
> >
> >
> > Where is this storage domain type supposed to be defined, if not inside
> > of the storage_domain element as demonstrated in the documentation?
> >
> > I would appreciate any advice you can offer or pointers to useful
> > resources/documentation.
> >
> > Thanks!
> >
> >
> > [1] https://bugzilla.redhat.com/show_bug.cgi?id=1147011#c13
> > [2] http://fpaste.org/309949/14526274/
> >
> > --
> > Tim Bielawa
> > 1BA0 4FAB 4C13 FBA0 A036  4958 AD05 E75E 0333 AE37
> >
>
> The bug that you are referring to (bug 1147011) isn't fixed in version
> 3.5, and there are no plans to fix it, as far as I know. It will be
> fixed on only in 3.6. This means that you have to apply the workaround
> that Sven Kieske mentions in the description of the bug. So the XML
> document to send should look like this:
>
>   
> 
> 
> true
> 
>   TBIELAWA_IMPORTED_VM
>
>   
>   
> true
>   
>
> 
>   
>
> With the Python SDK should be something like this:
>
>   # Find the target cluster and storage domain:
>   target_cluster_id = api.clusters.get(name="mycluster").get_id()
>   target_sd_id = api.storagedomains.get(name="mydata").get_id()
>
>   # Find the export storage domain:
>   export_sd = api.storagedomains.get(name="myexport")
>
>   # Find the VM:
>   vm = export_sd.vms.get(name="myvm")
>
>   # Import the VM:
>   vm.import_vm(
>   params.Action(
>   cluster=params.Cluster(id=target_cluster_id),
>   storage_domain=params.StorageDomain(id=target_sd_id),
>   clone=True,
>   vm=params.VM(
>   name="TBIELAWA_IMPORTED_VM",
>   snapshots=params.Snapshots(
>   collapse_snapshots=True
>   )
>   )
>   )
>   )
>
> --
> 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.
>


Thanks for the tips Juan, I appreciate the response.

I didn't understand how that work-around was supposed to work the first
time I read that in the BZ, thanks for clarifying with those examples.

Unfortunately though, I've integrated what you offered into my script and
am still running into walls. I found the ParseHelper.toXml function and
used that to debug what the params.Action is evaluating to before calling
the import_vm() method on the target import VM:

> 
> 
> 
> 
> vm.example.com
> 
> true
> 
> 
 >true
> 

It's basically identical to what you offered in your example. Yet still, I
run into this problem:

Traceback (most recent call last):
>   File "./rhev-test.py", line 300, in 
> result = latest_image.import_vm(import_params)
>   File
> "/usr/lib/python2.7/site-packages/ovirtsdk/infrastructure/brokers.py

[ovirt-users] API Importing a VM from an export domain fails

2016-01-12 Thread Tim Bielawa
Hello virt folks,

Background:

I'm using the REST API to import a VM from an attached export domain. The
VM was imported using the virt-v2v tool. I've tried this with cURL and with
the python SDK, both yield the same error message.

RHEVM Version: 3.5.6.0-1
Python SDK Version: 3.5.6.0-1

According to the documentation, importing should follow this syntax:

> POST /ovirt-engine
/api/storagedomains/{storagedomain:id}/vms/{vm:id}/import

With a small  body attached. In theory (by the documentation and
bug tracker [1]) either of these XML documents (both in the same paste)
should work:

http://fpaste.org/309944/52627148/

However, this fails with the following error message (full response in [2])

> Cannot import VM. Storage Domain type not specified.


Steps to reproduce:

1. Import a VM into an export storage domain
2. Create an XML document with an action like this (filling in the correct
values for the ID variables)


>   
>   
> export
>   
>   True
>   
> IMPORTED_VM
>   
> 


3. POST to the import location (again, substitute the correct ID variables
in the location)

/ovirt-engine/api/storagedomains//vms//import



Where is this storage domain type supposed to be defined, if not inside of
the storage_domain element as demonstrated in the documentation?

I would appreciate any advice you can offer or pointers to useful
resources/documentation.

Thanks!


[1] https://bugzilla.redhat.com/show_bug.cgi?id=1147011#c13
[2] http://fpaste.org/309949/14526274/

-- 
Tim Bielawa
1BA0 4FAB 4C13 FBA0 A036  4958 AD05 E75E 0333 AE37
___
Users mailing list
Users@ovirt.org
http://lists.ovirt.org/mailman/listinfo/users