Re: [ovirt-users] ovirt-shell

Well there is no guide on the web which I'm aware of. But to my experience, scripting the shell has it's limitations you might want to try the python sdk, which is more useful or if you need some webapp anyway use the rest api. you could also script the rest api using e.g. curl but I wouldn't recommend that. there is documentation on this here: https://access.redhat.com/site/documentation/en-US/Red_Hat_Enterprise_Virtua... https://access.redhat.com/site/documentation/en-US/Red_Hat_Enterprise_Virtua... you can basically substitute rhev with ovirt. there still seems to be no updated dev guides for 3.4 though. I have automated everything via REST, as I have php devs who did the work ;) There are still some things you can't do via rest, like creating network qos entities (attaching them to a vm works but you need to create them manually). But in the future everything will use rest, so I guess this is the best way to go. HTH Am 10.07.2014 16:46, schrieb Steve Kilduff:
Excellent, thanks for the quick reply guys.
I am trying to automate 100 vm creations so... If anyone has a good guide that exists I would be very appreciative, otherwise I will keep tipping away :)
Steve
-- Mit freundlichen Grüßen / Regards Sven Kieske Systemadministrator Mittwald CM Service GmbH & Co. KG Königsberger Straße 6 32339 Espelkamp T: +49-5772-293-100 F: +49-5772-293-333 https://www.mittwald.de Geschäftsführer: Robert Meyer St.Nr.: 331/5721/1033, USt-IdNr.: DE814773217, HRA 6640, AG Bad Oeynhausen Komplementärin: Robert Meyer Verwaltungs GmbH, HRB 13260, AG Bad Oeynhausen

On 07/10/2014 05:07 PM, Sven Kieske wrote:
Well there is no guide on the web which I'm aware of. But to my experience, scripting the shell has it's limitations you might want to try the python sdk, which is more useful or if you need some webapp anyway use the rest api. you could also script the rest api using e.g. curl but I wouldn't recommend that.
there is documentation on this here:
https://access.redhat.com/site/documentation/en-US/Red_Hat_Enterprise_Virtua...
https://access.redhat.com/site/documentation/en-US/Red_Hat_Enterprise_Virtua...
you can basically substitute rhev with ovirt.
there still seems to be no updated dev guides for 3.4 though.
The location of that documentation has changed a bit for 3.4: https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Virtualizat... https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Virtualizat...
I have automated everything via REST, as I have php devs who did the work ;)
There are still some things you can't do via rest, like creating network qos entities (attaching them to a vm works but you need to create them manually).
But in the future everything will use rest, so I guess this is the best way to go.
HTH
Am 10.07.2014 16:46, schrieb Steve Kilduff:
Excellent, thanks for the quick reply guys.
I am trying to automate 100 vm creations so... If anyone has a good guide that exists I would be very appreciative, otherwise I will keep tipping away :)
Steve
Did you consider using templates and pools? -- 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.

On 07/10/2014 05:28 PM, Juan Hernandez wrote:
On 07/10/2014 05:07 PM, Sven Kieske wrote:
Well there is no guide on the web which I'm aware of. But to my experience, scripting the shell has it's limitations you might want to try the python sdk, which is more useful or if you need some webapp anyway use the rest api. you could also script the rest api using e.g. curl but I wouldn't recommend that.
there is documentation on this here:
https://access.redhat.com/site/documentation/en-US/Red_Hat_Enterprise_Virtua...
https://access.redhat.com/site/documentation/en-US/Red_Hat_Enterprise_Virtua...
you can basically substitute rhev with ovirt.
there still seems to be no updated dev guides for 3.4 though.
The location of that documentation has changed a bit for 3.4:
https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Virtualizat...
https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Virtualizat...
I have automated everything via REST, as I have php devs who did the work ;)
There are still some things you can't do via rest, like creating network qos entities (attaching them to a vm works but you need to create them manually).
But in the future everything will use rest, so I guess this is the best way to go.
HTH
Am 10.07.2014 16:46, schrieb Steve Kilduff:
Excellent, thanks for the quick reply guys.
I am trying to automate 100 vm creations so... If anyone has a good guide that exists I would be very appreciative, otherwise I will keep tipping away :)
Steve
Did you consider using templates and pools?
If you have a template with all the characteristics you need, you can easily create the 100 VMs with a Python script like this: #!/usr/bin/python import ovirtsdk.api import ovirtsdk.xml # Connect to the server: api = ovirtsdk.api.API( url="https://rhel.example.com/ovirt-engine/api", username="admin@internal", password="******", insecure=True, debug=False, ) # Locate the cluster: cluster = api.clusters.get(name="mycluster") cluster = ovirtsdk.xml.params.Cluster(id=cluster.get_id()) # Locate the template: template = api.templates.get(name="mytemplate") template = ovirtsdk.xml.params.Template(id=template.get_id()) # Create the VMs: for i in range(0, 99): name = "vm%d" % i print("Creating VM %s ..." % name) vm = ovirtsdk.xml.params.VM(name=name, cluster=cluster, template=template) api.vms.add(vm) # Disconnect: api.disconnect() -- 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.

Am 10.07.2014 17:28, schrieb Juan Hernandez:
Did you consider using templates and pools?
Actually I'm using templates, but not pools as I don't do this VDI stuff where it applies the most. Setup of the vms does work via cloud-init, also via rest. So I can really just encourage you to automate this :) It works, but it takes some time. -- Mit freundlichen Grüßen / Regards Sven Kieske Systemadministrator Mittwald CM Service GmbH & Co. KG Königsberger Straße 6 32339 Espelkamp T: +49-5772-293-100 F: +49-5772-293-333 https://www.mittwald.de Geschäftsführer: Robert Meyer St.Nr.: 331/5721/1033, USt-IdNr.: DE814773217, HRA 6640, AG Bad Oeynhausen Komplementärin: Robert Meyer Verwaltungs GmbH, HRB 13260, AG Bad Oeynhausen
participants (2)
-
Juan Hernandez
-
Sven Kieske