Re: [ovirt-users] Possible python api bug on api.clusters.list
On 11/21/2014 10:37 AM, Amedeo Salvati wrote: Hello, before opening a new bug, I'm asking here if somebody could let me know if this is a bug or there are other ways to obtain clusters list... on python script I retrieve cluster list by using: clulist = api.clusters.list( datacenter= + PROD ) but this query on python script will be *automatically* expandend on something like evething datacenter containg word PROD - *PROD*, and on our env there are either NO_PROD datacenter and PROD datacenter, and this cause that clulist object contains every clusters on both datacenter. This call is translated into the following request: GET /ovirt-engine/api/clusters?search=datacenter%3DPROD And as you discovered this means all clusters from all data centers whose name contains PROD. This is by design, it isn't a bug. If you only want the clusters of the PROD data center then you should instead do something like this: prod_datacenter = api.datacenters.get(name=PROD) prod_clusters = prod_datacenter.clusters.list() This is what ovirt-shell does when you run list clusters --datacenter-identifier PROD. Instead ovirt-shell works fine and returns only clusters filtered by datacenter-identifier parameter. To better understand this is snippet of python code: clulist = api.clusters.list( datacenter= + PROD ) for clu in clulist: ... print Found cluster + clu.get_name() ... Found cluster NO_PROD THIS CLUSTER IS ON NO_PROD DATACENTER Found cluster PROD ovirt-shell snippet that works fine: [oVirt shell (connected)]# list clusters --datacenter-identifier PROD id : 168c0d5e-8f12-4377-aabf-604adfd36b2b name : PROD [oVirt shell (connected)]# list clusters --datacenter-identifier NO_PROD id : a092c9fc-0f5f-471e-8bca-b3828255aa5a name : NO_PROD [oVirt shell (connected)]# Is this a bug? Can I open a new bug on bugzilla? Best regards Amedeo Salvati -- 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] Integration of ovirt-engine GUI with the CLI
On 11/07/2014 09:25 AM, Sven Kieske wrote: On 07/11/14 03:46, Nikita Kodkani wrote: Rhevmcommand is written in bash script, which internally calls REST api using curl. Why don't you call the rest api directly from php? That would certainly be the best way. I would also suggest to take a look at the sample portals written by Shahar Havivi: http://www.ovirt.org/Sample_user_portals There examples written in Java, Python and Ruby. They can probably inspire you to write a PHP or CGI+Shell equivalent. Would be great if you can contribute it, by the way. -- 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] Add multiple files to a VM via cloud-init
On 11/06/2014 11:06 AM, Branimir Pejakovic wrote: On Mon, Nov 3, 2014 at 8:52 PM, Branimir Pejakovic branim...@gmail.com mailto:branim...@gmail.com wrote: On Fri, Oct 31, 2014 at 11:00 PM, Juan Hernandez jhern...@redhat.com mailto:jhern...@redhat.com wrote: On 10/31/2014 06:47 PM, Branimir Pejakovic wrote: On Thu, Oct 30, 2014 at 12:52 PM, Branimir Pejakovic branim...@gmail.com mailto:branim...@gmail.com mailto:branim...@gmail.com mailto:branim...@gmail.com wrote: On Thu, Oct 30, 2014 at 12:39 PM, Shahar Havivi shah...@redhat.com mailto:shah...@redhat.com mailto:shah...@redhat.com mailto:shah...@redhat.com wrote: On 30.10.14 12:30, Branimir Pejakovic wrote: On Thu, Oct 30, 2014 at 12:02 PM, Shahar Havivi shah...@redhat.com mailto:shah...@redhat.com mailto:shah...@redhat.com mailto:shah...@redhat.com wrote: On 30.10.14 10:06, Branimir Pejakovic wrote: On Thu, Oct 30, 2014 at 7:22 AM, Shahar Havivi shah...@redhat.com mailto:shah...@redhat.com mailto:shah...@redhat.com mailto:shah...@redhat.com wrote: On 29.10.14 17:35, Branimir Pejakovic wrote: Hi list, I was wondering is there a way to add multiple files to a vm via cloud-init using python SDK. I was able to add /etc/resolv.conf and additionally I would like to add config files for NICs (ifcfg-ethX) with appropriate values (ip,gw,netmask). I used an example given here: http://www.ovirt.org/Features/Cloud-Init_Integration . But unfortunately I cannot do the same thing If I want to write multiple files to a vm in params.Action class. Thank you in advance! you can use the custom script text box in oVirts cloud-init section, there you can add any cloud-init section - adding files examples can be found here: http://cloudinit.readthedocs.org/en/latest/topics/examples.html#writing-out-arbitrary-files Shahar Havivi. Hi Shahar, Thank you for the reply. To be honest I knew for those scripts but I want to do it in automate fashion just like in that example that I put in my original message. I have tried to specify in params.Files class multiple files: vm_file1 = params.Files(file=[params.File(name = 'file1', content = file1_content, type_= 'PLAINTEXT')]) vm_file2 = params.Files(file=[params.File(name = 'file2', content = file2_content, type_= 'PLAINTEXT')]) and then give them as arguments to params.CloudInit _init_ constructor (files=...) just like in that example above but it seems that I am doing something wrong because it does not write multiple files - it writes only when you specify one file all right. The exception is Error: 'list' object has no attribute 'export' (I tried to specify those files as a list - files=[vm_file1,vm_file2]). Thanks for any help. The custom script is currently the only option to add files via Cloud-Init Thanks, Shahar Havivi. Hi Shahar, Granted. But the example in python http://www.ovirt.org/Features/Cloud-Init_Integration uses custom script :) I just want to know
Re: [ovirt-users] Add multiple files to a VM via cloud-init
On 11/02/2014 03:37 PM, Amedeo Salvati wrote: Hi Juan, this means that example of python code on http://www.ovirt.org/Features/Cloud-Init_Integration that I wrote some months ago against v3.4 could be changed by encoding the content on base64? at this time of this writing I haven't v3.5 to test the script / new code best regards Amedeo Salvati Using base64 to encode the content of files is just an option offered by cloud-init. You can use it or not, both alternatives should work fine. I think that using base64 is slightly better, because you can use it for binary or text files, and it is easier to paste into the cloud-init file. Il 01/11/2014 00:00, users-requ...@ovirt.org ha scritto: The custom_script element doesn't work in combination with cloud-init and run once. To make it work you have to use cloud-init and a file element containing your custom script. Here you have an example: #!/usr/bin/python import base64 import re from ovirtsdk.api import API from ovirtsdk.xml import params # A simple function to encode using base64 and now new lines: def encode(s): return re.sub(\s+, , base64.encodestring(s)) # Connect to the server: api = API( url=https://engine35.example.com/ovirt-engine/api;, username=admin@internal, password=redhat123, insecure=True, debug=True ) # Find the virtual machine: myvm = api.vms.get(name=myvm) # Prepare the cloud-init custom script to write files: myscript = \ write_files: # Append one file: myscript += \ - encoding: b64 content: %s owner: root:root path: /etc/firstfile.txt permissions: '0644' % encode(The content of the first file) # Append another file: myscript += \ - encoding: b64 content: %s owner: root:root path: /etc/secondfile.txt permissions: '0644' % encode(The content of the second file) # Prepare the action to trigger initialization using cloud-init: action = params.Action( vm=params.VM( initialization=params.Initialization( cloud_init=params.CloudInit( files=params.Files( file=[ params.File( name=myscript, type_=plaintext, content=myscript ) ] ) ) ) ) ) # Start the virtual machine: myvm.start(action) # Disconnect from the server: api.disconnect() Regarding the problem with the root password we have a bug in 3.5 that makes this fail. See here: https://bugzilla.redhat.com/1156155 The problem is that we are not passing the user name to cloud-init, and as a result it is changing the default cloud-init user password, not the root pssword. To workaround the issue you can edit the /etc/cloud/cloud.cfg file of the VM and change the default user name: system_info: distro: ... default_user: name: root -- Change this from fedora or cloud-init to root -- 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] Add multiple files to a VM via cloud-init
On 10/31/2014 06:47 PM, Branimir Pejakovic wrote: On Thu, Oct 30, 2014 at 12:52 PM, Branimir Pejakovic branim...@gmail.com mailto:branim...@gmail.com wrote: On Thu, Oct 30, 2014 at 12:39 PM, Shahar Havivi shah...@redhat.com mailto:shah...@redhat.com wrote: On 30.10.14 12:30, Branimir Pejakovic wrote: On Thu, Oct 30, 2014 at 12:02 PM, Shahar Havivi shah...@redhat.com mailto:shah...@redhat.com wrote: On 30.10.14 10:06, Branimir Pejakovic wrote: On Thu, Oct 30, 2014 at 7:22 AM, Shahar Havivi shah...@redhat.com mailto:shah...@redhat.com wrote: On 29.10.14 17:35, Branimir Pejakovic wrote: Hi list, I was wondering is there a way to add multiple files to a vm via cloud-init using python SDK. I was able to add /etc/resolv.conf and additionally I would like to add config files for NICs (ifcfg-ethX) with appropriate values (ip,gw,netmask). I used an example given here: http://www.ovirt.org/Features/Cloud-Init_Integration . But unfortunately I cannot do the same thing If I want to write multiple files to a vm in params.Action class. Thank you in advance! you can use the custom script text box in oVirts cloud-init section, there you can add any cloud-init section - adding files examples can be found here: http://cloudinit.readthedocs.org/en/latest/topics/examples.html#writing-out-arbitrary-files Shahar Havivi. Hi Shahar, Thank you for the reply. To be honest I knew for those scripts but I want to do it in automate fashion just like in that example that I put in my original message. I have tried to specify in params.Files class multiple files: vm_file1 = params.Files(file=[params.File(name = 'file1', content = file1_content, type_= 'PLAINTEXT')]) vm_file2 = params.Files(file=[params.File(name = 'file2', content = file2_content, type_= 'PLAINTEXT')]) and then give them as arguments to params.CloudInit _init_ constructor (files=...) just like in that example above but it seems that I am doing something wrong because it does not write multiple files - it writes only when you specify one file all right. The exception is Error: 'list' object has no attribute 'export' (I tried to specify those files as a list - files=[vm_file1,vm_file2]). Thanks for any help. The custom script is currently the only option to add files via Cloud-Init Thanks, Shahar Havivi. Hi Shahar, Granted. But the example in python http://www.ovirt.org/Features/Cloud-Init_Integration uses custom script :) I just want to know how to do the same thing in case when I want to write more than one file to a VM - and yes - all those multiple files that I want to write are specified via custom scripts. From the link - (The Python SDK paragraph: scontent object holds the custom script): scontent = write_files:\n- content: |\nsearch example.com http://example.com\nnameserver 10.10.10.1\nnameserver 10.10.10.2\npath: /etc/resolv.conf For example (and just for example), I want to write to /etc/issue and /etc/hosts not only /etc/resolv.conf. In essence, when vm goes to run-once mode I want to write more than one file to a vm via Python (using CloudInit) in automated fashion (and not touching oVirt GUI at all). You don't need to use the GUI, the sdks initialization have custom_script as string which is equivalent to the text box that you see in the GUI, and you can put the same content there (ie multiple files). Is that sufficient enough? Hi Shahar, Thanks! I will try this one. I was not aware of this feature. Although I can see that it was mentioned on the list (my bad). Thank you for your effort! I really do appreciate it! Hi, Please if somebody can help me because I am pretty stuck. As I said in previous posts I used this Python example
Re: [ovirt-users] Run once in a mode or not
On 10/29/2014 08:19 AM, Omer Frenkel wrote: - Original Message - From: Shanil S xielessha...@gmail.com To: users@ovirt.org, Juan Hernandez jhern...@redhat.com Sent: Wednesday, October 29, 2014 7:16:50 AM Subject: [ovirt-users] Run once in a mode or not Hi, Is there any api function call to know whether a vm is in Run once in a mode or not ? looks like this field is not mapped in the api, so only in the ui.. Created the following bug to track this issue: https://bugzilla.redhat.com/1158357 -- 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] python floppy in RunOnce mode
On 10/24/2014 04:08 PM, Giulio Casella wrote: Il 23/10/2014 20:59, Juan Hernandez ha scritto: On 10/23/2014 09:40 AM, Giulio Casella wrote: Hi, I'm trying to boot a vm with non persistent floppy using python ovirt sdk (the RunOnce way in administrator portal), but guest OS can't see floppy drive. The ultimate goal is to deploy floppy with sysprep unattend.xml file for windows 7 pools of vm. Here is a snippet of code I use: - myvm = api.vms.get(name=vmname) content=This is file content! f=params.File(name=foobar.txt,content=content) fs=params.Files() fs.add_file(f) payload=params.Payload() payload.set_type(floppy) payload.set_files(fs) payloads=params.Payloads() payloads.add_payload(payload) thevm=params.VM() thevm.set_payloads(payloads) action=params.Action(vm=thevm) myvm.start(action=action) xml = ParseHelper.toXml(action) print xml - As you can see, for debugging purpose, I print my xml action, and I get: - action vm payloads payload type=floppy files file namefoobar.txt/name contentThis is file content/content /file /files /payload /payloads /vm /action - in the admin portal I can see my vm in RunOnce state, but no floppy is present... In fact in the vm process command line (ps -ef | grep qemu-kvm | grep vmname) I can't see -drive option referring to floppy (I only see 2 -drive options, referring to vm system disk and to a correctly mounted cdrom ISO) What I'm doing wrong? (The engine is RHEV-M version 3.4.1-0.31.el6ev) The problem is that using non persistent payloads isn't currently supported, so basically your payloads element is silently ignored. You have currently two alternatives: 1. Use persistent payloads: vm = vms.get(name=myvm) vm.set_payloads(paylaods) vm.update() vm.start(params.Action()) You may also want to remove the payloads once the machine is configured, but this isn't strictly required, as Windows will not try to locate the sysprep floppy in subsequent boots. The only minor inconvenient is that the users of the VMs will see the floopy and its content attached. Yes, this is exactly the workaround I'm currently using, and I have to hide floppy via AD group policy (sysprep.inf contains administrator password). 2. Use the builtin sysprep files (they are in /usr/share/ovirt-engine/conf/sysprep): vm = vms.get(name=myvm) initialization = params.Initialization() vm.set_initialization(initialization) vm.update() vm.start(params.Action()) This has the advantage that the sysprep floppy will be attached to the VM only the first time it is booted. In subsequent boots it won't be attached. Great hint, I'll take a look into those syspreps to see if they fit for my setup. In 3.5 you will also be able to use sysprep support with your custom file: vm = vms.get(name=myvm) initialization = params.Initialization( custom_script=The text of your sysprep file ) vm.set_initialization(initialization) vm.update() vm.start(params.Action()) Good new, eventually I'll wait for RHEV 3.5 Note that currently (in 3.4 and in 3.5) there is an issue with the name of the file generated by the built-in sysprep support: it will always be named sysprep.inf, regardless of the operating system assigned to the VM. If you want to use recent versions of Windows it has to be named Unattend.xml, so you will need to change the Windows template before sealing it, adding the following registry entry: HKEY-LOCAL-MACHINE - SYSTEM - Setup - UnattendFile = sysprep.inf There is a bug open to avoid this: https://bugzilla.redhat.com/1145999 Note also that the builtin sysprep support will only trigger if the VM has been assigned a Windows operating system. Yes, I knew. Do you know if is there a plan to change this behaviour (e.g. generate filename according to guest O.S. standard)? Bug 1145999 has target release 3.6. That means that the team responsible for fixing has studied it and decided to fix it for version 3.6. Note that this is just a plan, things may change depending on the workload and urgency of other bugs. I'd suggest that you comment on the bug that you are interested on this fix, so that it gets a bit more priority. -- 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] Template Clone/Independent vs Thin/Dependent
On 10/23/2014 05:11 AM, Shanil S wrote: Hi Juan, Thanks for your reply. We are using the storage glusterfs-3.5.1-1.el6. I can't reproduce this, not even with the same storage that you used. Can you please try with the simple script that I suggested in the previous message and report the results? On Wed, Oct 22, 2014 at 7:26 PM, Juan Hernandez jhern...@redhat.com mailto:jhern...@redhat.com wrote: On 10/22/2014 09:38 AM, Shanil S wrote: Hi, I am using the ovirt 3.5 and when i create VM from the template through Ovirt web portal, it displays Template is Clone/Independentbut with the same template When i create through REST API, it shows Thin/Dependent... I Found one email thread ( https://www.mail-archive.com/users@ovirt.org/msg21271.html ) from the community for the same issue but even using their method still it display the same Thin/Dependent. I am using the following xml :- vm name$name/name cluster namephase1/name /cluster cpu topology cores='$core' sockets='$socket'/ /cpu memory$memory/memory template name$templatetype/name /template disks clonetrue/clone /disks /vm I have attached the screen shots , please check it. Your XML looks correct. I used it in my 3.5 environment and it works correctly, creating Clone/Independent virtual machines. What kind of storage are you using? NFS? Can you try the following script and report the results? #!/bin/sh -ex url=https://engine.example.com/ovirt-engine/api;; user=admin@internal password=** curl \ --verbose \ --insecure \ --request POST \ --user ${user}:${password} \ --header Content-Type: application/xml \ --header Accept: application/xml \ --data vm namemyvm/name cluster namemycluster/name /cluster template namemytemplate/name /template disks clonetrue/clone /disks /vm \ ${url}/vms -- 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] Change password using ovrt api is not working
On 10/23/2014 06:12 AM, Shanil S wrote: Hi Juan, The following details i got from the vm after executing the reset password [root@compute4 ~]# cp /var/run/vdsm/payload/22f57477-5d43-4795-95ec-e39ce3ba5423.757249a787c151388f6f3fa3502cf299.img /tmp/my.img [root@compute4 ~]# mount -o loop,ro /tmp/my.img /mnt [root@compute4 ~]# find /mnt /mnt /mnt/openstack /mnt/openstack/latest /mnt/openstack/latest/meta_data.json /mnt/openstack/latest/user_data [root@compute4 ~]# cat /mnt/openstack/latest/user_data #cloud-config ssh_pwauth: true disable_root: 0 output: all: ' /var/log/cloud-init-output.log' password: shanil chpasswd: expire: false runcmd: - 'sed -i ''/^datasource_list: /d'' /etc/cloud/cloud.cfg; echo ''datasource_list: [NoCloud, ConfigDrive]'' /etc/cloud/cloud.cfg' [root@compute4 ~]# The xml which i used for the reset password is action vm os boot dev='cdrom'/ /os initialization cloud_init users user user_nameroot/user_name password![CDATA[shanil]]/password /user /users /cloud_init /initialization /vm /action it seems the password is showing in the configuration ( you can see the above log ) but i am unable to login with this new password. Could you please have a look at ? Ok, there is a difference in what we generated in 3.4 and what we are generating in 3.5. Basically where aren't generating now the line that contains the user name. It should have been as follows: #cloud-config ssh_pwauth: true disable_root: 0 output: all: ' /var/log/cloud-init-output.log' user: root -- This is the line that is missing password: shanil ... I think that this is a bug, and that we should restore the previous behavior, as described in this new bug: https://bugzilla.redhat.com/1156155 Without that user: root line what happens is that cloud-init changes the password of its default user, as configured in /etc/cloud/cloud.cfg. The default for Fedora is fedora and for CentOS and RHEL is cloud-user. To workaround the issue you can edit the /etc/cloud/cloud.cfg file of the VM and change the default user name: system_info: distro: rhel default_user: name: root -- Change this from fedora or cloud-init to root On Wed, Oct 22, 2014 at 7:51 PM, Juan Hernandez jhern...@redhat.com mailto:jhern...@redhat.com wrote: On 10/22/2014 07:31 AM, Shanil S wrote: Hi, Currently i have updated the ovirt version to 3.5 and after that the reset password using api is not working but there isn't any errors returned. The following xml is i used for the reset password and it was working with the previous version action vm os boot dev='cdrom'/ /os initialization cloud_init users user user_nameroot/user_name password$newpass/password /user /users /cloud_init /initialization /vm /action Could you please have a look at the above xml ? Is there anything modified in the new version ? The reset password is working fine from the ovirt admin panel and the issue is only when we use the ovirt api to reset the password. That didn't change, your XML should work. I tested it in my environment and it works as expected. The only thing that I can imagine failing is the password containing values that break the XML syntax. Try to surround the value with a CDATA section: password![CDATA[yourpassword]]/password This is good practice, even if it isn't the cause of your problem. As usual the first step to debug this is to check if the cloud-init floppy has been generated correctly. Start the VM, go the host where it is running, locate the qemu process and the location of the floppy img: # ps -ef | grep -- '-drive file=/var/run/vdsm/payload/.*\.img' Make a copy of that file, mount and inspect it: # cp /var/run/vdsm/payload/...img /tmp/f.img # mount -o loop,ro /tmp/f.img /mnt # find /mnt # cat /mnt/openstack/latest/user_data # umount /mnt -- 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] python floppy in RunOnce mode
On 10/23/2014 09:40 AM, Giulio Casella wrote: Hi, I'm trying to boot a vm with non persistent floppy using python ovirt sdk (the RunOnce way in administrator portal), but guest OS can't see floppy drive. The ultimate goal is to deploy floppy with sysprep unattend.xml file for windows 7 pools of vm. Here is a snippet of code I use: - myvm = api.vms.get(name=vmname) content=This is file content! f=params.File(name=foobar.txt,content=content) fs=params.Files() fs.add_file(f) payload=params.Payload() payload.set_type(floppy) payload.set_files(fs) payloads=params.Payloads() payloads.add_payload(payload) thevm=params.VM() thevm.set_payloads(payloads) action=params.Action(vm=thevm) myvm.start(action=action) xml = ParseHelper.toXml(action) print xml - As you can see, for debugging purpose, I print my xml action, and I get: - action vm payloads payload type=floppy files file namefoobar.txt/name contentThis is file content/content /file /files /payload /payloads /vm /action - in the admin portal I can see my vm in RunOnce state, but no floppy is present... In fact in the vm process command line (ps -ef | grep qemu-kvm | grep vmname) I can't see -drive option referring to floppy (I only see 2 -drive options, referring to vm system disk and to a correctly mounted cdrom ISO) What I'm doing wrong? (The engine is RHEV-M version 3.4.1-0.31.el6ev) The problem is that using non persistent payloads isn't currently supported, so basically your payloads element is silently ignored. You have currently two alternatives: 1. Use persistent payloads: vm = vms.get(name=myvm) vm.set_payloads(paylaods) vm.update() vm.start(params.Action()) You may also want to remove the payloads once the machine is configured, but this isn't strictly required, as Windows will not try to locate the sysprep floppy in subsequent boots. The only minor inconvenient is that the users of the VMs will see the floopy and its content attached. 2. Use the builtin sysprep files (they are in /usr/share/ovirt-engine/conf/sysprep): vm = vms.get(name=myvm) initialization = params.Initialization() vm.set_initialization(initialization) vm.update() vm.start(params.Action()) This has the advantage that the sysprep floppy will be attached to the VM only the first time it is booted. In subsequent boots it won't be attached. In 3.5 you will also be able to use sysprep support with your custom file: vm = vms.get(name=myvm) initialization = params.Initialization( custom_script=The text of your sysprep file ) vm.set_initialization(initialization) vm.update() vm.start(params.Action()) Note that currently (in 3.4 and in 3.5) there is an issue with the name of the file generated by the built-in sysprep support: it will always be named sysprep.inf, regardless of the operating system assigned to the VM. If you want to use recent versions of Windows it has to be named Unattend.xml, so you will need to change the Windows template before sealing it, adding the following registry entry: HKEY-LOCAL-MACHINE - SYSTEM - Setup - UnattendFile = sysprep.inf There is a bug open to avoid this: https://bugzilla.redhat.com/1145999 Note also that the builtin sysprep support will only trigger if the VM has been assigned a Windows operating system. -- 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] Template Clone/Independent vs Thin/Dependent
On 10/22/2014 09:38 AM, Shanil S wrote: Hi, I am using the ovirt 3.5 and when i create VM from the template through Ovirt web portal, it displays Template is Clone/Independentbut with the same template When i create through REST API, it shows Thin/Dependent... I Found one email thread ( https://www.mail-archive.com/users@ovirt.org/msg21271.html ) from the community for the same issue but even using their method still it display the same Thin/Dependent. I am using the following xml :- vm name$name/name cluster namephase1/name /cluster cpu topology cores='$core' sockets='$socket'/ /cpu memory$memory/memory template name$templatetype/name /template disks clonetrue/clone /disks /vm I have attached the screen shots , please check it. Your XML looks correct. I used it in my 3.5 environment and it works correctly, creating Clone/Independent virtual machines. What kind of storage are you using? NFS? Can you try the following script and report the results? #!/bin/sh -ex url=https://engine.example.com/ovirt-engine/api;; user=admin@internal password=** curl \ --verbose \ --insecure \ --request POST \ --user ${user}:${password} \ --header Content-Type: application/xml \ --header Accept: application/xml \ --data vm namemyvm/name cluster namemycluster/name /cluster template namemytemplate/name /template disks clonetrue/clone /disks /vm \ ${url}/vms -- 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] 3.5 /api failure
On 10/20/2014 01:08 PM, Kapetanakis Giannis wrote: After upgrading to 3.5 today I cannot access /api/ on engine server. Apart from that everything else works ok G Check the following: * What version of the fop package is installed? # rpm -q fop * Does the /usr/share/java/fop.jar file exit? What package owns it? # ls -l /usr/share/java/fop.jar # rpm -qf /usr/share/java/fop.jar * Does the /usr/share/java/fop.jar file contain the FopFactory class? # jar tvf /usr/share/java/fop.jar | grep FopFactory * What is inside the /usr/share/ovirt-engine/modules/org/apache/fop directory? # find /usr/share/ovirt-engine/modules/org/apache/xmlgraphics/fop -ls * Is the FOP class actually loaded in the engine JVM? # su -s /bin/sh - ovirt -c jmap -histo $(pidof ovirt-engine) | grep FopFactory HTTP Status 500 - *type* Exception report *message* *description* _The server encountered an internal error () that prevented it from fulfilling this request._ *exception* javax.servlet.ServletException: Servlet.init() for servlet org.ovirt.engine.api.restapi.BackendApplication threw exception org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:489) org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:153) org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) org.jboss.web.rewrite.RewriteValve.invoke(RewriteValve.java:466) org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:368) org.apache.coyote.ajp.AjpProcessor.process(AjpProcessor.java:505) org.apache.coyote.ajp.AjpProtocol$AjpConnectionHandler.process(AjpProtocol.java:445) org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:930) java.lang.Thread.run(Thread.java:745) *root cause* java.lang.RuntimeException: java.lang.RuntimeException: Unable to instantiate MessageBodyWriter org.jboss.resteasy.plugins.providers.RegisterBuiltin.register(RegisterBuiltin.java:35) org.jboss.resteasy.spi.ResteasyDeployment.start(ResteasyDeployment.java:211) org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.init(ServletContainerDispatcher.java:67) org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.init(HttpServletDispatcher.java:36) org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:489) org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:153) org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) org.jboss.web.rewrite.RewriteValve.invoke(RewriteValve.java:466) org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:368) org.apache.coyote.ajp.AjpProcessor.process(AjpProcessor.java:505) org.apache.coyote.ajp.AjpProtocol$AjpConnectionHandler.process(AjpProtocol.java:445) org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:930) java.lang.Thread.run(Thread.java:745) *root cause* java.lang.RuntimeException: Unable to instantiate MessageBodyWriter org.jboss.resteasy.spi.ResteasyProviderFactory.registerProvider(ResteasyProviderFactory.java:772) org.jboss.resteasy.plugins.providers.RegisterBuiltin.registerProviders(RegisterBuiltin.java:70) org.jboss.resteasy.plugins.providers.RegisterBuiltin.register(RegisterBuiltin.java:31) org.jboss.resteasy.spi.ResteasyDeployment.start(ResteasyDeployment.java:211) org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.init(ServletContainerDispatcher.java:67) org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.init(HttpServletDispatcher.java:36) org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:489) org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:153) org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) org.jboss.web.rewrite.RewriteValve.invoke(RewriteValve.java:466) org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:368) org.apache.coyote.ajp.AjpProcessor.process(AjpProcessor.java:505) org.apache.coyote.ajp.AjpProtocol$AjpConnectionHandler.process(AjpProtocol.java:445) org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:930) java.lang.Thread.run(Thread.java:745) *root cause* java.lang.RuntimeException: Failed to construct public org.ovirt.engine.api.pdf.FOPMessageBodyWriter() org.jboss.resteasy.core.ConstructorInjectorImpl.construct(ConstructorInjectorImpl.java:144)
Re: [ovirt-users] 3.5 /api failure
On 10/20/2014 03:46 PM, Finstrle, Ludek wrote: Kapetanakis Giannis píše v Po 20. 10. 2014 v 14:08 +0300: After upgrading to 3.5 today I cannot access /api/ on engine server. Apart from that everything else works ok That's strange I have exactly the same error on engine during hosted-engine installation. See: https://www.mail-archive.com/users@ovirt.org/msg21715.html Luf Your problem seems to be related to a missing /usr/share/java/batik/batik-awt-util.jar file. This should be provided by the batik package. Can you check if this package is installed and if it contains this file? # rpm -q batik # rpm -ql batik | grep batik-awt-util.jar If this file is missing it may well also be the reason for the failure described in this thread. HTTP Status 500 - __ type Exception report message description The server encountered an internal error () that prevented it from fulfilling this request. exception javax.servlet.ServletException: Servlet.init() for servlet org.ovirt.engine.api.restapi.BackendApplication threw exception org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:489) org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:153) org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) org.jboss.web.rewrite.RewriteValve.invoke(RewriteValve.java:466) org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:368) org.apache.coyote.ajp.AjpProcessor.process(AjpProcessor.java:505) org.apache.coyote.ajp.AjpProtocol$AjpConnectionHandler.process(AjpProtocol.java:445) org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:930) java.lang.Thread.run(Thread.java:745) root cause java.lang.RuntimeException: java.lang.RuntimeException: Unable to instantiate MessageBodyWriter org.jboss.resteasy.plugins.providers.RegisterBuiltin.register(RegisterBuiltin.java:35) org.jboss.resteasy.spi.ResteasyDeployment.start(ResteasyDeployment.java:211) org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.init(ServletContainerDispatcher.java:67) org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.init(HttpServletDispatcher.java:36) org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:489) org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:153) org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) org.jboss.web.rewrite.RewriteValve.invoke(RewriteValve.java:466) org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:368) org.apache.coyote.ajp.AjpProcessor.process(AjpProcessor.java:505) org.apache.coyote.ajp.AjpProtocol$AjpConnectionHandler.process(AjpProtocol.java:445) org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:930) java.lang.Thread.run(Thread.java:745) root cause java.lang.RuntimeException: Unable to instantiate MessageBodyWriter org.jboss.resteasy.spi.ResteasyProviderFactory.registerProvider(ResteasyProviderFactory.java:772) org.jboss.resteasy.plugins.providers.RegisterBuiltin.registerProviders(RegisterBuiltin.java:70) org.jboss.resteasy.plugins.providers.RegisterBuiltin.register(RegisterBuiltin.java:31) org.jboss.resteasy.spi.ResteasyDeployment.start(ResteasyDeployment.java:211) org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.init(ServletContainerDispatcher.java:67) org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.init(HttpServletDispatcher.java:36) org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:489) org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:153) org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) org.jboss.web.rewrite.RewriteValve.invoke(RewriteValve.java:466) org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:368) org.apache.coyote.ajp.AjpProcessor.process(AjpProcessor.java:505) org.apache.coyote.ajp.AjpProtocol$AjpConnectionHandler.process(AjpProtocol.java:445) org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:930) java.lang.Thread.run(Thread.java:745) root cause java.lang.RuntimeException: Failed to construct public org.ovirt.engine.api.pdf.FOPMessageBodyWriter() org.jboss.resteasy.core.ConstructorInjectorImpl.construct(ConstructorInjectorImpl.java:144) org.jboss.resteasy.spi.ResteasyProviderFactory.getProviderInstance(ResteasyProviderFactory.java:1039) org.jboss.resteasy.spi.ResteasyProviderFactory.addMessageBodyWriter(ResteasyProviderFactory.java:519) org.jboss.resteasy.spi.ResteasyProviderFactory.registerProvider(ResteasyProviderFactory.java:768) org.jboss.resteasy.plugins.providers.RegisterBuiltin.registerProviders(RegisterBuiltin.java:70)
Re: [ovirt-users] async vm start (python)
On 10/15/2014 10:35 AM, Giulio Casella wrote: Thanks Juan, this clearify a lot of things. So starting a VM is always a synchronous task in the backend, isn't it? The REST API doesn't know if the action is sync or async before it is executed, only once it has been executed. In this particular case it looks like it is always sync, but I can't tell you for sure. Actually, it could be sync in some situations and async in others, and this can change from version to version. But in some condition (heavy load of hypervisors) this task takes long time (up to 20/30 seconds), not really suitable for sync tasks. Maybe I should submit a feature request... Yes, a RFE makes sense, please open it. Il 14/10/2014 16:53, Juan Hernandez ha scritto: On 10/14/2014 01:04 PM, Giulio Casella wrote: Hi everybody, I'm trying to start a VM (using python sdk) asynchronously, but I obtain synchronous behaviour. The engine is RHEV-M version 3.4.1-0.31.el6ev. Here a snippet of code: - myvm = api.vms.get(name=VMNAME) retval = myvm.start(params.Action(async=True)) print ParseHelper.toXml(retval) - and this is what I get (retval): - action asynctrue/async vm href=/api/vms/5aa66e96-5fdd-4562-9c7d-ae6f88e6805d id=5aa66e96-5fdd-4562-9c7d-ae6f88e6805d [...cut..] /vm job href=/api/jobs/5c2326c7-f25c-432f-8848-c94e80dd173b id=5c2326c7-f25c-432f-8848-c94e80dd173b/ status statecomplete/state /status /action - status of task is always complete and the operation take some time, few seconds to some tens of seconds (sync behaviour). Any ideas? Thanks in advance, Giulio The async parameter that you are passing to the REST API is only a hint. It means that *if* the action performed by the backend has associated async tasks then the REST API will not wait for them to finish. In this particular case, the action performed by the backend doesn't have async tasks, so the parameter is just ignored. -- 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] async vm start (python)
On 10/14/2014 01:04 PM, Giulio Casella wrote: Hi everybody, I'm trying to start a VM (using python sdk) asynchronously, but I obtain synchronous behaviour. The engine is RHEV-M version 3.4.1-0.31.el6ev. Here a snippet of code: - myvm = api.vms.get(name=VMNAME) retval = myvm.start(params.Action(async=True)) print ParseHelper.toXml(retval) - and this is what I get (retval): - action asynctrue/async vm href=/api/vms/5aa66e96-5fdd-4562-9c7d-ae6f88e6805d id=5aa66e96-5fdd-4562-9c7d-ae6f88e6805d [...cut..] /vm job href=/api/jobs/5c2326c7-f25c-432f-8848-c94e80dd173b id=5c2326c7-f25c-432f-8848-c94e80dd173b/ status statecomplete/state /status /action - status of task is always complete and the operation take some time, few seconds to some tens of seconds (sync behaviour). Any ideas? Thanks in advance, Giulio The async parameter that you are passing to the REST API is only a hint. It means that *if* the action performed by the backend has associated async tasks then the REST API will not wait for them to finish. In this particular case, the action performed by the backend doesn't have async tasks, so the parameter is just ignored. -- 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
On 10/03/2014 02:45 PM, Koen Vanoppen wrote: Dear all, I wanted to connected to the ovirt-shell; But I get following error: The host name ovirt.brusselsairport.aero http://ovirt.brusselsairport.aero contained in the URL doesn't match any of the names in the server certificate. This means that there is mismatch between the host name that you use and the name contained in the certificate used by the engine web server. This check is a typical security measure to avoid man in the middle attacks when using SSL. I'd suggest you check the certificate of used by the web server. In my environment, for example: # grep '^SSLCertificateFile' /etc/httpd/conf.d/ssl.conf SSLCertificateFile /etc/pki/ovirt-engine/certs/apache.cer # openssl x509 -in /etc/pki/ovirt-engine/certs/apache.cer -subject -noout subject= /C=US/O=Example Inc./CN=ovirt.example.com The relevant part here is the CN, it should match the name that you put in the url parameter of the ovirt-shell. If for whatever the reason you still want to connect using an incorrect host name you can do so setting the insecure parameter to True. My config file: [cli] autoconnect = True autopage = True [ovirt-shell] username = admin timeout = 5 extended_prompt = True url = https://ovirt.brusselsairport.aero/api insecure = False renew_session = False filter = False session_timeout = None ca_file = /root/ca.crt dont_validate_cert_chain = True key_file = None password = ** #cert_file = None Ideas? Kind regards, Koen -- 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] Error while using REST API with Ovirt
On 09/23/2014 04:55 PM, Chandrahasa S wrote: Windows 2008 R2 Regards, Chandrahasa S Ok. I don't have a 2008 machine to tests, but I tested with Windows 7, which should be quite similar. These are my suggestions: * Take into account that Windows 2008 uses an XML format for the answers file, and that the file name that sysprep will look for is Unattend.xml. On the other hand the engine will always generate a file named sysprep.inf, so you need to alter the registry settings of the VM before creating the template. In particular you need to create a key named UnattendFile entry under HKEY-LOCAL-MACHINE - SYSTEM - Setup. The value should be the location of the file. For the files generated by the engine it should be A:\sysprep.inf. With this the sysprep support should work if you use it from the GUI. * The guest agent is nice to have, but not required in order to use sysprep, and it won't allow you to change the IP configuration of the guest, only to view it. * As far as I know sysprep doesn't allow you to configure the IP addresses, only the machine name, so I believe you will have to use a different mechanism, like configuring your DHCP server so that it assigns IP addresses based on MAC addresses or host names. * You don't need to provide the content of the sysprep file, it is automatically generated by the engine, merging the parameters that you pass with the static content in the templte file /usr/share/ovirt-engine/conf/sysprep.2k8. So, to summarize, after preparing correctly the image, you should send a request like this (assuming that the VM is already created from the template): PUT /api/vms/7dac74d2-c504-4bbd-8659-c8773a844cb3 vm initialization host_nameWIN-AS05EOADAwerwer/host_name domainultimatixuat.net/domain /initialization /vm Then you can start it like this: POST /api/vms/7dac74d2-c504-4bbd-8659-c8773a844cb3/start action/ And sysprep should trigger and configure the VM. Take into account that this only works the first time you start the VM, so if you are testing multiple times remember to remove and create it again. To debug this, once the VM is started, go to the hypervisor where it is running and find the qemu process: # ps -ef | grep -- '-name the_name_of_your_vm' That should be a very long command line, including a -drive option corresponding to the sysprep floppy that the engine created and added to the VM: -drive file=/var/run/vdsm/payload/27faa0ce-3e4d-4705-adf8-30d6e9fde741.a659e9a9747fe55a8eb0c7ecbc549c86.img Copy that .img file somewhere, mount and inspect it: # cp /var/run/vdsm/payload/27faa0ce-3e4d-4705-adf8-30d6e9fde741.a659e9a9747fe55a8eb0c7ecbc549c86.img /tmp/f.img # mount -o loop,ro /tmp/f.img /mnt # find /mnt/ /mnt/ /mnt/sysprep.inf Check the content of the /mnt/sysprep.inf file, it should contain your settings. If the content of the floppy and the sysprep.inf file are correct but your VM is still not being configured then there is something wrong with the preparation of the template. From:Juan Hernandez jhern...@redhat.com To:Chandrahasa S chandrahas...@tcs.com Cc:Agarwal Ruchita agarwal.ruch...@tcs.com, users@ovirt.org Date:09/23/2014 06:58 PM Subject:Re: [ovirt-users] Error while using REST API with Ovirt On 09/23/2014 06:39 AM, Chandrahasa S wrote: Dear Juan, Thanks lot for support. Internal server error issue also resolved with linux guests. Now we are able to provide ip and hostname to linux guests in rhev 3.4 successfully via RESTAPI giving boot protocol as static as advised. For Windows Guest we did the following: 1)Prepared a template with guest agents installed and deployed a vm successfully through RESTAPI. 2)Following initialization part same as Linux guest did not work in this case and it gives default/garbage ip,hostname to the vm. 3) So we tried giving it through sysprep/payload tag through REST API. Code snippet is as follows: HttpPut put = new HttpPut( https://rhevmanager/api/vms/7dac74d2-c504-4bbd-8659-c8773a844cb3/ https://192.168.114.36/api/vms/7dac74d2-c504-4bbd-8659-c8773a844cb3/); String inputXML1 = ?xml version=\1.0\? /*vm*/ +sso+methods+method id=\+GUEST_AGENT+\/+/methods+/sso +domain+nameultimatixuat.net/name+/domain +payloads+payload type=\+floppy+\+ files+file +name/WEB-INF/sysprep.xml/name +/file+/files+/payload+/payloads +reported_devices+reported_device+ips+ip address=\+1.1.1.1+\//ips
Re: [ovirt-users] Error while using REST API with Ovirt
On 09/18/2014 08:18 AM, Chandrahasa S wrote: Dear Experts. We are Integrating our internal cloud portal with Ovirt / RHEVM version 3.4. We are integrating our internal cloud with Ovirt / RHEVM. VM template created using cloud init. Through REST API Nippet while codes passes command to template ( with cloud init) IP, HOSTNAME, We are able to set IP and Hostname to VM through code. But post this Manager getting handed. Error code is attached. Need your help please. If I understand correctly you already created a template with the cloud init configuration, then you created a VM from that template, and you want to modify it and start it. In order to update the VM you need to issue a PUT request, and the tag name for the host is host_name: String updateXml = ?xml version=\1.0\? + vm + initialization + host_namemeghaasadmin.ultimatixuat.net/host_name + regenerate_ssh_keysfalse/regenerate_ssh_keys + nic_configurations + nic_configuration + nameeth0/name + ip address=\1.1.1.1\ netmask=\255.255.255.0\ gateway=\13.3.3.3\/ + boot_protocolstatic/boot_protocol + on_boottrue/on_boot + /nic_configuration + /nic_configurations + /initialization + /vm; StringEntity updateEntity = new StringEntity(updateXml); HttpPut updateRequest = new HttpPut(apiUrl + /vms/ + vmId); updateRequest.setHeader(Content-Type, application/xml); updateRequest.setHeader(Accept, application/xml); updateRequest.setEntity(updateEntity); HttpResponse updateResponse = client.execute(updateRequest); Then, after the update, you need to start the VM and it will use that configuration: String startXml = ?xml version=\1.0\? + action/; StringEntity startEntity = new StringEntity(startXml); HttpPost startRequest = new HttpPost(apiUrl + /vms/ + vmId + /start); startRequest.setEntity(startEntity); startRequest.setHeader(Content-Type, application/xml); startRequest.setHeader(Accept, application/xml); HttpResponse startResponse = client.execute(startRequest); Some advices: * Check the XML schema for the structure of the XML documents: https://rhevmanager/api?schema * When sending requests to the RESTAPI makes sure to always explicitly add the Content-Type and Accept headers: yourRequest.setHeader(Content-Type, application/xml); yourRequest.setHeader(Accept, application/xml); * Take into account that the initialization with cloud-init will only be executed the first time you start the VM, so in your tests you will need to remove the VM and create it again. * If you are planning to do complex things you may find it helpful the Java SDK: http://www.ovirt.org/Java-sdk -- 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] Passing custom script to cloud init using api
On 09/12/2014 07:04 AM, Shanil S wrote: Hi Juan, I tried the following action vm initialization cloud_init ... files file nameignored/name content![CDATA[write_files: -content: | Some Content for my file path: /tmp/myfile permissions: '0644']]/content typeplaintext/type /file /files /cloud_init custom_script![CDATA[ write_files: -content: | Some Content for my file path: /tmp/myfile permissions: '0644']]/custom_script But in that time i go the following errors from the api Request syntactically incorrect. See the link description below for the correct usage:start a virtual machine in the system identified by the given idPOST Content-Typeapplication/xml|json If i change the xml format like action vm initialization cloud_init ... files file nameignored/name content![CDATA[write_files: -content: | Some Content for my file path: /tmp/myfile permissions: '0644']]/content typeplaintext/type /file /files /cloud_init custom_script write_files: -content: | Some Content for my file path: /tmp/myfile permissions: '0644'/custom_script the cloud init part won't work even though we didn't get any errors from the api. Could you please check it ? The attached example script worked correctly for me. Be careful with the indentation of the write_files section, as it the format is YAML and it is sensitive to indentation. Also putting the file in /tmp may be bad idea, specially if you want it to persist after rebooting the machine. On Thu, Sep 11, 2014 at 6:16 PM, Juan Hernandez jhern...@redhat.com mailto:jhern...@redhat.com wrote: On 09/11/2014 12:51 PM, Shanil S wrote: Hi Juan, Also, i tried the following custom script from the ovirt panel and its working #cloud-config write_files: -content: | # THIS IS MY TEXT FILE Some Content for my file path: /tmp/myfile permissions: '0644' but the same content script i tried from the ovir api call like custom_script#cloud-config write_files: -content: | # THIS IS MY TEXT FILE Some Content for my file path: /tmp/myfile permissions: '0644' /custom_script /initialization But its not working, may be this is a bug in the ovirt api function call ? Currently the custom_script element doesn't work in combination with cloud-init. To make it work you will have to use the files element: action vm initialization cloud_init ... files file namethis is ignored/name content![CDATA[your script]]/content typeplaintext/type /file /files /cloud_init /initialization /vm /action As I wrote before there is a bug related to this: https://bugzilla.redhat.com/1138564 If that bug is fixed (unlikely according to the last comments) then the custom_script element will start working, but for know I suggest you include your custom script in both places: action vm initialization cloud_init ... files file namethis is ignored/name content![CDATA[your script]]/content typeplaintext/type /file /files /cloud_init custom_script![CDATA[your script]]/custom_script /initialization /vm /action -- Regards Shanil On Thu, Sep 11, 2014 at 3:36 PM, Shanil S xielessha...@gmail.com mailto:xielessha...@gmail.com mailto:xielessha...@gmail.com mailto:xielessha...@gmail.com wrote: Hi Juan, Okay sure.. The following xml i used action vm os boot dev='cdrom'/ /os initialization cloud_init host addresstest2/address /host users user user_nameroot/user_name passwordtest/password /user /users network_configuration nics nic interfacevirtio/interface nameeth0/name boot_protocolnone/boot_protocol
Re: [ovirt-users] Passing custom script to cloud init using api
On 09/11/2014 06:54 AM, Shanil S wrote: Hi Juan, It seems the it doesn't contains the phone_home section in the cat /mnt/openstack/latest/user_data the following is the output #cloud-config ssh_pwauth: true disable_root: 0 output: all: ' /var/log/cloud-init-output.log' user: root password: admin123 chpasswd: expire: false runcmd: - 'sed -i ''/^datasource_list: /d'' /etc/cloud/cloud.cfg; echo ''datasource_list: [NoCloud, ConfigDrive]'' /etc/cloud/cloud.cfg' but if i try with the files file nameignored/name content![CDATA[runcmd: - echo 'Test script !' /iwashere_test.txt ]]/content typeplaintext/type /file /files then it will create the /iwashere_test.txt and write the contents and in that time the cat /mnt/openstack/latest/user_data is cat /mnt/openstack/latest/user_data #cloud-config ssh_pwauth: true disable_root: 0 output: all: ' /var/log/cloud-init-output.log' user: root password: admin123 chpasswd: expire: false runcmd: - 'sed -i ''/^datasource_list: /d'' /etc/cloud/cloud.cfg; echo ''datasource_list: [NoCloud, ConfigDrive]'' /etc/cloud/cloud.cfg' runcmd: - echo 'Test script !' /iwashere_test.txt so, i think the custom script section is not working, i am attaching the vm log as a screenshot. Can you share the XML document that you sent to the RESTAPI in order to populate the phone_home section? On Wed, Sep 10, 2014 at 2:07 PM, Juan Hernandez jhern...@redhat.com mailto:jhern...@redhat.com wrote: On 09/10/2014 06:44 AM, Shanil S wrote: Hi Juan, What i am planning to do is to make work the following script #cloud-config # phone_home: if this dictionary is present, then the phone_home # cloud-config module will post specified data back to the given # url # default: none # phone_home: # url: http://my.foo.bar/$INSTANCE/ # post: all # tries: 10 # phone_home: url: http://my.example.com/$INSTANCE_ID/ post: [ pub_key_dsa, pub_key_rsa, pub_key_ecdsa, instance_id ] (http://cloudinit.readthedocs.org/en/latest/topics/examples.html#run-commands-on-first-boot) but it wasn't working when i tried, i hope to post the above values to the specific url and get the posted details. I think it should work, but it depends completely on cloud-init itself. I'd suggest you check the content of the generated cloud-init configuration file (as described in a previous mail). If it contains the phone_home section then you can discard a problem with oVirt, and focus on clud-init. On Wed, Sep 10, 2014 at 10:02 AM, Shanil S xielessha...@gmail.com mailto:xielessha...@gmail.com mailto:xielessha...@gmail.com mailto:xielessha...@gmail.com wrote: Hi Juan, Okay.. Thanks.. its working. I would like to execute other page something like test_script.php by posting some values to it using the cloud init, Is it possible to do it ? -- Regards Shanil On Fri, Sep 5, 2014 at 10:08 PM, Juan Hernandez jhern...@redhat.com mailto:jhern...@redhat.com mailto:jhern...@redhat.com mailto:jhern...@redhat.com wrote: On 09/05/2014 12:55 PM, Shanil S wrote: Hi Juan, Thanks for your reply. I tried with the above but i was unable to find the 'iwashere.txt' after executing the above xml. I repeated the test, this time with 3.4, and it worked fine for me. As the formatting of the XML is very important I'd suggest that you take the attached script (instead of copy paste from the mail), change the password and VM id and run it. There are two kind of things that can go wrong here. One is that the engine/VDSM combination may not be generating the right file. To verify this start the VM with the attached script, and once it is started go to the hypervisor where it is running and find the corresponding qemu process: # ps -ef | grep -- '-name myvm' This will give you a very long command line. That command line should include a -drive option containing the full path of the disk image generated by the engine/VDSM, something like this: -drive file=/var/run/vdsm/payload/b5f087d4-022d-4d5f-8a1e-268c562c7bb1.b6fcddff571bb8c2028c61b623d172a6.img To inspect its content make a copy (just
Re: [ovirt-users] Passing custom script to cloud init using api
On 09/11/2014 12:51 PM, Shanil S wrote: Hi Juan, Also, i tried the following custom script from the ovirt panel and its working #cloud-config write_files: -content: | # THIS IS MY TEXT FILE Some Content for my file path: /tmp/myfile permissions: '0644' but the same content script i tried from the ovir api call like custom_script#cloud-config write_files: -content: | # THIS IS MY TEXT FILE Some Content for my file path: /tmp/myfile permissions: '0644' /custom_script /initialization But its not working, may be this is a bug in the ovirt api function call ? Currently the custom_script element doesn't work in combination with cloud-init. To make it work you will have to use the files element: action vm initialization cloud_init ... files file namethis is ignored/name content![CDATA[your script]]/content typeplaintext/type /file /files /cloud_init /initialization /vm /action As I wrote before there is a bug related to this: https://bugzilla.redhat.com/1138564 If that bug is fixed (unlikely according to the last comments) then the custom_script element will start working, but for know I suggest you include your custom script in both places: action vm initialization cloud_init ... files file namethis is ignored/name content![CDATA[your script]]/content typeplaintext/type /file /files /cloud_init custom_script![CDATA[your script]]/custom_script /initialization /vm /action -- Regards Shanil On Thu, Sep 11, 2014 at 3:36 PM, Shanil S xielessha...@gmail.com mailto:xielessha...@gmail.com wrote: Hi Juan, Okay sure.. The following xml i used action vm os boot dev='cdrom'/ /os initialization cloud_init host addresstest2/address /host users user user_nameroot/user_name passwordtest/password /user /users network_configuration nics nic interfacevirtio/interface nameeth0/name boot_protocolnone/boot_protocol on_boottrue/on_boot /nic /nics dns servers host addressx.x.x.x/address /host /servers /dns /network_configuration /cloud_init custom_script #cloud-config phone_home: url: http://x.x.com/api/xx/api_receive.php /custom_script /initialization /vm /action -- Regards Shanil On Thu, Sep 11, 2014 at 1:48 PM, Juan Hernandez jhern...@redhat.com mailto:jhern...@redhat.com wrote: On 09/11/2014 06:54 AM, Shanil S wrote: Hi Juan, It seems the it doesn't contains the phone_home section in the cat /mnt/openstack/latest/user_data the following is the output #cloud-config ssh_pwauth: true disable_root: 0 output: all: ' /var/log/cloud-init-output.log' user: root password: admin123 chpasswd: expire: false runcmd: - 'sed -i ''/^datasource_list: /d'' /etc/cloud/cloud.cfg; echo ''datasource_list: [NoCloud, ConfigDrive]'' /etc/cloud/cloud.cfg' but if i try with the files file nameignored/name content![CDATA[runcmd: - echo 'Test script !' /iwashere_test.txt ]]/content typeplaintext/type /file /files then it will create the /iwashere_test.txt and write the contents and in that time the cat /mnt/openstack/latest/user_data is cat /mnt/openstack/latest/user_data #cloud-config ssh_pwauth: true disable_root: 0 output: all: ' /var/log/cloud-init-output.log' user: root password: admin123 chpasswd: expire: false runcmd: - 'sed -i ''/^datasource_list: /d'' /etc/cloud/cloud.cfg; echo ''datasource_list: [NoCloud, ConfigDrive]'' /etc/cloud/cloud.cfg' runcmd: - echo 'Test script !' /iwashere_test.txt so, i think the custom script section
Re: [ovirt-users] Un-suspend the server
On 09/10/2014 09:21 AM, Shanil S wrote: Hi, I have found that there is an api function to suspend the server but couldn't find out any methods to unsuspend it ? or can we use the same start function to un-suspend the server ? Use start, without parameters. -- 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] Passing custom script to cloud init using api
On 09/04/2014 11:59 AM, Shanil S wrote: Hi Juan, I tried with the above touch command but it seems the 'iwashere' file isn't created after executing it the above command. Trying to make an example for this I discovered that the custom_script element is currently ignored if the cloud_init element is present. Instead we are taking the content of the first file element from the cloud_init element and appending it to the cloud-init configuration file. I believe that this is a bug, as it breaks backwards compatibility: https://bugzilla.redhat.com/1138564 However, you can exploit this bug to do what you want. This is an example: #!/bin/sh -ex url=https://ovirt.example.com/ovirt-engine/api; user=admin@internal password=** curl \ --insecure \ --request POST \ --header Accept: application/xml \ --header Content-Type: application/xml \ --user ${user}:${password} \ --data ' action vm initialization cloud_init host addressmyhost.mydomain.com/address /host users user user_nameroot/user_name passwordmypassword/password /user /users network_configuration nics nic nameeth0/name boot_protocolstatic/boot_protocol network ip address=192.168.122.31 netmask=255.255.255 gateway=192.168.122.1/ /network on_boottrue/on_boot /nic /nics dns servers host address192.168.122.1/address /host /servers search_domains host addressmydomain.com/address /host /search_domains /dns /network_configuration files file nameignored/name content![CDATA[runcmd: - echo I was here! /iwashere.txt ]]/content typeplaintext/type /file /files /cloud_init custom_script![CDATA[runcmd: - echo I was here! /iwashere.txt ]]/custom_script /initialization /vm /action ' \ ${url}/vms/480225cf-0cbd-4166-b9ca-3857b124618a/start Note that in this example I am including the custom script both in the first file element inside cloud_init and in the custom_script element, this way it will work with the current version of the engine and also if/when we eventually fix the bug. Please remember to update the wiki with your feedback: http://www.ovirt.org/REST-Api#How_can_I_run_a_custom_script_using_cloud-init.3F On Thu, Sep 4, 2014 at 3:02 PM, Juan Hernandez jhern...@redhat.com mailto:jhern...@redhat.com wrote: On 09/04/2014 10:58 AM, Shanil S wrote: Hi Juan, Okay.. Thanks for your update. Also i found some sample cloud init scripts from here https://github.com/number5/cloud-init/tree/master/doc/examples and i tried the following scripts - type: foo/wark filename: bar content: | This is my payload hello - this is also payload - | multi line payload here - type: text/upstart-job filename: my-upstart.conf content: | Test file contents And run the start vm using the above script using cloud init and api, Could you please tell me where i can find the result of the above script ? I think the above script will create a file like my-upstart.conf As I said I am not a cloud-init expert, so I don't really know what is the meaning or effect of this script. But I think that you need to use the runcmd option. For example: action ... initialization cloud-init.../cloud-init custom-script![CDATA[runcmd: - touch /iwashere ]]/custom-script /initialization /action If you use this it should run the touch /iwashere command, and you can check that it did verifying that the /iwashere file exists. As I said I didn't test this, so I may not work. I'd appreciate if you can test it, and once it works update the wiki with the correct instructions: http://www.ovirt.org/REST-Api#How_can_I_run_a_custom_script_using_cloud-init.3F On Thu, Sep 4, 2014 at 1:56 PM, Juan Hernandez jhern...@redhat.com mailto:jhern...@redhat.com mailto:jhern...@redhat.com mailto:jhern...@redhat.com wrote: On 09/04/2014 06:29 AM, Shanil S wrote: Hi Juan, Is there anyways to specify the custom script from a file in the xml ? ie, i have a script in a file called script.sh and i would like to include this script in the xml with the api call. Is there any methods for this ? You can deploy files using cloud-init, and the run them using the custom script. Something like
Re: [ovirt-users] Passing custom script to cloud init using api
On 09/05/2014 10:46 AM, Sven Kieske wrote: Am 05.09.2014 10:27, schrieb Juan Hernandez: Trying to make an example for this I discovered that the custom_script element is currently ignored if the cloud_init element is present. Instead we are taking the content of the first file element from the cloud_init element and appending it to the cloud-init configuration file. I believe that this is a bug, as it breaks backwards compatibility: https://bugzilla.redhat.com/1138564 Thanks for the report, I just proposed this as a blocker for the 3.4.4 release as it is a clear regression. Also I rely on this functionality in my 3.3. setup and I want to upgrade to 3.4 so I can't upgrade until this is fixed and released. Agree, I set the bug as a blocker for 3.4.4. However, you can exploit this bug to do what you want. This is an example: Well I guess this is a pretty bad idea, because it will just work until the bug is fixed? No, what I proposed in the example is to put the custom script in both the first file inside clud_init and in the custom_script element. That should work with the current status and also if/when we fix the bug. -- 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] Passing custom script to cloud init using api
On 09/05/2014 12:55 PM, Shanil S wrote: Hi Juan, Thanks for your reply. I tried with the above but i was unable to find the 'iwashere.txt' after executing the above xml. I repeated the test, this time with 3.4, and it worked fine for me. As the formatting of the XML is very important I'd suggest that you take the attached script (instead of copy paste from the mail), change the password and VM id and run it. There are two kind of things that can go wrong here. One is that the engine/VDSM combination may not be generating the right file. To verify this start the VM with the attached script, and once it is started go to the hypervisor where it is running and find the corresponding qemu process: # ps -ef | grep -- '-name myvm' This will give you a very long command line. That command line should include a -drive option containing the full path of the disk image generated by the engine/VDSM, something like this: -drive file=/var/run/vdsm/payload/b5f087d4-022d-4d5f-8a1e-268c562c7bb1.b6fcddff571bb8c2028c61b623d172a6.img To inspect its content make a copy (just in case) and mount it: # cp -drive file=/var/run/vdsm/payload/b5f087d4-022d-4d5f-8a1e-268c562c7bb1.b6fcddff571bb8c2028c61b623d172a6.img /root/my.img # mount -o loop,ro /root/my.img /mnt Inspect the content: # find /mnt /mnt/openstack /mnt/openstack/content /mnt/openstack/content/ /mnt/openstack/latest /mnt/openstack/latest/meta_data.json /mnt/openstack/latest/user_data The content of the custom-script should be at the end of the user_data file, so take a look at that: # cat /mnt/openstack/latest/user_data #cloud-config ssh_pwauth: true disable_root: 0 output: all: ' /var/log/cloud-init-output.log' user: root password: mypassword chpasswd: expire: false runcmd: - 'sed -i ''/^datasource_list: /d'' /etc/cloud/cloud.cfg; echo ''datasource_list: [NoCloud, ConfigDrive]'' /etc/cloud/cloud.cfg' runcmd: - echo I was here! /iwashere.txt If your custom script isn't there then there is some problem in the engine/VDSM side, otherwise the problem is probably in cloud-init itself, and we will need someone with more knowledge of cloud-init to debug it. Don't forget to umount the file when finished: # umount /mnt On Fri, Sep 5, 2014 at 3:00 PM, Juan Hernandez jhern...@redhat.com mailto:jhern...@redhat.com wrote: On 09/05/2014 10:46 AM, Sven Kieske wrote: Am 05.09.2014 10:27, schrieb Juan Hernandez: Trying to make an example for this I discovered that the custom_script element is currently ignored if the cloud_init element is present. Instead we are taking the content of the first file element from the cloud_init element and appending it to the cloud-init configuration file. I believe that this is a bug, as it breaks backwards compatibility: https://bugzilla.redhat.com/1138564 Thanks for the report, I just proposed this as a blocker for the 3.4.4 release as it is a clear regression. Also I rely on this functionality in my 3.3. setup and I want to upgrade to 3.4 so I can't upgrade until this is fixed and released. Agree, I set the bug as a blocker for 3.4.4. However, you can exploit this bug to do what you want. This is an example: Well I guess this is a pretty bad idea, because it will just work until the bug is fixed? No, what I proposed in the example is to put the custom script in both the first file inside clud_init and in the custom_script element. That should work with the current status and also if/when we fix the bug. -- 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. cloud-init-example.sh Description: application/shellscript ___ Users mailing list Users@ovirt.org http://lists.ovirt.org/mailman/listinfo/users
Re: [ovirt-users] Passing custom script to cloud init using api
On 09/04/2014 06:29 AM, Shanil S wrote: Hi Juan, Is there anyways to specify the custom script from a file in the xml ? ie, i have a script in a file called script.sh and i would like to include this script in the xml with the api call. Is there any methods for this ? You can deploy files using cloud-init, and the run them using the custom script. Something like this: action ... initialization cloud-init files file name=/root/myscript.sh/ content![CDATA[#!/bin/sh the content of your script]]/content /file /files /cloud-init custom_script![CDATA[runcmd: - sh /root/myscript.sh ]]/custom_script /initialization /action But I'm not a cloud-init expert, and I didn't test this, so I don't really know if the custom_script will run before or after the files are deployed. It makes more sense to run the scripts after deploying the files, but you will have to test it yourself. The content of the files and the scripts has to be embedded in the XML document that you send to the RESTAPI server, there is no way to send an XML document and a separate file. Building this kind of XML document shouldn't be complicated if you use the CDATA syntax like in the example above. Another thing that you may consider, if you have to run a complicated script or set of scripts, is to have them pre-installed in the template that you use to create the VM, then you just need to run them. -- Regards Shanil On Tue, Sep 2, 2014 at 3:02 PM, Shanil S xielessha...@gmail.com mailto:xielessha...@gmail.com wrote: Hi Juan, Thanks for the solution. -- Regards Shanil On Tue, Sep 2, 2014 at 2:59 PM, Juan Hernandez jhern...@redhat.com mailto:jhern...@redhat.com wrote: On 09/02/2014 05:46 AM, Shanil S wrote: Hi All, From the ovirt admin panel, there is an option to give the custom script in the cloud init ( Run Once- cloud init- Custom script ). Is there any ways to pass the custom script to cloud init using the rest api ? The custom script should go inside the custom_script element inside the initialization element: action ... initialization cloud_init.../cloud_init custom_scriptyour custom script/custom_script /initialization /action -- 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 -- 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] Passing custom script to cloud init using api
On 09/04/2014 10:58 AM, Shanil S wrote: Hi Juan, Okay.. Thanks for your update. Also i found some sample cloud init scripts from here https://github.com/number5/cloud-init/tree/master/doc/examples and i tried the following scripts - type: foo/wark filename: bar content: | This is my payload hello - this is also payload - | multi line payload here - type: text/upstart-job filename: my-upstart.conf content: | Test file contents And run the start vm using the above script using cloud init and api, Could you please tell me where i can find the result of the above script ? I think the above script will create a file like my-upstart.conf As I said I am not a cloud-init expert, so I don't really know what is the meaning or effect of this script. But I think that you need to use the runcmd option. For example: action ... initialization cloud-init.../cloud-init custom-script![CDATA[runcmd: - touch /iwashere ]]/custom-script /initialization /action If you use this it should run the touch /iwashere command, and you can check that it did verifying that the /iwashere file exists. As I said I didn't test this, so I may not work. I'd appreciate if you can test it, and once it works update the wiki with the correct instructions: http://www.ovirt.org/REST-Api#How_can_I_run_a_custom_script_using_cloud-init.3F On Thu, Sep 4, 2014 at 1:56 PM, Juan Hernandez jhern...@redhat.com mailto:jhern...@redhat.com wrote: On 09/04/2014 06:29 AM, Shanil S wrote: Hi Juan, Is there anyways to specify the custom script from a file in the xml ? ie, i have a script in a file called script.sh and i would like to include this script in the xml with the api call. Is there any methods for this ? You can deploy files using cloud-init, and the run them using the custom script. Something like this: action ... initialization cloud-init files file name=/root/myscript.sh/ content![CDATA[#!/bin/sh the content of your script]]/content /file /files /cloud-init custom_script![CDATA[runcmd: - sh /root/myscript.sh ]]/custom_script /initialization /action But I'm not a cloud-init expert, and I didn't test this, so I don't really know if the custom_script will run before or after the files are deployed. It makes more sense to run the scripts after deploying the files, but you will have to test it yourself. The content of the files and the scripts has to be embedded in the XML document that you send to the RESTAPI server, there is no way to send an XML document and a separate file. Building this kind of XML document shouldn't be complicated if you use the CDATA syntax like in the example above. Another thing that you may consider, if you have to run a complicated script or set of scripts, is to have them pre-installed in the template that you use to create the VM, then you just need to run them. -- Regards Shanil On Tue, Sep 2, 2014 at 3:02 PM, Shanil S xielessha...@gmail.com mailto:xielessha...@gmail.com mailto:xielessha...@gmail.com mailto:xielessha...@gmail.com wrote: Hi Juan, Thanks for the solution. -- Regards Shanil On Tue, Sep 2, 2014 at 2:59 PM, Juan Hernandez jhern...@redhat.com mailto:jhern...@redhat.com mailto:jhern...@redhat.com mailto:jhern...@redhat.com wrote: On 09/02/2014 05:46 AM, Shanil S wrote: Hi All, From the ovirt admin panel, there is an option to give the custom script in the cloud init ( Run Once- cloud init- Custom script ). Is there any ways to pass the custom script to cloud init using the rest api ? The custom script should go inside the custom_script element inside the initialization element: action ... initialization cloud_init.../cloud_init custom_scriptyour custom script/custom_script /initialization /action -- 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] Start VM function using ovirt api
On 09/03/2014 10:12 AM, Shanil S wrote: Hi All, We are using the /api/vm/ID/start function to start the virtual machine but it seems the vm is start in the run once mode. We want to start the vm in the Run mode rather than the run once, How can we do this ? Is there any other option to start the vm in the run mode ? it is possible from the ovirt admin panel. The following xml is used for the start vm action $xml_data = actionboot dev='cdrom'//os vm/vm/action; Use an empty action/ element. The presence of the nested vm/vm element means run once. -- 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] Passing custom script to cloud init using api
On 09/02/2014 05:46 AM, Shanil S wrote: Hi All, From the ovirt admin panel, there is an option to give the custom script in the cloud init ( Run Once- cloud init- Custom script ). Is there any ways to pass the custom script to cloud init using the rest api ? The custom script should go inside the custom_script element inside the initialization element: action ... initialization cloud_init.../cloud_init custom_scriptyour custom script/custom_script /initialization /action -- 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] Real time network usages and IO usages of VM
On 08/29/2014 07:08 AM, Shanil S wrote: Hi All, Is there any api methods to get the real time network usages and IO usages os of each vm ? I tried it by using api/vms/$id/statistics but its not getting the network and IO usages. Is it possible to get these details using the api calls ? -- Regards Shanil Did you try with vms/{vm:id}/nics/{nic:id}/statistics? Note that currently we have the following statistics available there: data.current.rx Receive data rate data.current.tx Transmit data rate errors.total.rx Total transmit errors errors.total.tx Total transmit errors I guess that this isn't what you are looking for, but we don't have anything else at the moment. For disk IO you should take a look at vms/{vm:id}/disks/{disk:id}/statistics. The collection of statistics available there is the following: data.current.read Read data rate data.current.write Write data rate disk.read.latency Read latency disk.write.latency Write latency disk.flush.latency Flush latency Does this cover your needs? If it doesn't I'd suggest that you open a RFE to request adding additional statistics. Meanwhile you will have to use other mechanisms to find the statistics that you need. -- 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] Unable to assign profile to the nic
On 08/29/2014 05:21 AM, Shanil S wrote: Hi Juan, I have attached the screenshot of the ovirt panel after creating the nic's with the above code, Please check it. May it be that you are using version 3.3.0? The RESTAPI support for vNIC profiles was added in 3.3.1. On Thu, Aug 28, 2014 at 3:23 PM, Juan Hernandez jhern...@redhat.com mailto:jhern...@redhat.com wrote: On 08/28/2014 10:31 AM, Shanil S wrote: Hi All, I am unable to assign the profile using the ovirt api code, the following xml code is used for creating the nic nic interfacevirtio/interface nameeth0/name boot_protocolstatic/boot_protocol mac address='.$ip-mac_address.'/ network ip address='.$ip-mac_ip.' netmask='255.255.255.0' gateway='.$ip-mac_gateway.'/ /network on_boottrue/on_boot vnic_profile id='bbabc471-667d-4221-bc8e-4ab30b3dcc34' / /nic Could you please check if anything wrong with it ? There is nothing severely wrong with that XML, it should work. What specific problems are you having? Does the API return an error? Anything in the logs? Note also that the boot_protocol, ip, and on_boot elements will just be ignored. These elements are used only for host NICs, not for VM NICs. If you want to change the IP configuration of the OS of the VM then you have to use whatever mechanisms that OS provides. The RESTAPI can help you in these regards only if you combine it with Cloud-init or Sysprep. -- 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 -- 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] VM second netowork not Comeup
On 08/29/2014 05:30 AM, Shanil S wrote: Hi Dan, Please ignore the previous screenshot and check this. -- Regards Shanil On Fri, Aug 29, 2014 at 8:49 AM, Shanil S xielessha...@gmail.com mailto:xielessha...@gmail.com wrote: Hi Dan, I have attached the screenshot of the console, please check it. -- Regards Shanil On Thu, Aug 28, 2014 at 4:46 PM, Dan Kenigsberg dan...@redhat.com mailto:dan...@redhat.com wrote: On Thu, Aug 28, 2014 at 01:50:22PM +0530, Shanil S wrote: Hi Aill, We are creating two nics using the api, but it seems the second network is not come up and the first one is working. The following xml is used to for the nic creation nic interfacevirtio/interface nameeth0/name boot_protocolstatic/boot_protocol mac address='.$ip-mac_address.'/ network ip address='.$ip-mac_ip.' netmask='255.255.255.0' gateway='.$ip-mac_gateway.'/ /network on_boottrue/on_boot vnic_profile id='bbabc471-667d-4221-bc8e-4ab30b3dcc34' / /nic nic interfacevirtio/interface nameeth1/name boot_protocolstatic/boot_protocol mac address='.$ip-mac_address.'/ network ip address='.$ip-mac_ip.' netmask='255.255.255.0' gateway='.$ip-mac_gateway.'/ /network on_boottrue/on_boot vnic_profile id='037d806f-d76b-4da3-84b6-ac7a5087f836' / /nic When i checked the configuration file (/etc/sysconfig/network-scripts/ifcfg-eth1) after creating...i find it seems the ONBOOT=no.eventhough we set it true from the api. Is this a bug ? I do not know what on_boot means in oVirt API, but it certainly is not passed to Vdsm or the guest, and as such cannot control what's in the guest's /etc/sysconfig/network-scripts/ifcfg-eth1. The guest may have ifcfg files, it may run NetworkManager, or it may be Ubunto or Windows. oVirt is responsible to exposing a (virtual) NIC to the guest, but does not interfere with its configuration. Dan The on_boot parameter that you pass when creating the NIC is completely ignored, like all the other IP configuration parameters. But looking at your screenshot it looks like you are already using cloud-init to solve this. Are you using those nic.../nic XML documents as part of larger request to create a VM? In that case we need to check the complete XML document in order to see if there is something wrong. Can you share it? -- 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] Guest reboot feature using REST API
On 08/29/2014 12:09 PM, Shanil S wrote: Hi All, It is found that there is a function like guest reboot ( http://www.ovirt.org/Features/Guest_Reboot ) Is there any rest api function for doing this guest reboot ? currently i found only one function for reboot (/api/vms/id/reboot). We are currently using the Ovirt 3.4.3 version Yes: #!/bin/sh -ex url=https://ovirt.example.com/ovirt-engine/api; user=admin@internal password=** curl \ --insecure \ --request POST \ --header Accept: application/xml \ --header Content-Type: application/xml \ --user ${user}:${password} \ --data action/ \ ${url}/vms/dc7076ee-9ae7-4a14-bec6-7936f76b4375/reboot -- 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] VM second netowork not Comeup
On 08/29/2014 12:02 PM, Shanil S wrote: Hi Juan, These are the xml details which i used for the vm start function, please check it Ok, this explains this problem and the other problem that you are having with assigning profile. It is important to understand that there are two sets of parameters associated to a network interface: 1. Those that define the virtual hardware configuration, like the model, interface, MAC and profile. Those are assigned when you create or update the NIC. For example: #!/bin/sh -x url=https://ovirt.example.com/ovirt-engine/api; user=admin@internal password=** curl \ --verbose \ --insecure \ --request POST \ --header Accept: application/xml \ --header Content-Type: application/xml \ --user ${user}:${password} \ --data nic interfacevirtio/interface namenic1/name mac address='00:1a:4a:16:01:53'/ vnic_profile id='8d69b87d-a6df-4912-adb7-d498c2fdc8e3'/ /nic \ ${url}/vms/b848fc2e-5df2-4754-ae7c-98a20c0e373d/nics If you include in a request like this any IP information, like boot protocol, address, etc, it will be just silently ignored. 2. Those that define the software device configuration. These are managed by the guest OS, and you can set them using cloud-init, as you are doing. But you can't change the hardware configuration with cloud-init, that is why your vnic_profile element is ignored. See some more comments below: action vm os boot dev='cdrom'/ /os initialization cloud_init users user user_nameroot/user_name password/password /user /users network_configuration nics nic interfacevirtio/interface This ^ line is ignored by cloud-init. nameeth0/name boot_protocolstatic/boot_protocol mac address='xx:xx:xx:xx:xx:xx'/ This ^ line is ignored by cloud-init. network ip address='xx.xx.xx.xx' netmask='255.255.255.0' gateway='xx.xx.xx.xx'/ /network on_boottrue/on_boot vnic_profile id='bbabc471-667d-4221-bc8e-4ab30b3dcc34' / This ^ line is ignored by cloud-init. The vnic_profile is only used when creating the NIC. /nic nic interfacevirtio/interface This ^ line is ignored by cloud-init. nameeth1/name You should add boot_protocolstatic/boot_protocol here, like in eth0. mac address='xx:xx:xx:xx:xx:xx'/ This ^ line is ignored by cloud-init. network ip address='xx.xx.xx.xx' netmask='255.255.255.0' gateway=''/ /network on_boottrue/on_boot vnic_profile id='bbabc471-667d-4221-bc8e-4ab30b3dcc34' / This ^ line is ignored by cloud-init. The vnic_profile is only used when creating the NIC. /nic /nics dns servers host address8.8.8.8/address /host /servers /dns /network_configuration /cloud_init /initialization /vm /action -- Regards Shanil On Fri, Aug 29, 2014 at 2:15 PM, Juan Hernandez jhern...@redhat.com mailto:jhern...@redhat.com wrote: On 08/29/2014 05:30 AM, Shanil S wrote: Hi Dan, Please ignore the previous screenshot and check this. -- Regards Shanil On Fri, Aug 29, 2014 at 8:49 AM, Shanil S xielessha...@gmail.com mailto:xielessha...@gmail.com mailto:xielessha...@gmail.com mailto:xielessha...@gmail.com wrote: Hi Dan, I have attached the screenshot of the console, please check it. -- Regards Shanil
Re: [ovirt-users] Unable to assign profile to the nic
On 08/28/2014 10:31 AM, Shanil S wrote: Hi All, I am unable to assign the profile using the ovirt api code, the following xml code is used for creating the nic nic interfacevirtio/interface nameeth0/name boot_protocolstatic/boot_protocol mac address='.$ip-mac_address.'/ network ip address='.$ip-mac_ip.' netmask='255.255.255.0' gateway='.$ip-mac_gateway.'/ /network on_boottrue/on_boot vnic_profile id='bbabc471-667d-4221-bc8e-4ab30b3dcc34' / /nic Could you please check if anything wrong with it ? There is nothing severely wrong with that XML, it should work. What specific problems are you having? Does the API return an error? Anything in the logs? Note also that the boot_protocol, ip, and on_boot elements will just be ignored. These elements are used only for host NICs, not for VM NICs. If you want to change the IP configuration of the OS of the VM then you have to use whatever mechanisms that OS provides. The RESTAPI can help you in these regards only if you combine it with Cloud-init or Sysprep. -- 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 api function
On 08/22/2014 05:58 AM, Shanil S wrote: Hi Juan, Thanks for your replies.. Regarding the rebuild VM, Is that any method to reinstall the os on the VM without remove it or create a new one? This is the same that with a physical machine: it all depends on the facilities that you have available to boot the machine to the re-install process. You can, for example, set you VM to boot from the network, using PXE, and use your favorite system (manual setup of TFTP, cobbler, foreman, etc) to re-install the OS. There are tons of options for this. However, unless you have data in the VM that you want to preserve, it may be easier and faster (specially if you are using templates) to remove it and create a new one. -- Regards Shanil On Thu, Aug 21, 2014 at 4:55 PM, Juan Hernandez jhern...@redhat.com mailto:jhern...@redhat.com wrote: On 08/20/2014 12:42 PM, Shanil S wrote: Hi, I would like to create the following functions using the ovirt api 1. Rebuild VM What do you exactly mean by rebuild vm? 2. Restore the screenthots of one vm to another vm What you can do is create a new VM from an existing snapshot, something like this: #!/bin/sh -ex url=https://ovirt.example.com/ovirt-engine/api; user=admin@internal password=** curl \ --verbose \ --insecure \ --request POST \ --header Accept: application/xml \ --header Content-Type: application/xml \ --user ${user}:${password} \ --data vm namemyclone/name cluster id='0001-0001-0001-0001-0171'/ snapshots snapshot id='f09a98fd-2c7e-40eb-a9ae-6b7f86412bb0'/ /snapshots /vm \ ${url}/vms You need to modify that script with your URL, user name, password, cluster and snapshot id. 3. Display cpu,network etc usages The statistics are available in the statistics sub-resource. For example, if you want to get the statistics of a host you can do the following: #!/bin/sh -ex url=https://ovirt.example.com/ovirt-engine/api; user=admin@internal password=** curl \ --verbose \ --insecure \ --request GET \ --header Accept: application/xml \ --user ${user}:${password} \ ${url}/hosts/40cc4c33-2560-4516-b028-1d59638139c3/statistics There you will find different statistics, like memory.total, memory.used, etc. Take a look. Once you know what statistic you want you can get its details like this: curl \ --verbose \ --insecure \ --request GET \ --header Accept: application/xml \ --user ${user}:${password} \ ${url}/hosts/40cc4c33-2560-4516-b028-1d59638139c3/statistics/7816602b-c05c-3db7-a4da-3769f7ad8896 This can be cumbersome to do with a shell script, so you may want to use the Python or Java SDKs, or just use directly the ovirt-shell: $ ovirt-shell --insecure URL: https://ovirt.example.com/ovirt-engine/api Username: admin@internal Password: ** [oVirt shell (connected)]# show statistic memory.total --host-identifier myhost id: 7816602b-c05c-3db7-a4da-3769f7ad8896 name : memory.total description : Total memory host-id : 40cc4c33-2560-4516-b028-1d59638139c3 type : GAUGE unit : BYTES values-type : INTEGER values-value-datum: 2099249152 I couldn't find out any direct api method to do the above, Is it possible to do these operations using api ? If anyone knows it please help me to sort out it. -- Regards Shanil -- 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 api function
On 08/22/2014 06:35 AM, Shanil S wrote: Hi, VM rebuild means...Rebuild the VM with the same existing configuration...just erase the Vdisk and install again (like Fresh install). We want to rebuild the VM with the same existing OS template...also it will be good if user can select other OS template also for the rebuild purpose... With CD_ISO it require the manual installation...we don't want the manual installation...we looking for a way to rebuild the VM with OS templates Is there any API method to achieve this ?? The usual process to do this is the following: 1. Manually, using the GUI, you create a VM and install the OS. 2. Manually seal the VM for use as a template. The idea is to remove from the VM any configuration that may create a conflict when multiple VMs are created from the template. There are different ways to do this, depending on the OS that you are using. Here you can find some documentation: https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Virtualization/3.4/html/Administration_Guide/sect-Sealing_Templates_in_Preparation_for_Deployment.html 3. Manually shut it down and create a template from it. 4. Manually remove the VM (you can keep it, but it isn't needed). All these steps are usually done manually, as it isn't usually worth automating them, but if you wish you can also do them with the API. Once you have the template you can create multiple VMs from it, and for this you will probably use the API. For example, assuming that you know the ids of the cluster and the template: #!/bin/sh -ex url=https://ovirt.example.com/ovirt-engine/api; user=admin@internal password=** curl \ --verbose \ --insecure \ --request POST \ --header Accept: application/xml \ --header Content-Type: application/xml \ --user ${user}:${password} \ --data vm namemynewvm/name cluster id='5f840556-81de-427d-8d30-a06cdb15b7f9'/ template id='f9eb10b8-6f94-469f-a8a6-660c41b103d7'/ /vm \ ${url}/vms Or you may want to use the Python SDK: #!/usr/bin/python import ovirtsdk.api import ovirtsdk.xml api = ovirtsdk.api.API( url=https://ovirt.example.com/ovirt-engine/api;, username=admin@internal, password=**, insecure=True ) cluster = ovirtsdk.xml.params.Cluster(id=5f840556-81de-427d-8d30-a06cdb15b7f9) template = ovirtsdk.xml.params.Template(id=f9eb10b8-6f94-469f-a8a6-660c41b103d7) vm = ovirtsdk.xml.params.VM() vm.set_name(mynewvm) vm.set_cluster(cluster) vm.set_template(template) api.vms.add(vm) api.disconnect() There is also a Java SDK, if you prefer it. In this scenario you will usually want to change the host name or other properties of the new VM. That you can do with cloud-init (for Linux) or Sysprep (for Windows). That can also be automated with the api. Regarding the statitics report, is there any API method to fetch the monthly and weekly usages report ?, we are planning to create a usage chart by using these values. The RESTAPI doesn't provide this kind of accumulated statistics. I'd suggest to explore the oVirt reports DWH and reports applications: http://www.ovirt.org/Ovirt_DWH http://www.ovirt.org/Ovirt_Reports -- Regards Shanil On Fri, Aug 22, 2014 at 9:46 AM, OvirtAndKvm ov...@goproject.info mailto:ov...@goproject.info wrote: Do you mean like; attach a new OS install ISO CD to the VM, change the VM's boot order to CD first, reboot the VM and boot up on the CD and install the new OS, selecting to reformat over the old installed OS ? or am I miss understanding your question ? At Friday, 22-08-2014 on 13:58 Shanil S wrote: Hi Juan, Thanks for your replies.. Regarding the rebuild VM, Is that any method to reinstall the os on the VM without remove it or create a new one? -- Regards Shanil On Thu, Aug 21, 2014 at 4:55 PM, Juan Hernandez jhern...@redhat.com mailto:jhern...@redhat.com wrote: On 08/20/2014 12:42 PM, Shanil S wrote: Hi, I would like to create the following functions using the ovirt api 1. Rebuild VM What do you exactly mean by rebuild vm? 2. Restore the screenthots of one vm to another vm What you can do is create a new VM from an existing snapshot, something like this: #!/bin/sh -ex url=https://ovirt.example.com/ovirt-engine/api; user=admin@internal password=** curl \ --verbose \ --insecure \ --request POST \ --header Accept: application/xml \ --header Content-Type: application/xml \ --user ${user}:${password} \ --data vm namemyclone/name cluster id='0001-0001-0001-0001-0171
Re: [ovirt-users] Documentation of cloud-init
On 07/25/2014 12:59 PM, Amedeo Salvati wrote: Hy guys, after some headache I was able to use cloud-init via python-sdk (thanks to Juan), and I hope no one will fight anymore with them :D, so if you want I think it's better to document with a simple example it's use on web page available at: http://www.ovirt.org/Features/Cloud-Init_Integration below simple change that you can integrate on web page: - fix api design example of usage for files xml, on the web page you can find: ... files file name/tmp/testFile1.txt/name contenttemp content/content typePLAINTEXT/type /file /files ... but on params.File there aren't any type parameter only type_ so you can change xml with: ... files file name/tmp/testFile1.txt/name contenttemp content/content type_PLAINTEXT/type_ /file /files ... This won't be correct, the correct XML tag name is type, as in the example in the web page. It is not good idea to use this as a parmeter in python because it hides the type builtin function. That is why we renamed it to type_. - insert an example of using cloud-init via python-sdk (I hope java-sdk haven't big differences). for this you can insert on web page an example of setting via cloud-init: hostname, reset root password and write a simple text file, and finally simple python code is: ... scontent = write_files:\n- content: |\n#simple file\n PIPPO=\ciao\\npath: /etc/pippo.txt action = params.Action( vm=params.VM( initialization=params.Initialization( cloud_init=params.CloudInit( host=params.Host(address=rheltest029), users=params.Users( user=[params.User(user_name=root, password=pippolo)] ), files=params.Files( file=[params.File(name=/etc/pippo.txt, content=scontent, type_=PLAINTEXT)] ) ) ) ) ) vm.start( action ) ... I think that you can edit that page and add this Python snippet. If you don't have an account for the wiki you can request one here: http://www.ovirt.org/Special:RequestAccount And if you want you can also submit a patch for the ovirt-engine-sdk project, adding your script in the (not yet existing) examples directory. HTH Amedeo Salvati -- 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] cloud-init options under python-sdk
On 07/23/2014 02:39 PM, Amedeo Salvati wrote: hello Juan|guys, I still have problems with cloud-init options on python-sdk... now I'm trying to reset root password and according to xml available at http://www.ovirt.org/Features/Cloud-Init_Integration and specifically for user/pw: ... users user user_nameroot/user_name passwordmyPass/password /user /users ... I've changed action object with this example: action = params.Action( vm=params.VM( initialization=params.Initialization( cloud_init=params.CloudInit( host=params.Host(address=rheltest025), users=params.Users( user=params.User(user_name=root, password=pippo) Try to use a list here: user=[parms.User(...)] ) ) ) ) ) but when i try to start a vm I got this error: TypeError: 'User' object is not iterable somebody has some hints for resetting root password? Best regards Amedeo Salvati Da: Amedeo Salvati ame...@oscert.net A: jhern...@redhat.com Cc: users@ovirt.org Data: Tue, 22 Jul 2014 15:50:58 +0200 Oggetto: Re: [ovirt-users] cloud-init options under python-sdk many thanks Juan it works! best regards a Da: Juan Hernandez jhern...@redhat.com A: Amedeo Salvati ame...@oscert.net, users@ovirt.org Cc: Data: Tue, 22 Jul 2014 15:32:45 +0200 Oggetto: Re: [ovirt-users] cloud-init options under python-sdk On 07/22/2014 02:55 PM, Amedeo Salvati wrote: hi Juan|guys, thanks for hints! but unfortunatly it seems wont works, because I've launched vm with this simple code: action = params.Action(vm=params.VM(initialization=params.Initialization(cloud_init=params.CloudInit(host=params.Host(name=rheltest014) vm.start( action ) but after boot the VM, cloud-init service hasn't set hostname and on cloud-init.log and cloud-init-output.log I cannot find any entry for setting hostname, instead if I use web ui it work's fine... there are any ways to debug cloud-init jobs? the params params.Host is right for CloudInit host or is intended for host / hypervisor? Best regards Amedeo Salvati To change the hostname you have to use the address property of the Host class: host=params.Host( address=myhostname.example.com ) The Host class is used for many things, including CloudInit and hypervisors. But in this context it is just a container for the host name. To debug cloud-init start the VM (with the GUI or with the RESTAPI), then go to the hypervisor where it is actually running, and look for the corresponding qemu-kvm process: # ps -ef | grep qemu-kvm | grep myvm The qemu-kvm command line will have a parameter indicating the file that contains the cloud-init data: -drive file=/var/run/vdsm/payload/...img Copy that file somewhere, then mount it and inspect the content: # cp /var/run/vdsm/payload/...img /tmp/my.img # mount -o loop,ro /tmp/my.img /mnt # find /mnt ... # umount /mnt Da: Juan Hernandez jhern...@redhat.com A: Amedeo Salvati ame...@oscert.net, users@ovirt.org Cc: Data: Tue, 22 Jul 2014 12:21:01 +0200 Oggetto: Re: [ovirt-users] cloud-init options under python-sdk On 07/22/2014 11:48 AM, Amedeo Salvati wrote: hello guys! I'm writing some python code to start VMs, and based on operating system (at this moment centos6 nad centos7), I would like to use cloud-init options (available on web ui at run-once) to start them and resetting root password, change hostname and write some configuration files by using yaml semantics, but at this moment I was unable to find a way to do it... somebody know a way (or could send me some hints) using python-sdk to start A VM and pass to it cloud-init options? e.g. the portion of code I would like to change is vm.start() under rhel6|7: try: osVersion = vm.get_os().get_type() if (osVersion == rhel_6x64 or osVersion == rhel_6 or osVersion == rhel_7x64) and CLOUDINIT == yes: print Starting VM: + vm.name + with cloud-init options vm.start() -- else: print Starting VM + vm.name vm.start() while vmstat != 'down': sleep(1) vmstat = vm.get_status().state except Exception, err: print Error on starting VM print err Best regards Amedeo Salvati It should be something like this: from ovirtsdk.xml import params action = params.Action( vm=params.VM( initialization=params.Initialization( cloud_init=params.CloudInit( host=params.Host( name=myvm ), users=..., files
Re: [ovirt-users] cloud-init options under python-sdk
On 07/22/2014 11:48 AM, Amedeo Salvati wrote: hello guys! I'm writing some python code to start VMs, and based on operating system (at this moment centos6 nad centos7), I would like to use cloud-init options (available on web ui at run-once) to start them and resetting root password, change hostname and write some configuration files by using yaml semantics, but at this moment I was unable to find a way to do it... somebody know a way (or could send me some hints) using python-sdk to start A VM and pass to it cloud-init options? e.g. the portion of code I would like to change is vm.start() under rhel6|7: try: osVersion = vm.get_os().get_type() if (osVersion == rhel_6x64 or osVersion == rhel_6 or osVersion == rhel_7x64) and CLOUDINIT == yes: print Starting VM: + vm.name + with cloud-init options vm.start() -- else: print Starting VM + vm.name vm.start() while vmstat != 'down': sleep(1) vmstat = vm.get_status().state except Exception, err: print Error on starting VM print err Best regards Amedeo Salvati It should be something like this: from ovirtsdk.xml import params action = params.Action( vm=params.VM( initialization=params.Initialization( cloud_init=params.CloudInit( host=params.Host( name=myvm ), users=..., files=..., ... ) ) ) ) vm.start(action) -- 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
On 07/10/2014 04:07 PM, Steve Kilduff wrote: Hi All, Trying to add a nic to a vm with a specific mac address. [oVirt shell (connected)]# add nic --vm-identifier ov31 --network-name backend --name eth4 --mac-address HH:HH:EE:HH:HH:01 ERROR = status: 400 reason: Bad Request detail: MAC address must be in format HH:HH:HH:HH:HH:HH where H is a hexadecimal character (either a digit or A-F, case is insignificant). = Also interesting is when I change the beginning of the mac address to 00 instead of HH, I get : [oVirt shell (connected)]# add nic --vm-identifier ov31 --network-name backend --name eth4 --mac-address 01:HH:EE:HH:HH:01 ERROR == wrong number of arguments, try 'help add' for help. = I have tried some things like enclosing in single and double quotes but no success. I have also tried to read the help sections on the shell interface but I also could not figure it out. Thanks in advance, There are two issues here. One is that currently the CLI doesn't work correctly with parameters that start with a number, as the lexer splits it into a number and a word, and then it thinks that there are two parameters instead of one. We have a bug (a RHEV bug, it it affects oVirt as well) for that already: https://bugzilla.redhat.com/show_bug.cgi?id=1110366 You can workaround this using quotes, either simple or double. The other issue is that you are probably a *multicast* MAC address. That is what the server is actually checking, not just that it is syntactically correct. This basically means that the eight bit can't be 1, as that is what indicates multicast. Just make sure that you use a MAC address whose second character isn't an odd number. For example, this will fail: # add nic --vm-identifier ov31 --network-name backend --name eth4 --mac-address '01:01:01:01:01:01' But this will succeed: # add nic --vm-identifier ov31 --network-name backend --name eth4 --mac-address '00:01:01:01:01:01' The error message could be better. You may want to open a bug requesting an improvement. -- 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
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_Virtualization/3.3/html/Developer_Guide/index.html https://access.redhat.com/site/documentation/en-US/Red_Hat_Enterprise_Virtualization/3.3/html/Command_Line_Shell_Guide/index.html 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_Virtualization/3.4/html/Technical_Guide/part-The_REST_Application_Programming_Interface.html https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Virtualization/3.4/html/Technical_Guide/part-The_Command_Line_Interface.html 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. ___ Users mailing list Users@ovirt.org http://lists.ovirt.org/mailman/listinfo/users
Re: [ovirt-users] ovirt-shell
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_Virtualization/3.3/html/Developer_Guide/index.html https://access.redhat.com/site/documentation/en-US/Red_Hat_Enterprise_Virtualization/3.3/html/Command_Line_Shell_Guide/index.html 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_Virtualization/3.4/html/Technical_Guide/part-The_REST_Application_Programming_Interface.html https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Virtualization/3.4/html/Technical_Guide/part-The_Command_Line_Interface.html 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. ___ Users mailing list Users@ovirt.org http://lists.ovirt.org/mailman/listinfo/users
Re: [ovirt-users] Ovirt Python library is getting error
On 07/02/2014 10:37 AM, Shahar Havivi wrote: On 02.07.14 10:18, Shanil S wrote: Hi Shahar, Hi, I just tested your code and it works fine for me. You can try first to put the url in a web browser and you will be prompt for username and password. Try that first and see if all the parameters are set correctly. Also adding Juan maybe he have other idea. Shahar. Most probably you need to use HTTPS: api = API('https://ip:443/api', 'usernamel','password') Note that the protocol is https, not http. Also, if you still have problems, try to put the SDK in debug mode, so we can see what is the actual exchange of data with the server: api = API('https://ip:443/api', 'usernamel','password', debug=True) I have downloaded the ovirt Python library from http://www.ovirt.org/Python-sdk and trying to list out the vms but i am getting the following error --- File build/bdist.linux-x86_64/egg/ovirtsdk/api.py, line 145, in __init__ File build/bdist.linux-x86_64/egg/ovirtsdk/infrastructure/proxy.py, line 118, in request File build/bdist.linux-x86_64/egg/ovirtsdk/infrastructure/proxy.py, line 144, in __doRequest File build/bdist.linux-x86_64/egg/ovirtsdk/infrastructure/proxy.py, line 157, in __xml2py ovirtsdk.infrastructure.errors.FormatError: [ERROR]::Server reply is in inappropriate format. -- The following code is used for displaying the vms api = API('http://ip:443/api', 'usernamel','password') vms1 = api.vms.list() print vms1 Could you please check it if any issues with it ? Also is it necessary to give secure connection ? -- 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] Issues in IP Assigning using API
On 07/02/2014 11:36 AM, Shanil S wrote: Hi Shahar, Okay.. So, what we have to do for this ? will it not work ? -- Regards Shanil Currently the bug is targeted for 3.5.0, so it won't be fixed for you till we release 3.5.0 and you upgrade. Do you need the fix in a previous version? Which one? On Wed, Jul 2, 2014 at 3:03 PM, Shahar Havivi shah...@redhat.com mailto:shah...@redhat.com wrote: Hi Shanil, There is a bug for this issue: https://bugzilla.redhat.com/show_bug.cgi?id=1115389 The patch is already merged upstream. Shahar. On 02.07.14 14:47, Shanil S wrote: Hi Shahar, Okay.. Thanks.. -- Regards Shanil On Wed, Jul 2, 2014 at 2:42 PM, Shanil S xielessha...@gmail.com mailto:xielessha...@gmail.com wrote: Hi Sven, I used the xml like this to assign IP, http://www.ovirt.org/Features/Cloud-Init_Integration. Also, could you please give me the json data which you given for assigning the IP ? -- Regards Shanil On Wed, Jul 2, 2014 at 2:36 PM, Sven Kieske s.kie...@mittwald.de mailto:s.kie...@mittwald.de wrote: Well that would be of interest to me too, as I'm currently successfully assigning IPs via rest, but through json instead of xml. what would be that error? Please share the BZ URL. Am 02.07.2014 09:54, schrieb Shahar Havivi: Yes, Please send the content of the file that is under the content/ directory. I think I found a bug in the REST API to configure network address - I just want to confirm. This is not effect the UI and I will post a patch shortly... Shahar. -- 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 ___ Users mailing list Users@ovirt.org http://lists.ovirt.org/mailman/listinfo/users -- 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] Issues in IP Assigning using API
On 07/02/2014 11:45 AM, Shanil S wrote: Hi Shahar, We are using the version 3.4.2, Is it possible to fix it in this version ? or could you please tell me the expected release of the 3.5.0 version ? -- Regards Shanil Currently 3.5 is scheduled for release on 2014-08-04, see here for details on the calendar: http://www.ovirt.org/OVirt_3.5_release-management And the calendar here: https://www.google.com/calendar/embed?src=ppqtk46u9cglj7l987ruo2l0f8%40group.calendar.google.comctz=UTC The fix could also be backported to 3.4.3, which is scheduled for release on 2014-07-17. Let us know if you consider it important enough to be included in that version. Alternatively, if it is extremely urgent for you, you can backport, build and patch your installation yourself. In this case it isn't very complicated: $ git clone git://gerrit.ovirt.org/ovirt-engine $ cd ovirt-engine $ git cherry-pick -x 42efda3be3c36e0785d114269bcc2b3660c4a138 $ mvn clean install -DskipTests This will take a long time, specially the first time. The result will include the following file: backend/manager/modules/restapi/types/target/restapi-types-3.4.2.jar Take that file and copy it to /usr/share/java/ovirt-engine/restapi-types.jar (after making a backup of the original, then restart the engine. On Wed, Jul 2, 2014 at 3:09 PM, Juan Hernandez jhern...@redhat.com mailto:jhern...@redhat.com wrote: On 07/02/2014 11:36 AM, Shanil S wrote: Hi Shahar, Okay.. So, what we have to do for this ? will it not work ? -- Regards Shanil Currently the bug is targeted for 3.5.0, so it won't be fixed for you till we release 3.5.0 and you upgrade. Do you need the fix in a previous version? Which one? On Wed, Jul 2, 2014 at 3:03 PM, Shahar Havivi shah...@redhat.com mailto:shah...@redhat.com mailto:shah...@redhat.com mailto:shah...@redhat.com wrote: Hi Shanil, There is a bug for this issue: https://bugzilla.redhat.com/show_bug.cgi?id=1115389 The patch is already merged upstream. Shahar. On 02.07.14 14:47, Shanil S wrote: Hi Shahar, Okay.. Thanks.. -- Regards Shanil On Wed, Jul 2, 2014 at 2:42 PM, Shanil S xielessha...@gmail.com mailto:xielessha...@gmail.com mailto:xielessha...@gmail.com mailto:xielessha...@gmail.com wrote: Hi Sven, I used the xml like this to assign IP, http://www.ovirt.org/Features/Cloud-Init_Integration. Also, could you please give me the json data which you given for assigning the IP ? -- Regards Shanil On Wed, Jul 2, 2014 at 2:36 PM, Sven Kieske s.kie...@mittwald.de mailto:s.kie...@mittwald.de mailto:s.kie...@mittwald.de mailto:s.kie...@mittwald.de wrote: Well that would be of interest to me too, as I'm currently successfully assigning IPs via rest, but through json instead of xml. what would be that error? Please share the BZ URL. Am 02.07.2014 09:54, schrieb Shahar Havivi: Yes, Please send the content of the file that is under the content/ directory. I think I found a bug in the REST API to configure network address - I just want to confirm. This is not effect the UI and I will post a patch shortly... Shahar. -- 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 -- 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] Issues in IP Assigning using API
On 07/02/2014 01:11 PM, Shanil S wrote: Hi Juan, If it is possible to include in 3.4.3 could please add it ? -- Regards Shanil Ok, I'm backporting it, I think it will be included. On Wed, Jul 2, 2014 at 4:17 PM, Juan Hernandez jhern...@redhat.com mailto:jhern...@redhat.com wrote: On 07/02/2014 12:43 PM, Shanil S wrote: Hi Juan, Okay.. Thanks for the info. We are waiting for the new updates and i hope we can update it to the 3.4.3 on 17 July. Thank you very much for your help in this issue. :) Note that currently this fix is *not* planned to be included in 3.4.3. Do you need it there? Or can you wait for 3.5.0? On Wed, Jul 2, 2014 at 3:39 PM, Juan Hernandez jhern...@redhat.com mailto:jhern...@redhat.com mailto:jhern...@redhat.com mailto:jhern...@redhat.com wrote: On 07/02/2014 11:45 AM, Shanil S wrote: Hi Shahar, We are using the version 3.4.2, Is it possible to fix it in this version ? or could you please tell me the expected release of the 3.5.0 version ? -- Regards Shanil Currently 3.5 is scheduled for release on 2014-08-04, see here for details on the calendar: http://www.ovirt.org/OVirt_3.5_release-management And the calendar here: https://www.google.com/calendar/embed?src=ppqtk46u9cglj7l987ruo2l0f8%40group.calendar.google.comctz=UTC The fix could also be backported to 3.4.3, which is scheduled for release on 2014-07-17. Let us know if you consider it important enough to be included in that version. Alternatively, if it is extremely urgent for you, you can backport, build and patch your installation yourself. In this case it isn't very complicated: $ git clone git://gerrit.ovirt.org/ovirt-engine http://gerrit.ovirt.org/ovirt-engine http://gerrit.ovirt.org/ovirt-engine $ cd ovirt-engine $ git cherry-pick -x 42efda3be3c36e0785d114269bcc2b3660c4a138 $ mvn clean install -DskipTests This will take a long time, specially the first time. The result will include the following file: backend/manager/modules/restapi/types/target/restapi-types-3.4.2.jar Take that file and copy it to /usr/share/java/ovirt-engine/restapi-types.jar (after making a backup of the original, then restart the engine. On Wed, Jul 2, 2014 at 3:09 PM, Juan Hernandez jhern...@redhat.com mailto:jhern...@redhat.com mailto:jhern...@redhat.com mailto:jhern...@redhat.com mailto:jhern...@redhat.com mailto:jhern...@redhat.com mailto:jhern...@redhat.com mailto:jhern...@redhat.com wrote: On 07/02/2014 11:36 AM, Shanil S wrote: Hi Shahar, Okay.. So, what we have to do for this ? will it not work ? -- Regards Shanil Currently the bug is targeted for 3.5.0, so it won't be fixed for you till we release 3.5.0 and you upgrade. Do you need the fix in a previous version? Which one? On Wed, Jul 2, 2014 at 3:03 PM, Shahar Havivi shah...@redhat.com mailto:shah...@redhat.com mailto:shah...@redhat.com mailto:shah...@redhat.com mailto:shah...@redhat.com mailto:shah...@redhat.com mailto:shah...@redhat.com mailto:shah...@redhat.com mailto:shah...@redhat.com mailto:shah...@redhat.com mailto:shah...@redhat.com mailto:shah...@redhat.com mailto:shah...@redhat.com mailto:shah...@redhat.com mailto:shah...@redhat.com mailto:shah...@redhat.com wrote: Hi Shanil, There is a bug for this issue: https://bugzilla.redhat.com/show_bug.cgi?id=1115389 The patch is already merged upstream. Shahar. On 02.07.14 14:47, Shanil S wrote: Hi Shahar, Okay.. Thanks.. -- Regards Shanil On Wed, Jul 2, 2014 at 2:42 PM, Shanil S xielessha...@gmail.com mailto:xielessha...@gmail.com mailto:xielessha...@gmail.com mailto:xielessha...@gmail.com mailto:xielessha
Re: [ovirt-users] python-sdk: attach disk snapshot to another virtual machine
On 06/13/2014 10:43 AM, Michael Ablassmeier wrote: hi guys, according to an commit in Oct. 2013 there was a patch added to the SDK which allows to attach an existing snapshot to a virtual machine: commit 72e67dd5406f3c193234697ce88d92dbe64759d7 Author: Michael pasternak mpast...@redhat.com Date: Wed Oct 30 11:24:19 2013 +0200 sdk: regenerate against the latest api [..] - added ability to attach a disk snapshot to the virtual machine [..] I think this may be related to the new backup API: http://www.ovirt.org/Features/Backup-Restore_API_Integration can anyone give me an pointer on how to this through the python-sdk? Or is there an example for this anywhere to be found? Thanks! It should be something like this: #!/usr/bin/python import ovirtsdk.api import ovirtsdk.xml api = ovirtsdk.api.API( url=https://fedora.example.com/ovirt-engine/api;, username=admin@internal, password=, insecure=True, debug=False ) # Find the snapshot that contains the disk that we want to backup: vm = api.vms.get(myvm) snaps = vm.snapshots.list() snap = None for current in snaps: if current.get_description() == mysnap: snap = current # Find the disk that we want to backup: disks = snap.disks.list() disk = None for current in disks: if current.get_name() == mydisk: disk = current # Find the backup appliance VM: appliance = api.vms.get(backupvm) # Attach the disk to the backup appliance: appliance.disks.add(disk) # Tell the backup appliance to perform the backup, connecting # with SSH, or with any other way that the backup appliance # supports. # Bye: api.disconnect() With a similar script you can also disconnect the disk from the backup appliance. -- 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 Python SDK adding a directlun
On 05/08/2014 11:37 PM, Gary Lloyd wrote: When I add direct Luns this way the size shows as 1 on the GUI and 0 when called from the rest api. All the other items mentioned are not present. Thanks Ah, I understand. This is probably related to the fact that you aren't creating a storage domain, only the storage connection. This should work correctly, but I guess that either the GUI or the backend aren't completely prepared for this. I'm checking. On 8 May 2014, at 18:05, Juan Hernandez jhern...@redhat.com wrote: On 05/08/2014 05:04 PM, Gary Lloyd wrote: We are working on a script so that we can create an ISCSI LUN on our SAN and then directly assign it to a vm. We have been able to get it to work but with one small annoyance. I can't figure out how to populate size,serial,vendor_id and product_id via the api. Would anyone be able to point me in the right direction ? code (see def add_disk): def get_clusterid(cluster_name): cluster = ovirt_api.clusters.get(cluster_name) try: return cluster.id http://cluster.id except: logging.error('the cluster: %s does not appear to exist' % cluster_name ) sys.exit(1) def nominate_host(cluster_id): for host in ovirt_api.hosts.list(): if host.cluster.id http://host.cluster.id == cluster_id and host.status.state == 'up': host.iscsidiscover return host logging.error('could not find a suitable host to nominate in cluster:') sys.exit(1) def iscsi_discover_and_login(cluster,target,portal,chap_user,chap_pass): clusterid=get_clusterid(cluster) host=nominate_host(clusterid) iscsidet = params.IscsiDetails() iscsidet.address=portal iscsidet.username=chap_user iscsidet.password=chap_pass iscsidet.target=target host.iscsidiscover(params.Action(iscsi=iscsidet)) result = host.iscsilogin(params.Action(iscsi=iscsidet)) if result.status.state == 'complete': storecon = params.StorageConnection() storecon.address=portal storecon.type_='iscsi' storecon.port=3260 storecon.target=target storecon.username=chap_user storecon.password=chap_pass ovirt_api.storageconnections.add(storecon) return result # error checking code needs to be added to this function def add_disk(vm_name,wwid,target,size,portal): logunit = params.LogicalUnit() logunit.id http://logunit.id=wwid logunit.vendor_id='EQLOGIC' logunit.product_id='100E-00' logunit.port=3260 logunit.lun_mapping=0 logunit.address=portal logunit.target=target logunit.size=size * 1073741824 stor = params.Storage(logical_unit=[logunit]) stor.type_='iscsi' disk = params.Disk() disk.alias = 'vm-' + vm_name disk.name http://disk.name = disk.alias disk.interface = 'virtio' disk.bootable = True disk.type_ = 'iscsi' disk.format='raw' disk.set_size(size * 1073741824) #disk.size=size * 1073741824 #disk.active=True disk.lun_storage=stor try: result = ovirt_api.disks.add(disk) except: logging.error('Could not add disk') sys.exit(1) attachdisk=ovirt_api.disks.get(disk.alias) attachdisk.active = True try: ovirt_api.vms.get(vm_name).disks.add(attachdisk) except: logging.error('Could attach disk to vm') sys.exit(1) return result If we could just get the size to show correctly that would be enough, the others don't really matter to me. Thanks /Gary Lloyd/ For a direct LUN disk all these values are ready only. Why do you need to change them? -- 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 -- 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 Python SDK adding a directlun
On 05/09/2014 10:31 AM, Juan Hernandez wrote: On 05/08/2014 11:37 PM, Gary Lloyd wrote: When I add direct Luns this way the size shows as 1 on the GUI and 0 when called from the rest api. All the other items mentioned are not present. Thanks Ah, I understand. This is probably related to the fact that you aren't creating a storage domain, only the storage connection. This should work correctly, but I guess that either the GUI or the backend aren't completely prepared for this. I'm checking. I think this is a bug, and I didn't find any way to workaround it other than creating the LUN using the GUI instead of the RESTAPI. I opened the following BZ to track it: https://bugzilla.redhat.com/1096217 On 8 May 2014, at 18:05, Juan Hernandez jhern...@redhat.com wrote: On 05/08/2014 05:04 PM, Gary Lloyd wrote: We are working on a script so that we can create an ISCSI LUN on our SAN and then directly assign it to a vm. We have been able to get it to work but with one small annoyance. I can't figure out how to populate size,serial,vendor_id and product_id via the api. Would anyone be able to point me in the right direction ? code (see def add_disk): def get_clusterid(cluster_name): cluster = ovirt_api.clusters.get(cluster_name) try: return cluster.id http://cluster.id except: logging.error('the cluster: %s does not appear to exist' % cluster_name ) sys.exit(1) def nominate_host(cluster_id): for host in ovirt_api.hosts.list(): if host.cluster.id http://host.cluster.id == cluster_id and host.status.state == 'up': host.iscsidiscover return host logging.error('could not find a suitable host to nominate in cluster:') sys.exit(1) def iscsi_discover_and_login(cluster,target,portal,chap_user,chap_pass): clusterid=get_clusterid(cluster) host=nominate_host(clusterid) iscsidet = params.IscsiDetails() iscsidet.address=portal iscsidet.username=chap_user iscsidet.password=chap_pass iscsidet.target=target host.iscsidiscover(params.Action(iscsi=iscsidet)) result = host.iscsilogin(params.Action(iscsi=iscsidet)) if result.status.state == 'complete': storecon = params.StorageConnection() storecon.address=portal storecon.type_='iscsi' storecon.port=3260 storecon.target=target storecon.username=chap_user storecon.password=chap_pass ovirt_api.storageconnections.add(storecon) return result # error checking code needs to be added to this function def add_disk(vm_name,wwid,target,size,portal): logunit = params.LogicalUnit() logunit.id http://logunit.id=wwid logunit.vendor_id='EQLOGIC' logunit.product_id='100E-00' logunit.port=3260 logunit.lun_mapping=0 logunit.address=portal logunit.target=target logunit.size=size * 1073741824 stor = params.Storage(logical_unit=[logunit]) stor.type_='iscsi' disk = params.Disk() disk.alias = 'vm-' + vm_name disk.name http://disk.name = disk.alias disk.interface = 'virtio' disk.bootable = True disk.type_ = 'iscsi' disk.format='raw' disk.set_size(size * 1073741824) #disk.size=size * 1073741824 #disk.active=True disk.lun_storage=stor try: result = ovirt_api.disks.add(disk) except: logging.error('Could not add disk') sys.exit(1) attachdisk=ovirt_api.disks.get(disk.alias) attachdisk.active = True try: ovirt_api.vms.get(vm_name).disks.add(attachdisk) except: logging.error('Could attach disk to vm') sys.exit(1) return result If we could just get the size to show correctly that would be enough, the others don't really matter to me. Thanks /Gary Lloyd/ For a direct LUN disk all these values are ready only. Why do you need to change them? -- 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 -- 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] Attaching storage to VM via JSON REST
On 05/08/2014 08:30 AM, Gadi Ickowicz wrote: I have no experience using JSON myself (I use XML when using REST), however, note that the storage_domain is a list of ids, inside of a storage_domains object. Maybe try to send a request formatted like that? Juan - any other insights? Gadi Ickowicz When adding a disk to a VM both a single domain storage and a list of storage domains are accepted. The JSON representation is the following: storage_domain: { id: 6fbee79d-5b71-48c1-b86c-ee9755a46013 } Note that name isn't accepted here, you have to use the id. The JSON representation for multiple domains is the following (note that only the first one is used): storage_domains: { storage_domain: [ { name: am_data } ] } Note that id isn't accepted here, you have to use name. - Original Message - From: Andrew Morrison andy.wmorri...@gmail.com To: users@ovirt.org Sent: Wednesday, May 7, 2014 11:23:13 PM Subject: [ovirt-users] Attaching storage to VM via JSON REST Hi all, I'm exploring using ovirt's REST APIs to manage VM creation/deletion/etc. I can create the VM, attach an ISO and change boot order, but I'm unable to attach a storage disk to the VM. I send a POST request to /api/vms/vm uuid/disks with the structure: {storage_domain: {name:am_data, id:6fbee79d-5b71-48c1-b86c-ee9755a46013 }, size:4294967296, type:system, interface:ide, format:raw, sparse:false, bootable:true, wipe_after_delete:false } The response I receive is { reason : Operation Failed, detail : [Cannot add Virtual Machine Disk. Storage Domain doesn't exist.] } For the storage domain, I've tried just the name, just the id, and both with the same results. When I attach storage from the GUI, the disk is created/attached fine, and a GET request for the disks of the VM shows the storage domain as the same as I was attempting to use before. storage_domains : { storage_domain : [ { id : 6fbee79d-5b71-48c1-b86c-ee9755a46013 } ] }, Any idea what I might be doing wrong? Thanks, Andrew The problem with the JSON document that you are sending is that you are using strings to represent numeric and boolean values. That generates an exception inside the engine. Try the following: { storage_domain: { id: 6fbee79d-5b71-48c1-b86c-ee9755a46013 }, size: 4294967296, type: system, interface: ide, format: raw, sparse: false, bootable: true, wipe_after_delete: false } Note that size is an integer, no quotes allowed. Same for sparse, bootable and wipe_after_delete, they are booleans, no quotes allowed. The long exception message that you get when sending an incorrect JSON document is a bug in the error reporting path, it will be fixed in version 3.4.1: https://bugzilla.redhat.com/show_bug.cgi?id=1093755 -- 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] Attaching storage to VM via JSON REST
On 05/08/2014 12:59 PM, Sven Kieske wrote: May I ask if there is any reason why this is so inconsistent? (id vs name) I guess it is for historical reasons. We should probably accept both id and name in both cases, giving precedence to id if both are given. Care to open a RFE requesting so? Am 08.05.2014 11:34, schrieb Juan Hernandez: When adding a disk to a VM both a single domain storage and a list of storage domains are accepted. The JSON representation is the following: storage_domain: { id: 6fbee79d-5b71-48c1-b86c-ee9755a46013 } Note that name isn't accepted here, you have to use the id. The JSON representation for multiple domains is the following (note that only the first one is used): storage_domains: { storage_domain: [ { name: am_data } ] } Note that id isn't accepted here, you have to use name. -- 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] Reg: Could not able to collect VCPU details for VMs
On 05/08/2014 04:48 PM, Rathidevi wrote: Hi Users, I am using *ovirt* package for RHEV development. I can able collect the ipaddress, os, status and name of the virtual machines. But i want the CPU details of all VMs. I tried this below method but i stil can not get cpu informations. I hope this can understand. Please help to resolve this issue. CPU cs = vm.getCpu(); CpuTune tune = cs.getCpuTune(); ListVCpuPin ms = tune.getVCpuPin(); for(int vc=0; vcms.size(); vc++) { VCpuPin pin = (VCpuPin)ms.get(vc); pin.getVcpu(); } Note: getVcpu does not giving any output. Thanks Regards, Rathidevi What kind of information about the CPUs are you trying to find exactly? -- 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 Python SDK adding a directlun
On 05/08/2014 05:04 PM, Gary Lloyd wrote: We are working on a script so that we can create an ISCSI LUN on our SAN and then directly assign it to a vm. We have been able to get it to work but with one small annoyance. I can't figure out how to populate size,serial,vendor_id and product_id via the api. Would anyone be able to point me in the right direction ? code (see def add_disk): def get_clusterid(cluster_name): cluster = ovirt_api.clusters.get(cluster_name) try: return cluster.id http://cluster.id except: logging.error('the cluster: %s does not appear to exist' % cluster_name ) sys.exit(1) def nominate_host(cluster_id): for host in ovirt_api.hosts.list(): if host.cluster.id http://host.cluster.id == cluster_id and host.status.state == 'up': host.iscsidiscover return host logging.error('could not find a suitable host to nominate in cluster:') sys.exit(1) def iscsi_discover_and_login(cluster,target,portal,chap_user,chap_pass): clusterid=get_clusterid(cluster) host=nominate_host(clusterid) iscsidet = params.IscsiDetails() iscsidet.address=portal iscsidet.username=chap_user iscsidet.password=chap_pass iscsidet.target=target host.iscsidiscover(params.Action(iscsi=iscsidet)) result = host.iscsilogin(params.Action(iscsi=iscsidet)) if result.status.state == 'complete': storecon = params.StorageConnection() storecon.address=portal storecon.type_='iscsi' storecon.port=3260 storecon.target=target storecon.username=chap_user storecon.password=chap_pass ovirt_api.storageconnections.add(storecon) return result # error checking code needs to be added to this function def add_disk(vm_name,wwid,target,size,portal): logunit = params.LogicalUnit() logunit.id http://logunit.id=wwid logunit.vendor_id='EQLOGIC' logunit.product_id='100E-00' logunit.port=3260 logunit.lun_mapping=0 logunit.address=portal logunit.target=target logunit.size=size * 1073741824 stor = params.Storage(logical_unit=[logunit]) stor.type_='iscsi' disk = params.Disk() disk.alias = 'vm-' + vm_name disk.name http://disk.name = disk.alias disk.interface = 'virtio' disk.bootable = True disk.type_ = 'iscsi' disk.format='raw' disk.set_size(size * 1073741824) #disk.size=size * 1073741824 #disk.active=True disk.lun_storage=stor try: result = ovirt_api.disks.add(disk) except: logging.error('Could not add disk') sys.exit(1) attachdisk=ovirt_api.disks.get(disk.alias) attachdisk.active = True try: ovirt_api.vms.get(vm_name).disks.add(attachdisk) except: logging.error('Could attach disk to vm') sys.exit(1) return result If we could just get the size to show correctly that would be enough, the others don't really matter to me. Thanks /Gary Lloyd/ For a direct LUN disk all these values are ready only. Why do you need to change them? -- 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] Problem to spice connect without portal
On 05/02/2014 10:15 AM, Jean-Pierre WEISS wrote: Hi, I've tried to follow the procedure How to Connect to SPICE Console Without Portal (http://www.ovirt.org/How_to_Connect_to_SPICE_Console_Without_Portal) on a Fedora 20 client. I can get into the ovirt-shell : - ovirt-shell -c -A ./vmvdiserv2.pem -l https://vmvdiserv2.domain.local/ovirt-engine/api; -u admin@internal But when I tried to launch the console (console w7-test-2), I got this message : - Spice viewer was not found, please install spice first So I think I miss something but what ? I've installed virt-viewer and spice-xpi (the console works well via portal) The problem is that the console support in the ovirt-shell is based on the spicec command. This command existed in previous versions of Fedora, but has been replaced by virt-viewer, and we don't have support for that yet. There are two things that you can do to make this work: 1. Change the type of the display of the VM to VNC. The user experience won't be as good as with Spice, but you will be able to use it with ovirt-shell. 2. Use a custom Python script to launch virt-viewer. You can find an example of that attached to the following mail message: http://lists.ovirt.org/pipermail/users/2014-February/021638.html http://lists.ovirt.org/pipermail/users/attachments/20140220/91796ca0/attachment.py Here are the installed packages on my client : spice-glib.i6860.23-2.fc20 @updates spice-gtk3.i6860.23-2.fc20 @updates spice-protocol.noarch 0.12.6-2.fc20 @fedora spice-server.i686 0.12.4-3.fc20 @anaconda spice-vdagent.i686 0.15.0-1.fc20 @updates spice-xpi.i686 2.8.90-1.fc20 @fedora ovirt-engine-cli.noarch3.4.0.5-1.fc20 @updates ovirt-engine-sdk-python.noarch 3.4.0.7-1.fc20 @updates virt-viewer.i686 0.6.0-1.fc20 @updates Thanks, Jean-Pierre WEISS -- 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] REST-API connection limit / SSL read timeout?
On 04/28/2014 02:01 PM, René Koch wrote: Hi list, I use Perl (LWP::UserAgent, HTTP:::Request) to connect to oVirt REST-API and fetch data with my Nagios plugin. 2 users complained now that my plugin stops working for their monitoring user (IPA backend). It worked fine with their monitoring@ipa user a few weeks and suddenly it stopped working. If using another user (another IPA user or admin@internal) it's fine. There isn't any explicit per user limit in the RESTAPI: all users are created equal from the RESTAPI point of view. However, there are differences from the backend point of view, specially from @internal users and any other users. The main difference is that login of a user from a domain other than @internal requires a request to the LDAP server, which requires a connection and a network round-trip. There may be issues with that, specially if the LDAP server is slow. If a request to the LDAP server blocks, the backend will block waiting for the response, the RESTAPI will block waiting for the backend, and finally the webserver will block waiting for the application server response. I would suggest to analyze the backend logs looking for errors related to connections to the LDAP servers. Here's the response from oVirt engine (JBoss) for this user: * Header: Content-Type: text/plain Client-Date: Mon, 21 Apr 2014 14:19:31 GMT Client-Warning: Internal response * Content (the default timeout is 15 seconds): 500 SSL read timeout: User permissions are fine, btw. Does anyone know if there's a connection limit to REST-API on a user base? Or can anyone give me a hint how to troubleshoot this issue (I can't reproduce this behavior in my environment btw). Thanks a lot, René On 04/09/2014 11:48 AM, Dotan Paz wrote: Dotan Paz , Engineering Operations Red Hat Israel, LTD - Original Message - On 04/09/2014 09:55 AM, Dotan Paz wrote: Dotan Paz , Engineering Operations Red Hat Israel, LTD - Original Message - On 04/07/2014 07:49 PM, René Koch wrote: Hi Juan, On 04/07/2014 07:27 PM, Juan Hernandez wrote: Hello, We are having some trouble with the Nagios plugin for oVirt. From time to time it stops working and it isn't able to connect to the engine. The error that we get apparently indicates a failure to read the file where the session cookie is stored: RHEV CRITICAL: Can't connect to RHEVM-API. Unsuccessful stat on filename containing newline at /usr/lib/nagios/plugins/check_rhev3 line 1411. Any suggestion on how to diagnose/solve this issue? Can you tell me which version of check_rhev3 you're using? Hi Rene, Name:check_rhev3 Version: 1.2.1 Created: 2012-08-13 Hi Daton, Can you please try check_rhev3 1.3? https://github.com/ovido/check_rhev3/releases Sure , I'll keep you posted . Thanks, René Regards, Dotan, can you answer this question? -- 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] Disable auth basic in API
On 04/11/2014 11:28 PM, Jose Manuel Marquez Alhambra wrote: Hi, I’m testing a connection broker that uses oVirt's API. At the moment, the connection broker doesn’t work because it doesn’t send the basic authentication to oVirt's API. I contacted the developers and they're investigating the error. While they solve the error, I would like to continue testing the connection broker. Is there any way to disable auth basic in oVirt's API? I’m using it in a testing environment (oVirt 3.4 at CentOS 6), so I’m not worried about security risks. Thank you. Regards, Jose Disabling authentication is very bad practice, but if you really need to you can use the web server configuration to automatically add the required Authorization header: 1. Compute the basic authentication token from your user name and password. For example, if your password if your user is admin@internal and your possword is abcdefg: # echo -n admin@internal:abcdefg | base64 YWRtaW5AaW50ZXJuYWw6YWJjZGVmZw== 2. Use the mod_headers module to append the authorization header to all the requests directed to the RESTAPI, creating a file disable-restapi-auth.conf in the /etc/httpd/conf.d directory, with the following content: Location /ovirt-engine/api RequestHeader set Authorization Basic YWRtaW5AaW50ZXJuYWw6YWJjZGVmZw== /Location Make sure that this file is readable only by root, as it contains your password: # chmod u=r,g=,o= /etc/httpd/conf.d/disable-restapi-auth.conf 3. Restart the web server: # service httpd restart To make this a little bit more secure I would suggest to allow this unauthenticated access available only to certain client IP addresses. For example: Location /ovirt-engine/api SetEnvIf Remote_Addr 192\.168\.122\.1 Disable_Auth RequestHeader set Authorization Basic YWRtaW5AaW50ZXJuYWw6cmVkaGF0MTIz env=Disable_Auth /Location As I said this is a very bad setting from a security point of view, so remember to revert it as soon as the broker developers fix the error. -- 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: [Users] CLI Command
On 04/07/2014 03:52 PM, Michal Skrivanek wrote: On Mar 31, 2014, at 15:11 , Maurice James midnightst...@msn.com wrote: what is the command to change the console protocol from vnc to spice via the shell? you need to edit the VM and change it's display, pretty much the same way as any other VM property Should be like this: update vm myvm --display-type spice -- 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: [Users] Failure to connect to engine with Nagios
On 04/07/2014 07:49 PM, René Koch wrote: Hi Juan, On 04/07/2014 07:27 PM, Juan Hernandez wrote: Hello, We are having some trouble with the Nagios plugin for oVirt. From time to time it stops working and it isn't able to connect to the engine. The error that we get apparently indicates a failure to read the file where the session cookie is stored: RHEV CRITICAL: Can't connect to RHEVM-API. Unsuccessful stat on filename containing newline at /usr/lib/nagios/plugins/check_rhev3 line 1411. Any suggestion on how to diagnose/solve this issue? Can you tell me which version of check_rhev3 you're using? Regards, Dotan, can you answer this question? -- 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: [Users] run once via ovirt-shell 3.3?
On 03/24/2014 05:40 PM, Sven Kieske wrote: thanks for pointing me in the right direction! Bonusquestion: Is it possible to use shell variables or to pipe them somehow for script usage? What I found in the wiki seems not to work ( ${VAR} )? It isn't possible to use shell variables from within ovirt-shell propmpt, but you can pass a command to it: # VAR=myvm # ovirt-shell --execute-command show vm ${VAR} Or you can use here documents: # VAR=myvm # ovirt-shell . show vm ${VAR} . -- 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: [Users] run once via ovirt-shell 3.3?
On 03/24/2014 11:18 AM, Sven Kieske wrote: Hi, I'm just trying to figure out how to use run-once via shell.. [oVirt shell (connected)]# action vm vm_name start --run-once does not work, and there is no help for action vm start.. Does anybody have an idea on how to use run once via shell and how to pass cloud-init data over it? If you type action vm vm_name start and then hit tab twice it should display the available command line options. In your case you are interested in the initialization-cloud_init options: [oVirt shell (connected)]# action vm vm_name start TABTAB ... vm-initialization-cloud_init-authorized_keys-authorized_key vm-initialization-cloud_init-hostname vm-initialization-cloud_init-network-dns-search_domains-host vm-initialization-cloud_init-network-dns-servers-host vm-initialization-cloud_init-network-nics-nic vm-initialization-cloud_init-payload_files-payload_file vm-initialization-cloud_init-regenerate_ssh_keys vm-initialization-cloud_init-timezone vm-initialization-cloud_init-users-user ... You should then be able to use these options as follows: [oVirt shell (connected)]# action vm vm_name start --vm-initialization-cloud_init-hostname your_host_name However, I think there is a bug in this particular option, the hostname, that will prevent using it. The name should be host, not hostname. As this is probably the first thing you will need the net result is that you won't be able to use it currently. I'm investigating it and will let you know if there is a workaround. -- 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: [Users] run once via ovirt-shell 3.3?
On 03/24/2014 03:15 PM, Sven Kieske wrote: Hi, with the 3.3 shell I just got the following tab options: [oVirt shell (connected)]# action vm test start async pause vm-domain-user-password vm-os-cmdline vm-placement_policy-affinity vm-stateless correlation_id vm-display-type vm-domain-user-username vm-os-initRd vm-placement_policy-host-id grace_period-expiry vm-domain-name vm-os-boot vm-os-kernel vm-placement_policy-host-name can I use newer cli versions with older engines? it's a 3.3.3-2 engine In general you can use a newer version of the SDKs and CLI with an older engine, as the RESTAPI is backwards compatible. However, some options of the newer SDKs and CLI won't work, as the support in the engine side won't exist. In this particular case you probably have an old version of the Python SDK (the CLI sits on top of the Python SDK). To have the cloud-init support you need at least version 3.3.3.0 of the ovirt-engine-sdk-python package (better to use the latest, 3.3.3.1). In addition, as I mentioned before, there is a bug around the hostname attribute, it should have been host-address. Auto-completion will tell you that the option is --vm-initialization-cloud_init-hostname, but actually it should be --vm-initialization-cloud_init-host-address. Typing that manually should work. I opened the following bug to track this issue: https://bugzilla.redhat.com/1080033 Am 24.03.2014 14:56, schrieb Juan Hernandez: On 03/24/2014 11:18 AM, Sven Kieske wrote: Hi, I'm just trying to figure out how to use run-once via shell.. [oVirt shell (connected)]# action vm vm_name start --run-once does not work, and there is no help for action vm start.. Does anybody have an idea on how to use run once via shell and how to pass cloud-init data over it? If you type action vm vm_name start and then hit tab twice it should display the available command line options. In your case you are interested in the initialization-cloud_init options: [oVirt shell (connected)]# action vm vm_name start TABTAB ... vm-initialization-cloud_init-authorized_keys-authorized_key vm-initialization-cloud_init-hostname vm-initialization-cloud_init-network-dns-search_domains-host vm-initialization-cloud_init-network-dns-servers-host vm-initialization-cloud_init-network-nics-nic vm-initialization-cloud_init-payload_files-payload_file vm-initialization-cloud_init-regenerate_ssh_keys vm-initialization-cloud_init-timezone vm-initialization-cloud_init-users-user ... You should then be able to use these options as follows: [oVirt shell (connected)]# action vm vm_name start --vm-initialization-cloud_init-hostname your_host_name However, I think there is a bug in this particular option, the hostname, that will prevent using it. The name should be host, not hostname. As this is probably the first thing you will need the net result is that you won't be able to use it currently. I'm investigating it and will let you know if there is a workaround. -- 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: [Users] API read-only access / roles
On 02/20/2014 04:51 PM, Itamar Heim wrote: On 02/20/2014 05:24 PM, Sven Kieske wrote: Hi, is nobody interested in this feature at all? it would be a huge security gain, while lowering the bars for having a read only user if this could get shipped with 3.4: we are very interested, but we want to do this based on the authentication re-factoring, which in itself, barely made the 3.4 timeline. Yair - are we pluggable yet, that someone could add such a user by dropping a jar somewhere, or still on going work towards 3.5? Pugglability of authentication already works in 3.4. By default it uses the previous mechanism, but the administrator can change this. In order to change you need to create the /etc/ovirt-engine/auth.conf.d directory and then create inside one or more authentication profiles configuration files. An authentication profile is a combination of an authenticator and a directory. The authenticator is used to check the credentials (the user name and password) and the directory is used to search users and their details. For example, if you want to use local authentication (the users, passwords, and groups of the OS) you can create a local.conf file with the following content: # # The name of the profile. This is what will be displayed in the # combo box in the login page. # name=local # # Needed to enable the profile, by default all profiles are # disabled. # enabled=true # # The configuration of the authenticator used by the profile. The # type and the module are mandatory, the rest are optional and # the default values are as shown below. # authenticator.type=ssh authenticator.module=org.ovirt.engine.core.authentication.ssh # authenticator.host=localhost # authenticator.port=22 # authenticator.timeout=10 # # The configuration of the directory: # directory.type=nss directory.module=org.ovirt.engine.core.authentication.nss For this to work you need to install some additional modules, which aren't currently part of the engine. This is where plugabillity comes in place. This modules can be built externally. I created modules for SSH authentication and NSS (Name Service Switch) directory. The source is available here: https://github.com/jhernand/ovirt-engine-ssh-authenticator https://github.com/jhernand/ovirt-engine-nss-directory The NSS directory also needs JNA (Java Native Access): https://github.com/jhernand/ovirt-engine-jna-module Installing these extensions is very easy, just build from source and uncompress the generated .zip files to /usr/share/ovirt-engine/modules. In case you don't want to build from source you can use the RPMs that I created. The source for the .spec files is here: https://github.com/jhernand/ovirt-engine-rpms If you don't want to build form source you can use a yum repository that I created with binaries for Fedora 20 (should work in CentOS as well): http://jhernand.fedorapeople.org/repo So, to summarize: # cat /etc/yum.repos.d/my.repo . [my] name=my baseurl=http://jhernand.fedorapeople.org/repo enabled=1 gpgcheck=0 . # yum -y install \ ovirt-engine-ssh-authenticator \ ovirt-engine-nss-directory # mkdir -p /etc/ovirt-engine/auth.conf.d # cat /etc/ovirt-engine/auth.conf.d/local.conf . name=local enabled=true authenticator.type=ssh authenticator.module=org.ovirt.engine.core.authentication.ssh directory.type=nss directory.module=org.ovirt.engine.core.authentication.nss . # systemctl restart ovirt-engine Then you can login with admin@internal, add some local users and permissions, and then use them to login to the GUI or the API. Take into account that I created these modules as a way to test the new authentication infrastructure, so they may have limitations or issues. I appreciate any feedback. Am 19.02.2014 15:32, schrieb Sven Kieske: I just looked into my test vm with the 3.4 beta and I can't see such an user there. I created an RFE at: https://bugzilla.redhat.com/show_bug.cgi?id=1067036 I really hope this can get included in 3.4 (I know it's late) as it should be a very very minor change at engine-setup. Thanks Am 19.02.2014 14:55, schrieb Sven Kieske: Hi, reiterating on this somewhat old mail: Is there a read only user integrated in 3.4? Because it's a huge overhead to install somewhere e.g. a freeipa server just to get read only access. Am 21.11.2013 09:52, schrieb Sander Grendelman: Hi Doron, The user I've defined in [1] works for me. A built-in login-/read-only role would be nice, but it's quite easy to define a custom role so more of a nice-to-have instead of a must-have. Thanks for asking! Sander. On Wed, Nov 20, 2013 at 5:40 PM, Doron Fediuck dfedi...@redhat.com wrote: Hi Sander, We're closing the ovirt 3.4 scope, and wondering if you're handling Zabbix based on [1]. If so please let me know and I'll update the 3.4 features list. Thanks, Doron [1] http://lists.ovirt.org/pipermail/users/2013-November/017946.html
Re: [Users] Fwd: Sample code for setting NIC - CloudInit
On 02/20/2014 08:42 PM, Greg Padgett wrote: On 02/20/2014 02:26 PM, Juan Hernandez wrote: On 02/20/2014 04:28 PM, Juan Hernandez wrote: On 02/20/2014 10:40 AM, Tejesh M wrote: I wrote this code to assign IP address to VM interface eth0, but not luck. Also, have attached debug log. I'm attaching a complete examaple of how to do this. However, I think that setting the DNS information doesn't currently work. Apparently cloud-init is expecting a network configuration containing the DNS settings inside the network interface, something like this: iface eth0 inet static dns-nameservers 1.1.2.2 1.2.3.4 dns-search google.com address 192.168.1.102 netmask 255.255.0.0 gateway 192.168.2.1 auto eth0 But we actually pass them outside of the network interface, like this: dns-nameservers 1.1.2.2 1.2.3.4 dns-search google.com iface eth0 inet static address 192.168.1.102 netmask 255.255.0.0 gateway 192.168.2.1 auto eth0 I need to check it. I have modified the code that generates the cloud-init files to put the DNS configuration inside the iface configuration, and then it works: http://gerrit.ovirt.org/24850 So this is probably a bug, either in our side or in cloud-init itself. Greg, Shahar, you know cloud-init better, what do you think? I opened the following bug to track it: https://bugzilla.redhat.com/1067906 It looks like our bug. Cloud-init wants to see a standard debian/ubuntu style /etc/network/interfaces, and the documentation for that format supports your change. Thanks for posting the patch! _*Java Code:*_ 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.CloudInit.Network networkConfiguration=new org.ovirt.engine.sdk.entities.CloudInit.Network(); DNS dns = new DNS(); dns.setServers(createServersList(1.1.2.2, 1.2.3.4)); dns.setSearchDomains(createServersList(google.com http://google.com)); networkConfiguration.setDns(dns); 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.setNetwork(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); On Thu, Feb 20, 2014 at 1:39 PM, Moti Asayag masa...@redhat.com mailto:masa...@redhat.com wrote: - Original Message - From: Tejesh M tejes...@gmail.com mailto:tejes...@gmail.com To: Moti Asayag masa...@redhat.com mailto:masa...@redhat.com Cc: users@oVirt.org users@ovirt.org mailto:users@ovirt.org Sent: Thursday, February 20, 2014 8:52:52 AM Subject: Re: [Users] Fwd: Sample code for setting NIC - CloudInit I'm not getting below class: import org.ovirt.engine.sdk.entities.*NetworkConfiguration*; Which version of ovirt-engine-sdk-java are you using ? I used ovirt-engine-sdk-java-3.4.0.1-1, added to my project's pom.xml: dependency groupIdorg.ovirt.engine.sdk/groupId artifactIdovirt-engine-sdk-java/artifactId version3.4.0.1-1/version typejar/type scopecompile/scope /dependency On Thu, Feb 20, 2014 at 4:11 AM, Moti Asayag masa...@redhat.com mailto:masa...@redhat.com wrote: - Original Message - From: Tejesh M tejes...@gmail.com mailto:tejes...@gmail.com To: users@oVirt.org users@ovirt.org mailto:users@ovirt.org Sent: Wednesday, February 19, 2014 3:24:40 PM Subject: [Users] Fwd: Sample code for setting NIC - CloudInit Hi, Can someone share me sample java code for assigning IP address for VM on eth0 through Java SDK via CloudInit ? Hi Tejesh, I've attached a sample code that sends the required request (as the output is demonstrated
Re: [Users] Fwd: Sample code for setting NIC - CloudInit
On 02/21/2014 08:13 AM, Tejesh M wrote: When i try to execute with the ovirt sdk 3.3.3 and do operations on RHEV-M 3.3, it fails with below error This happens because the oVirt SDK is compiled with Java 7, and you are probably using Java 6. I suggest to switch to Java 7, unless there is a very good reason to stick to Java 6. Java 6 end of life was declared by Oracle on Feb 1023. However, the OpenJDK community still support Java 6, so if you really need it please tell us, and we can try to make a version of the oVirt SDK compatible with Java 6. Exception in thread main java.lang.UnsupportedClassVersionError: org/ovirt/engine/sdk/Api at rhvm.callAPI(rhvm.java:238) at rhvm.main(rhvm.java:278) On Fri, Feb 21, 2014 at 12:19 AM, Juan Hernandez jhern...@redhat.com mailto:jhern...@redhat.com wrote: On 02/20/2014 05:56 PM, Tejesh M wrote: Ok. Will it take long time for that sdk to release? No, it should be released soon. Meanwhile you may want to use the latest ovirt 3.3 Java SDK, it is almost identical to the RHEV-M Jaa SDK. If you are using maven these are the coordinates of the artifact: dependency groupIdorg.ovirt.engine.sdk/groupId artifactIdovirt-engine-sdk-java/artifactId version3.3.3.0/version /dependency If you aren't using maven you can still download the .jar file from here: http://search.maven.org/#artifactdetails|org.ovirt.engine.sdk|ovirt-engine-sdk-java|3.3.3.0|jar On 20 Feb 2014 04:11, Moti Asayag masa...@redhat.com mailto:masa...@redhat.com mailto:masa...@redhat.com mailto:masa...@redhat.com wrote: - Original Message - From: Tejesh M tejes...@gmail.com mailto:tejes...@gmail.com mailto:tejes...@gmail.com mailto:tejes...@gmail.com To: users@oVirt.org users@ovirt.org mailto:users@ovirt.org mailto:users@ovirt.org mailto:users@ovirt.org Sent: Wednesday, February 19, 2014 3:24:40 PM Subject: [Users] Fwd: Sample code for setting NIC - CloudInit Hi, Can someone share me sample java code for assigning IP address for VM on eth0 through Java SDK via CloudInit ? Hi Tejesh, I've attached a sample code that sends the required request (as the output is demonstrated in debug mode). Note that the code is jdk-7 compliant. I haven't configured cloud-init and haven't tested it end-to-end. Please try to test it on your environment and provide a feedback for it. Thanks, Moti Something Like this but in Java: network_configuration nics nic nameeth0/name boot_protocolSTATIC/boot_protocol network ip address=192.168.2.11 netmask=255.255.0.0 gateway=192.168.2.1 / /network on_boottrue/on_boot /nic nic nameeth1/name boot_protocolDHCP/boot_protocol /nic nic nameeth2/name boot_protocolNONE/boot_protocol on_boottrue/on_boot /nic /nics dns servers host address1.1.2.2/address /host host address1.2.3.4/address /host /servers search_domains host addressqa.lab/address /host host address google.com http://google.com http://google.com /address /host /search_domains /dns /network_configuration -- 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: [Users] Fwd: Sample code for setting NIC - CloudInit
On 02/20/2014 10:40 AM, Tejesh M wrote: I wrote this code to assign IP address to VM interface eth0, but not luck. Also, have attached debug log. I'm attaching a complete examaple of how to do this. However, I think that setting the DNS information doesn't currently work. Apparently cloud-init is expecting a network configuration containing the DNS settings inside the network interface, something like this: iface eth0 inet static dns-nameservers 1.1.2.2 1.2.3.4 dns-search google.com address 192.168.1.102 netmask 255.255.0.0 gateway 192.168.2.1 auto eth0 But we actually pass them outside of the network interface, like this: dns-nameservers 1.1.2.2 1.2.3.4 dns-search google.com iface eth0 inet static address 192.168.1.102 netmask 255.255.0.0 gateway 192.168.2.1 auto eth0 I need to check it. _*Java Code:*_ 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.CloudInit.Network networkConfiguration=new org.ovirt.engine.sdk.entities.CloudInit.Network(); DNS dns = new DNS(); dns.setServers(createServersList(1.1.2.2, 1.2.3.4)); dns.setSearchDomains(createServersList(google.com http://google.com)); networkConfiguration.setDns(dns); 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.setNetwork(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); On Thu, Feb 20, 2014 at 1:39 PM, Moti Asayag masa...@redhat.com mailto:masa...@redhat.com wrote: - Original Message - From: Tejesh M tejes...@gmail.com mailto:tejes...@gmail.com To: Moti Asayag masa...@redhat.com mailto:masa...@redhat.com Cc: users@oVirt.org users@ovirt.org mailto:users@ovirt.org Sent: Thursday, February 20, 2014 8:52:52 AM Subject: Re: [Users] Fwd: Sample code for setting NIC - CloudInit I'm not getting below class: import org.ovirt.engine.sdk.entities.*NetworkConfiguration*; Which version of ovirt-engine-sdk-java are you using ? I used ovirt-engine-sdk-java-3.4.0.1-1, added to my project's pom.xml: dependency groupIdorg.ovirt.engine.sdk/groupId artifactIdovirt-engine-sdk-java/artifactId version3.4.0.1-1/version typejar/type scopecompile/scope /dependency On Thu, Feb 20, 2014 at 4:11 AM, Moti Asayag masa...@redhat.com mailto:masa...@redhat.com wrote: - Original Message - From: Tejesh M tejes...@gmail.com mailto:tejes...@gmail.com To: users@oVirt.org users@ovirt.org mailto:users@ovirt.org Sent: Wednesday, February 19, 2014 3:24:40 PM Subject: [Users] Fwd: Sample code for setting NIC - CloudInit Hi, Can someone share me sample java code for assigning IP address for VM on eth0 through Java SDK via CloudInit ? Hi Tejesh, I've attached a sample code that sends the required request (as the output is demonstrated in debug mode). Note that the code is jdk-7 compliant. I haven't configured cloud-init and haven't tested it end-to-end. Please try to test it on your environment and provide a feedback for it. Thanks, Moti Something Like this but in Java: network_configuration nics nic nameeth0/name boot_protocolSTATIC/boot_protocol network ip address=192.168.2.11 netmask=255.255.0.0 gateway=192.168.2.1 / /network on_boottrue/on_boot /nic nic
Re: [Users] (no subject)
On 02/20/2014 04:06 PM, Koen Vanoppen wrote: Thanx, for the answer. But he successfully created a ticket and received a number, but when he then starts the client again, as asked ( Connect to the client again (again, r-v will ask for the password in a pop-up window): ) He has to give a password. Maybe important. The username field is empty and can't be modified. Kind regards, Koen Find attached a complete example of how to do this with the python SDK. This generates a remote-viewer configuration file like the GUI does. Note that you will need the latest version of the SKD, 3.4.0.4, as otherwise the all_content parameter required to get the subject of the certificate of the host isn't available. 2014-02-20 16:03 GMT+01:00 Yedidyah Bar David d...@redhat.com mailto:d...@redhat.com: *From: *Koen Vanoppen vanoppen.k...@gmail.com mailto:vanoppen.k...@gmail.com *To: *users@ovirt.org mailto:users@ovirt.org *Sent: *Thursday, February 20, 2014 4:56:10 PM *Subject: *[Users] (no subject) Hey Guys, I'm back ;-). This time I have a question from one of our programmers. He's trying this: http://www.ovirt.org/How_to_Connect_to_SPICE_Console_Without_Portal#Connecting_Using_REST_API But he bumps into this: Connect to the client again (again, r-v will ask for the password in a pop-up window): bash$ *remote-viewer --spice-ca-file ${CA_FILE} --spice-host-subject ${SUBJECT} spice://${HOST}/?port=${PORT}\tls-port=${SPORT}* Now, the question is What's the password? Or where can I find it? I think you need to set it with setVmTicket - see that page for an example. -- Didi ___ Users mailing list Users@ovirt.org http://lists.ovirt.org/mailman/listinfo/users -- 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. #!/usr/bin/python import os import ovirtsdk.api import ovirtsdk.xml import subprocess import tempfile import urllib # The parameters to connect to the engine: engine_host = rhel.example.com engine_port = 443 engine_user = admin@internal engine_password = redhat123 # The name of the vm: vm_name = myvm # A template to generate the viewer configuration file: config_template = \ [virt-viewer] type={type} host={host} port={port} password={password} tls-port={tls_port} fullscreen=0 title={title} enable-smartcard=0 enable-usb-autoshare=1 delete-this-file=1 usb-filter=-1,-1,-1,-1,0 tls-ciphers=DEFAULT host-subject={tls_subject} ca={ca} toggle-fullscreen=shift+f11 release-cursor=shift+f12 secure-channels=main;inputs;cursor;playback;record;display;usbredir;smartcard # Connect to the API: api_url = https://{host}:{port}/api.format( host=engine_host, port=engine_port ) api = ovirtsdk.api.API( url=api_url, username=engine_user, password=engine_password, insecure=True, debug=True ) # Download the CA certificate, as we need to pass this to the viewer so that it # will trust the SSL certificate of the host: ca_url = https://{host}:{port}/ca.crt.format( host=engine_host, port=engine_port ) ca_path, _ = urllib.urlretrieve(ca_url) with open(ca_path, r) as ca_file: ca_content = ca_file.read() ca_content = ca_content.replace(\n, \\n) # Find the VM and get the display details: vm = api.vms.get(name=vm_name, all_content=True) display = vm.get_display() # Request a ticket for the display of the VM: ticket_result = vm.ticket() ticket = ticket_result.get_ticket() # Create the viewer configuration: config_content = config_template.format( type=display.get_type(), host=display.get_address(), port=display.get_port(), password=ticket.get_value(), tls_port=display.get_secure_port(), title=vm_name, tls_subject=display.get_certificate().get_subject(), ca=ca_content ) config_fd, config_path = tempfile.mkstemp() with os.fdopen(config_fd, w) as config_file: config_file.write(config_content) # Run the viewer: subprocess.call([remote-viewer, config_path]) ___ Users mailing list Users@ovirt.org http://lists.ovirt.org/mailman/listinfo/users
Re: [Users] Fwd: Sample code for setting NIC - CloudInit
On 02/20/2014 05:09 PM, Tejesh M wrote: I'm using rhevm 3.3 java sdk,which doesn't have NetworkConfiguration class. In that case you will have to use CloudInit.Network. That was an error in that version of the SDK, which will be fixed with the next release. On 20 Feb 2014 20:58, Juan Hernandez jhern...@redhat.com mailto:jhern...@redhat.com wrote: On 02/20/2014 10:40 AM, Tejesh M wrote: I wrote this code to assign IP address to VM interface eth0, but not luck. Also, have attached debug log. I'm attaching a complete examaple of how to do this. However, I think that setting the DNS information doesn't currently work. Apparently cloud-init is expecting a network configuration containing the DNS settings inside the network interface, something like this: iface eth0 inet static dns-nameservers 1.1.2.2 1.2.3.4 dns-search google.com http://google.com address 192.168.1.102 netmask 255.255.0.0 gateway 192.168.2.1 auto eth0 But we actually pass them outside of the network interface, like this: dns-nameservers 1.1.2.2 1.2.3.4 dns-search google.com http://google.com iface eth0 inet static address 192.168.1.102 netmask 255.255.0.0 gateway 192.168.2.1 auto eth0 I need to check it. _*Java Code:*_ 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.CloudInit.Network networkConfiguration=new org.ovirt.engine.sdk.entities.CloudInit.Network(); DNS dns = new DNS(); dns.setServers(createServersList(1.1.2.2, 1.2.3.4)); dns.setSearchDomains(createServersList(google.com http://google.com http://google.com)); networkConfiguration.setDns(dns); 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.setNetwork(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); On Thu, Feb 20, 2014 at 1:39 PM, Moti Asayag masa...@redhat.com mailto:masa...@redhat.com mailto:masa...@redhat.com mailto:masa...@redhat.com wrote: - Original Message - From: Tejesh M tejes...@gmail.com mailto:tejes...@gmail.com mailto:tejes...@gmail.com mailto:tejes...@gmail.com To: Moti Asayag masa...@redhat.com mailto:masa...@redhat.com mailto:masa...@redhat.com mailto:masa...@redhat.com Cc: users@oVirt.org users@ovirt.org mailto:users@ovirt.org mailto:users@ovirt.org mailto:users@ovirt.org Sent: Thursday, February 20, 2014 8:52:52 AM Subject: Re: [Users] Fwd: Sample code for setting NIC - CloudInit I'm not getting below class: import org.ovirt.engine.sdk.entities.*NetworkConfiguration*; Which version of ovirt-engine-sdk-java are you using ? I used ovirt-engine-sdk-java-3.4.0.1-1, added to my project's pom.xml: dependency groupIdorg.ovirt.engine.sdk/groupId artifactIdovirt-engine-sdk-java/artifactId version3.4.0.1-1/version typejar/type scopecompile/scope /dependency On Thu, Feb 20, 2014 at 4:11 AM, Moti Asayag masa...@redhat.com mailto:masa...@redhat.com mailto:masa...@redhat.com mailto:masa...@redhat.com wrote: - Original Message - From: Tejesh M tejes...@gmail.com mailto:tejes...@gmail.com mailto:tejes...@gmail.com mailto:tejes...@gmail.com
Re: [Users] Fwd: Sample code for setting NIC - CloudInit
On 02/20/2014 05:56 PM, Tejesh M wrote: Ok. Will it take long time for that sdk to release? No, it should be released soon. Meanwhile you may want to use the latest ovirt 3.3 Java SDK, it is almost identical to the RHEV-M Jaa SDK. If you are using maven these are the coordinates of the artifact: dependency groupIdorg.ovirt.engine.sdk/groupId artifactIdovirt-engine-sdk-java/artifactId version3.3.3.0/version /dependency If you aren't using maven you can still download the .jar file from here: http://search.maven.org/#artifactdetails|org.ovirt.engine.sdk|ovirt-engine-sdk-java|3.3.3.0|jar On 20 Feb 2014 04:11, Moti Asayag masa...@redhat.com mailto:masa...@redhat.com wrote: - Original Message - From: Tejesh M tejes...@gmail.com mailto:tejes...@gmail.com To: users@oVirt.org users@ovirt.org mailto:users@ovirt.org Sent: Wednesday, February 19, 2014 3:24:40 PM Subject: [Users] Fwd: Sample code for setting NIC - CloudInit Hi, Can someone share me sample java code for assigning IP address for VM on eth0 through Java SDK via CloudInit ? Hi Tejesh, I've attached a sample code that sends the required request (as the output is demonstrated in debug mode). Note that the code is jdk-7 compliant. I haven't configured cloud-init and haven't tested it end-to-end. Please try to test it on your environment and provide a feedback for it. Thanks, Moti Something Like this but in Java: network_configuration nics nic nameeth0/name boot_protocolSTATIC/boot_protocol network ip address=192.168.2.11 netmask=255.255.0.0 gateway=192.168.2.1 / /network on_boottrue/on_boot /nic nic nameeth1/name boot_protocolDHCP/boot_protocol /nic nic nameeth2/name boot_protocolNONE/boot_protocol on_boottrue/on_boot /nic /nics dns servers host address1.1.2.2/address /host host address1.2.3.4/address /host /servers search_domains host addressqa.lab/address /host host address google.com http://google.com /address /host /search_domains /dns /network_configuration -- Thanks Regards Tejesh ___ Users mailing list Users@ovirt.org mailto:Users@ovirt.org http://lists.ovirt.org/mailman/listinfo/users ___ Users mailing list Users@ovirt.org http://lists.ovirt.org/mailman/listinfo/users -- 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: [Users] Fwd: Sample code for setting NIC - CloudInit
On 02/20/2014 04:28 PM, Juan Hernandez wrote: On 02/20/2014 10:40 AM, Tejesh M wrote: I wrote this code to assign IP address to VM interface eth0, but not luck. Also, have attached debug log. I'm attaching a complete examaple of how to do this. However, I think that setting the DNS information doesn't currently work. Apparently cloud-init is expecting a network configuration containing the DNS settings inside the network interface, something like this: iface eth0 inet static dns-nameservers 1.1.2.2 1.2.3.4 dns-search google.com address 192.168.1.102 netmask 255.255.0.0 gateway 192.168.2.1 auto eth0 But we actually pass them outside of the network interface, like this: dns-nameservers 1.1.2.2 1.2.3.4 dns-search google.com iface eth0 inet static address 192.168.1.102 netmask 255.255.0.0 gateway 192.168.2.1 auto eth0 I need to check it. I have modified the code that generates the cloud-init files to put the DNS configuration inside the iface configuration, and then it works: http://gerrit.ovirt.org/24850 So this is probably a bug, either in our side or in cloud-init itself. Greg, Shahar, you know cloud-init better, what do you think? _*Java Code:*_ 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.CloudInit.Network networkConfiguration=new org.ovirt.engine.sdk.entities.CloudInit.Network(); DNS dns = new DNS(); dns.setServers(createServersList(1.1.2.2, 1.2.3.4)); dns.setSearchDomains(createServersList(google.com http://google.com)); networkConfiguration.setDns(dns); 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.setNetwork(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); On Thu, Feb 20, 2014 at 1:39 PM, Moti Asayag masa...@redhat.com mailto:masa...@redhat.com wrote: - Original Message - From: Tejesh M tejes...@gmail.com mailto:tejes...@gmail.com To: Moti Asayag masa...@redhat.com mailto:masa...@redhat.com Cc: users@oVirt.org users@ovirt.org mailto:users@ovirt.org Sent: Thursday, February 20, 2014 8:52:52 AM Subject: Re: [Users] Fwd: Sample code for setting NIC - CloudInit I'm not getting below class: import org.ovirt.engine.sdk.entities.*NetworkConfiguration*; Which version of ovirt-engine-sdk-java are you using ? I used ovirt-engine-sdk-java-3.4.0.1-1, added to my project's pom.xml: dependency groupIdorg.ovirt.engine.sdk/groupId artifactIdovirt-engine-sdk-java/artifactId version3.4.0.1-1/version typejar/type scopecompile/scope /dependency On Thu, Feb 20, 2014 at 4:11 AM, Moti Asayag masa...@redhat.com mailto:masa...@redhat.com wrote: - Original Message - From: Tejesh M tejes...@gmail.com mailto:tejes...@gmail.com To: users@oVirt.org users@ovirt.org mailto:users@ovirt.org Sent: Wednesday, February 19, 2014 3:24:40 PM Subject: [Users] Fwd: Sample code for setting NIC - CloudInit Hi, Can someone share me sample java code for assigning IP address for VM on eth0 through Java SDK via CloudInit ? Hi Tejesh, I've attached a sample code that sends the required request (as the output is demonstrated in debug mode). Note that the code is jdk-7 compliant. I haven't configured cloud-init and haven't tested it end-to-end. Please try to test it on your environment and provide a feedback for it. Thanks, Moti Something Like this but in Java: network_configuration nics
Re: [Users] [rhevm-api] Assign IP address to VM using Java SDK
On 02/14/2014 10:30 AM, Tejesh M wrote: Hi, There is no option in Initial Run to set root password other stuff. Have attached screenshots debug output. Is there any configuration needs to be done? or any cloud-init service needs to be started? How do integrate cloud-init with RHEV-M? Thanks Regards, Tejesh You are using the Run and New options, but you have to use the Run Once option. There, in Run Once is where we have cloud-init support in 3.3. On Thu, Feb 13, 2014 at 9:50 PM, Juan Hernandez jhern...@redhat.com mailto:jhern...@redhat.com wrote: On 02/13/2014 05:15 PM, Tejesh M wrote: Actually, i want to automate the vm provisioning through java sdk. and this urgent requirement. Is it possible to automate setting hostname, root password n nic info by any means in 3.3? Also in windows administration password as similar to linux.. kindly help as im new to this.. Yes, setting the hostname, root password and NIC info is possible in 3.3, using cloud-init and the Java SDK. I tested this with 3.3 and it works correctly. As you are having problems I suggest to try it manually, from the GUI, if it doesn't work then please report the details, so that we can diagnose and fix it. Once it works manually from the GUI, we can see why it doesn't work with the SDK, but we will need the output generated when running in debug mode. On 13 Feb 2014 20:32, Juan Hernandez jhern...@redhat.com mailto:jhern...@redhat.com mailto:jhern...@redhat.com mailto:jhern...@redhat.com wrote: On 02/13/2014 03:59 PM, Shahar Havivi wrote: On 13.02.14 20:17, Tejesh M wrote: 1. The Version is RHEV-M 3.3 Cloud-init is cloud-init-0.6.3-0.12.bzr532.el6.noarch 2. In Webadmin, i don't find any option to set Cloud-init data's. I checked under New VM-Initial Run.. Am i looking at the right place? How to enable cloud-init support in engine? You will not found it since you are working in 3.3 and this feature presented in 3.4. In 3.3 you can try to set the Cloud-Init via the Run-Once button. In 3.3 you need first to create the VM. Once it is created select it, click the Run Once button, then click on the plus sign next to Initial Run, check the Cloud-Init box, and populate the fields you want. I have installed cloud-init package in RHEV-M also in Template. Please suggest. On Thu, Feb 13, 2014 at 7:31 PM, Juan Hernandez jhern...@redhat.com mailto:jhern...@redhat.com mailto:jhern...@redhat.com mailto:jhern...@redhat.com wrote: On 02/13/2014 02:39 PM, Tejesh M wrote: Hi All, Thanks alot. I have created one VM with minimal installation installed cloud-init package. And, converted that VM into Template. Then executed the code given in http://lists.ovirt.org/pipermail/users/2014-February/021302.html , but no luck, the code is not setting root password. What version of the engine are you running? I may not have the required cloud-init support. Try to run the application in debug mode: Api api = new Api( https://whatever/api;, user@domain, password, null, null, null, null, true, null, true // - This is to enable debug mode ); It will send to the log the actual XML documents sent to the server. We can use it to see if the request is generated correctly. It may also happen that cloud-init support isn't working correctly. To verify this try to use the cloud-init support manually from webadmin. Does it work from there? Also, there is no option to set *Hostname *for the VM. To set the host name you need to add something like this: Host hostData = new Host(); hostData.setAddress(the.host.name http://the.host.name http://the.host.name); cloudData.setHost(hostData); _*Code:*_ /*Begin Customize VM*/ // Generate the random password, using whatever mechanism you // prefer: String password
Re: [Users] [rhevm-api] Assign IP address to VM using Java SDK
On 02/14/2014 10:36 AM, Juan Hernandez wrote: On 02/14/2014 10:30 AM, Tejesh M wrote: Hi, There is no option in Initial Run to set root password other stuff. Have attached screenshots debug output. Is there any configuration needs to be done? or any cloud-init service needs to be started? How do integrate cloud-init with RHEV-M? Thanks Regards, Tejesh You are using the Run and New options, but you have to use the Run Once option. There, in Run Once is where we have cloud-init support in 3.3. From your debug.txt file this is the request that you the Java SDK is sending to the server: action vm initialization cloud_init host addressmyvm/address /host users user user_nameroot/user_name passwordcJql3P9XLQG4drCYVG/6Q//password /user /users /cloud_init /initialization /vm /action That is correct. I just tested it in my environment and it works well, and it assigns the host name and root password to the machine. To check if cloud-init is working correctly you will have to check if has a CDROM attached as expected. Remember that we dynamically generate an ISO file and connect it to the VM as a CDROM. The cloud-init scripts take the information from that CDROM. To verify that this is working start the VM (manually or using the Java SDK) and then login to the hypervisor and check what arguments have been passed to the qemu-kvm process corresponding to that VM: # ps -ef | grep 'qemu-kvm -name myvm' That should give a very long command line. Look for an option like the following: -drive file=/var/run/vdsm/payload/c46bf225-4e58-48b8-bfac-112351b00619.34ac58704f7df0efab99cf4bd14a1696.img,if=none,media=cdrom,id=drive-ide0-1-1,readonly=on,format=raw,serial= If you don't see an option similar to this one then the CDROM isn't being attached to the VM correctly. If you do see this option, then make a copy of the file, and inspect its content. For example, I did this in my environment: # cp /var/run/vdsm/payload/c46bf225-4e58-48b8-bfac-112351b00619.34ac58704f7df0efab99cf4bd14a1696.img /tmp/cloud-init.iso # mount -o loop,ro /tmp/cloud-init.iso /mnt # find /mnt /mnt/ /mnt/openstack /mnt/openstack/latest /mnt/openstack/latest/meta_data.json /mnt/openstack/latest/user_data # cat /mnt/openstack/latest/meta_data.json { launch_index : 0, availability_zone : nova, name : myvm, hostname : myvm, uuid : 39cea046-e8ce-4e3d-bb9b-d2a449434066, meta : { essential : false, role : server, dsmode : local } } # cat /mnt/openstack/latest/user_data #cloud-config output: all: ' /var/log/cloud-init-output.log' user: root password: cJql3P9XLQG4drCYVG runcmd: - 'sed -i ''/^datasource_list: /d'' /etc/cloud/cloud.cfg; echo ''datasource_list: [NoCloud, ConfigDrive]'' /etc/cloud/cloud.cfg' Please report your results. On Thu, Feb 13, 2014 at 9:50 PM, Juan Hernandez jhern...@redhat.com mailto:jhern...@redhat.com wrote: On 02/13/2014 05:15 PM, Tejesh M wrote: Actually, i want to automate the vm provisioning through java sdk. and this urgent requirement. Is it possible to automate setting hostname, root password n nic info by any means in 3.3? Also in windows administration password as similar to linux.. kindly help as im new to this.. Yes, setting the hostname, root password and NIC info is possible in 3.3, using cloud-init and the Java SDK. I tested this with 3.3 and it works correctly. As you are having problems I suggest to try it manually, from the GUI, if it doesn't work then please report the details, so that we can diagnose and fix it. Once it works manually from the GUI, we can see why it doesn't work with the SDK, but we will need the output generated when running in debug mode. On 13 Feb 2014 20:32, Juan Hernandez jhern...@redhat.com mailto:jhern...@redhat.com mailto:jhern...@redhat.com mailto:jhern...@redhat.com wrote: On 02/13/2014 03:59 PM, Shahar Havivi wrote: On 13.02.14 20:17, Tejesh M wrote: 1. The Version is RHEV-M 3.3 Cloud-init is cloud-init-0.6.3-0.12.bzr532.el6.noarch 2. In Webadmin, i don't find any option to set Cloud-init data's. I checked under New VM-Initial Run.. Am i looking at the right place? How to enable cloud-init support in engine? You will not found it since you are working in 3.3 and this feature presented in 3.4. In 3.3 you can try to set the Cloud-Init via the Run-Once button. In 3.3 you need first to create the VM. Once it is created select it, click the Run Once button, then click on the plus sign next to Initial Run, check the Cloud-Init box, and populate the fields you want. I have installed
Re: [Users] [rhevm-api] Assign IP address to VM using Java SDK
On 02/14/2014 11:03 AM, Tejesh M wrote: In the two screenshots which i shared earlier, in that No Cloud-Init 2.png is Run Once screenshot, it has only 4 options, i. Boot Options ii. Host iii. Display Protocol iv. Custom Properties After selecting VM, when i click Run Once, that screen is getting appears as in screenshot, no option for cloud-init. Do i need to update the RHEV-M? Ok, I thought you were using RHEV-M 3.3, but apparently you are using 3.2. Can you verify? # rpm -qa 'rhevm*' If you are using 3.2 then you will need to update to 3.3 in order to have cloud-init support. On Fri, Feb 14, 2014 at 3:06 PM, Juan Hernandez jhern...@redhat.com mailto:jhern...@redhat.com wrote: On 02/14/2014 10:30 AM, Tejesh M wrote: Hi, There is no option in Initial Run to set root password other stuff. Have attached screenshots debug output. Is there any configuration needs to be done? or any cloud-init service needs to be started? How do integrate cloud-init with RHEV-M? Thanks Regards, Tejesh You are using the Run and New options, but you have to use the Run Once option. There, in Run Once is where we have cloud-init support in 3.3. On Thu, Feb 13, 2014 at 9:50 PM, Juan Hernandez jhern...@redhat.com mailto:jhern...@redhat.com mailto:jhern...@redhat.com mailto:jhern...@redhat.com wrote: On 02/13/2014 05:15 PM, Tejesh M wrote: Actually, i want to automate the vm provisioning through java sdk. and this urgent requirement. Is it possible to automate setting hostname, root password n nic info by any means in 3.3? Also in windows administration password as similar to linux.. kindly help as im new to this.. Yes, setting the hostname, root password and NIC info is possible in 3.3, using cloud-init and the Java SDK. I tested this with 3.3 and it works correctly. As you are having problems I suggest to try it manually, from the GUI, if it doesn't work then please report the details, so that we can diagnose and fix it. Once it works manually from the GUI, we can see why it doesn't work with the SDK, but we will need the output generated when running in debug mode. On 13 Feb 2014 20:32, Juan Hernandez jhern...@redhat.com mailto:jhern...@redhat.com mailto:jhern...@redhat.com mailto:jhern...@redhat.com mailto:jhern...@redhat.com mailto:jhern...@redhat.com mailto:jhern...@redhat.com mailto:jhern...@redhat.com wrote: On 02/13/2014 03:59 PM, Shahar Havivi wrote: On 13.02.14 20:17, Tejesh M wrote: 1. The Version is RHEV-M 3.3 Cloud-init is cloud-init-0.6.3-0.12.bzr532.el6.noarch 2. In Webadmin, i don't find any option to set Cloud-init data's. I checked under New VM-Initial Run.. Am i looking at the right place? How to enable cloud-init support in engine? You will not found it since you are working in 3.3 and this feature presented in 3.4. In 3.3 you can try to set the Cloud-Init via the Run-Once button. In 3.3 you need first to create the VM. Once it is created select it, click the Run Once button, then click on the plus sign next to Initial Run, check the Cloud-Init box, and populate the fields you want. I have installed cloud-init package in RHEV-M also in Template. Please suggest. On Thu, Feb 13, 2014 at 7:31 PM, Juan Hernandez jhern...@redhat.com mailto:jhern...@redhat.com mailto:jhern...@redhat.com mailto:jhern...@redhat.com mailto:jhern...@redhat.com mailto:jhern...@redhat.com mailto:jhern...@redhat.com mailto:jhern...@redhat.com wrote: On 02/13/2014 02:39 PM, Tejesh M wrote: Hi All, Thanks alot. I have created one VM with minimal installation installed cloud-init package. And, converted that VM into Template. Then executed the code given in http://lists.ovirt.org/pipermail/users/2014-February/021302.html , but no luck, the code is not setting root password. What version of the engine are you running? I may
Re: [Users] [rhevm-api] Assign IP address to VM using Java SDK
On 02/14/2014 12:27 PM, Tejesh M wrote: Here is the list: [root@rhevm ~]# rpm -qa 'rhevm*' rhevm-lib-3.3.0-0.46.el6ev.noarch rhevm-setup-3.3.0-0.46.el6ev.noarch rhevm-spice-client-x86-msi-3.3-8.el6_5.noarch rhevm-branding-rhev-3.3.0-1.5.el6ev.noarch rhevm-restapi-3.3.0-0.46.el6ev.noarch rhevm-3.3.0-0.46.el6ev.noarch rhevm-sdk-java-javadoc-1.0.0.29-0.1.el6ev.noarch rhevm-image-uploader-3.3.1-2.el6ev.noarch rhevm-setup-plugins-3.3.0-4.el6ev.noarch rhevm-cli-3.3.0.13-1.el6ev.noarch rhevm-log-collector-3.3.1-5.el6ev.noarch rhevm-dependencies-3.3.5-1.el6ev.noarch rhevm-spice-client-x64-msi-3.3-8.el6_5.noarch rhevm-tools-3.3.0-0.46.el6ev.noarch rhevm-sdk-python-3.3.0.21-1.el6ev.noarch rhevm-iso-uploader-3.3.0-2.el6ev.noarch rhevm-websocket-proxy-3.3.0-0.46.el6ev.noarch rhevm-backend-3.3.0-0.46.el6ev.noarch rhevm-spice-client-x64-cab-3.3-8.el6_5.noarch rhevm-userportal-3.3.0-0.46.el6ev.noarch rhevm-dwh-3.3.0-29.el6ev.noarch rhevm-dbscripts-3.3.0-0.46.el6ev.noarch rhevm-reports-3.3.0-28.el6ev.noarch rhevm-sdk-java-1.0.0.29-0.1.el6ev.noarch rhevm-doc-3.3.0-3.el6eng.noarch rhevm-webadmin-portal-3.3.0-0.46.el6ev.noarch rhevm-spice-client-x86-cab-3.3-8.el6_5.noarch Ok, you are using RHEV-M 3.3, that is correct, it has support for cloud-init. The only reason I can think of that prevents using the cloud-init options in 3.3 is that the operating system isn't defined as a Linux variant. Select the VM, click the Edit button and make sure to select a Linux operating system in the Operating System list. The closer to the actual operating system the better. Then try again Run Once. To avoid making this for every VM you create, you should do the change in the template as well. By the way, please reply to the list, there may be other people interested in your same issue. -- 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: [Users] [rhevm-api] Assign IP address to VM using Java SDK
On 02/14/2014 02:07 PM, Tejesh M wrote: Thanks, now i could see the cloud-init option in Run Once.. I did selected Other Linux instead of exact Linux flavor. And sorry, instead of Reply All, i clicked on Reply and sent that mail. Now, when i start VM from Run Once with Cloud-init options like Hostname Root Password, in the startup screen of VM, it show the error as attached screenshot. The messages in that screen shot mean that cloud-init is trying to locate its configuration via the network instead of inside the CDROM. So this probably means that the CDROM isn't attached correctly to the VM. Please try to find the options of the qemu-kvm command as I described in a previous mail. On Fri, Feb 14, 2014 at 5:09 PM, Juan Hernandez jhern...@redhat.com mailto:jhern...@redhat.com wrote: On 02/14/2014 12:27 PM, Tejesh M wrote: Here is the list: [root@rhevm ~]# rpm -qa 'rhevm*' rhevm-lib-3.3.0-0.46.el6ev.noarch rhevm-setup-3.3.0-0.46.el6ev.noarch rhevm-spice-client-x86-msi-3.3-8.el6_5.noarch rhevm-branding-rhev-3.3.0-1.5.el6ev.noarch rhevm-restapi-3.3.0-0.46.el6ev.noarch rhevm-3.3.0-0.46.el6ev.noarch rhevm-sdk-java-javadoc-1.0.0.29-0.1.el6ev.noarch rhevm-image-uploader-3.3.1-2.el6ev.noarch rhevm-setup-plugins-3.3.0-4.el6ev.noarch rhevm-cli-3.3.0.13-1.el6ev.noarch rhevm-log-collector-3.3.1-5.el6ev.noarch rhevm-dependencies-3.3.5-1.el6ev.noarch rhevm-spice-client-x64-msi-3.3-8.el6_5.noarch rhevm-tools-3.3.0-0.46.el6ev.noarch rhevm-sdk-python-3.3.0.21-1.el6ev.noarch rhevm-iso-uploader-3.3.0-2.el6ev.noarch rhevm-websocket-proxy-3.3.0-0.46.el6ev.noarch rhevm-backend-3.3.0-0.46.el6ev.noarch rhevm-spice-client-x64-cab-3.3-8.el6_5.noarch rhevm-userportal-3.3.0-0.46.el6ev.noarch rhevm-dwh-3.3.0-29.el6ev.noarch rhevm-dbscripts-3.3.0-0.46.el6ev.noarch rhevm-reports-3.3.0-28.el6ev.noarch rhevm-sdk-java-1.0.0.29-0.1.el6ev.noarch rhevm-doc-3.3.0-3.el6eng.noarch rhevm-webadmin-portal-3.3.0-0.46.el6ev.noarch rhevm-spice-client-x86-cab-3.3-8.el6_5.noarch Ok, you are using RHEV-M 3.3, that is correct, it has support for cloud-init. The only reason I can think of that prevents using the cloud-init options in 3.3 is that the operating system isn't defined as a Linux variant. Select the VM, click the Edit button and make sure to select a Linux operating system in the Operating System list. The closer to the actual operating system the better. Then try again Run Once. To avoid making this for every VM you create, you should do the change in the template as well. By the way, please reply to the list, there may be other people interested in your same issue. -- 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 Regards Tejesh ___ Users mailing list Users@ovirt.org http://lists.ovirt.org/mailman/listinfo/users -- 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: [Users] [rhevm-api] Assign IP address to VM using Java SDK
On 02/14/2014 02:48 PM, Tejesh M wrote: CDROM is attached, but it is mounting the default iso from ISO Domain. Do you have that default CDROM explicitly attached to the VM? If so then you need to detach it. To be absolutely sure that there isn't any CDROMs from the ISO domain attached to the VM you can just put the ISO domain in maintenance, just for testing this. What version of the hypervisor are you using? On Fri, Feb 14, 2014 at 6:54 PM, Juan Hernandez jhern...@redhat.com mailto:jhern...@redhat.com wrote: On 02/14/2014 02:07 PM, Tejesh M wrote: Thanks, now i could see the cloud-init option in Run Once.. I did selected Other Linux instead of exact Linux flavor. And sorry, instead of Reply All, i clicked on Reply and sent that mail. Now, when i start VM from Run Once with Cloud-init options like Hostname Root Password, in the startup screen of VM, it show the error as attached screenshot. The messages in that screen shot mean that cloud-init is trying to locate its configuration via the network instead of inside the CDROM. So this probably means that the CDROM isn't attached correctly to the VM. Please try to find the options of the qemu-kvm command as I described in a previous mail. On Fri, Feb 14, 2014 at 5:09 PM, Juan Hernandez jhern...@redhat.com mailto:jhern...@redhat.com mailto:jhern...@redhat.com mailto:jhern...@redhat.com wrote: On 02/14/2014 12:27 PM, Tejesh M wrote: Here is the list: [root@rhevm ~]# rpm -qa 'rhevm*' rhevm-lib-3.3.0-0.46.el6ev.noarch rhevm-setup-3.3.0-0.46.el6ev.noarch rhevm-spice-client-x86-msi-3.3-8.el6_5.noarch rhevm-branding-rhev-3.3.0-1.5.el6ev.noarch rhevm-restapi-3.3.0-0.46.el6ev.noarch rhevm-3.3.0-0.46.el6ev.noarch rhevm-sdk-java-javadoc-1.0.0.29-0.1.el6ev.noarch rhevm-image-uploader-3.3.1-2.el6ev.noarch rhevm-setup-plugins-3.3.0-4.el6ev.noarch rhevm-cli-3.3.0.13-1.el6ev.noarch rhevm-log-collector-3.3.1-5.el6ev.noarch rhevm-dependencies-3.3.5-1.el6ev.noarch rhevm-spice-client-x64-msi-3.3-8.el6_5.noarch rhevm-tools-3.3.0-0.46.el6ev.noarch rhevm-sdk-python-3.3.0.21-1.el6ev.noarch rhevm-iso-uploader-3.3.0-2.el6ev.noarch rhevm-websocket-proxy-3.3.0-0.46.el6ev.noarch rhevm-backend-3.3.0-0.46.el6ev.noarch rhevm-spice-client-x64-cab-3.3-8.el6_5.noarch rhevm-userportal-3.3.0-0.46.el6ev.noarch rhevm-dwh-3.3.0-29.el6ev.noarch rhevm-dbscripts-3.3.0-0.46.el6ev.noarch rhevm-reports-3.3.0-28.el6ev.noarch rhevm-sdk-java-1.0.0.29-0.1.el6ev.noarch rhevm-doc-3.3.0-3.el6eng.noarch rhevm-webadmin-portal-3.3.0-0.46.el6ev.noarch rhevm-spice-client-x86-cab-3.3-8.el6_5.noarch Ok, you are using RHEV-M 3.3, that is correct, it has support for cloud-init. The only reason I can think of that prevents using the cloud-init options in 3.3 is that the operating system isn't defined as a Linux variant. Select the VM, click the Edit button and make sure to select a Linux operating system in the Operating System list. The closer to the actual operating system the better. Then try again Run Once. To avoid making this for every VM you create, you should do the change in the template as well. By the way, please reply to the list, there may be other people interested in your same issue. -- 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: [Users] [rhevm-api] Assign IP address to VM using Java SDK
On 02/14/2014 03:28 PM, Tejesh M wrote: Tried with disabling the ISO Domain, still it is check for network instead of mount the CDROM and my RHEV version is RHEV-H 6.5-20140121.0.el6ev Ok, that is the same version I'm testing with. Please try to connect to the hypervisor and see what is the command line of the qemu-kvm process created when you start the VM. We will also probably need to look at the VDSM log file. It is in the hypervisor, in /var/log/vdsm/vdsm.log. On Fri, Feb 14, 2014 at 7:29 PM, Juan Hernandez jhern...@redhat.com mailto:jhern...@redhat.com wrote: On 02/14/2014 02:48 PM, Tejesh M wrote: CDROM is attached, but it is mounting the default iso from ISO Domain. Do you have that default CDROM explicitly attached to the VM? If so then you need to detach it. To be absolutely sure that there isn't any CDROMs from the ISO domain attached to the VM you can just put the ISO domain in maintenance, just for testing this. What version of the hypervisor are you using? On Fri, Feb 14, 2014 at 6:54 PM, Juan Hernandez jhern...@redhat.com mailto:jhern...@redhat.com mailto:jhern...@redhat.com mailto:jhern...@redhat.com wrote: On 02/14/2014 02:07 PM, Tejesh M wrote: Thanks, now i could see the cloud-init option in Run Once.. I did selected Other Linux instead of exact Linux flavor. And sorry, instead of Reply All, i clicked on Reply and sent that mail. Now, when i start VM from Run Once with Cloud-init options like Hostname Root Password, in the startup screen of VM, it show the error as attached screenshot. The messages in that screen shot mean that cloud-init is trying to locate its configuration via the network instead of inside the CDROM. So this probably means that the CDROM isn't attached correctly to the VM. Please try to find the options of the qemu-kvm command as I described in a previous mail. On Fri, Feb 14, 2014 at 5:09 PM, Juan Hernandez jhern...@redhat.com mailto:jhern...@redhat.com mailto:jhern...@redhat.com mailto:jhern...@redhat.com mailto:jhern...@redhat.com mailto:jhern...@redhat.com mailto:jhern...@redhat.com mailto:jhern...@redhat.com wrote: On 02/14/2014 12:27 PM, Tejesh M wrote: Here is the list: [root@rhevm ~]# rpm -qa 'rhevm*' rhevm-lib-3.3.0-0.46.el6ev.noarch rhevm-setup-3.3.0-0.46.el6ev.noarch rhevm-spice-client-x86-msi-3.3-8.el6_5.noarch rhevm-branding-rhev-3.3.0-1.5.el6ev.noarch rhevm-restapi-3.3.0-0.46.el6ev.noarch rhevm-3.3.0-0.46.el6ev.noarch rhevm-sdk-java-javadoc-1.0.0.29-0.1.el6ev.noarch rhevm-image-uploader-3.3.1-2.el6ev.noarch rhevm-setup-plugins-3.3.0-4.el6ev.noarch rhevm-cli-3.3.0.13-1.el6ev.noarch rhevm-log-collector-3.3.1-5.el6ev.noarch rhevm-dependencies-3.3.5-1.el6ev.noarch rhevm-spice-client-x64-msi-3.3-8.el6_5.noarch rhevm-tools-3.3.0-0.46.el6ev.noarch rhevm-sdk-python-3.3.0.21-1.el6ev.noarch rhevm-iso-uploader-3.3.0-2.el6ev.noarch rhevm-websocket-proxy-3.3.0-0.46.el6ev.noarch rhevm-backend-3.3.0-0.46.el6ev.noarch rhevm-spice-client-x64-cab-3.3-8.el6_5.noarch rhevm-userportal-3.3.0-0.46.el6ev.noarch rhevm-dwh-3.3.0-29.el6ev.noarch rhevm-dbscripts-3.3.0-0.46.el6ev.noarch rhevm-reports-3.3.0-28.el6ev.noarch rhevm-sdk-java-1.0.0.29-0.1.el6ev.noarch rhevm-doc-3.3.0-3.el6eng.noarch rhevm-webadmin-portal-3.3.0-0.46.el6ev.noarch rhevm-spice-client-x86-cab-3.3-8.el6_5.noarch Ok, you are using RHEV-M 3.3, that is correct, it has support for cloud-init. The only reason I can think of that prevents using the cloud-init options in 3.3 is that the operating system isn't defined as a Linux variant. Select the VM, click the Edit button and make sure to select a Linux operating system in the Operating System list. The closer to the actual operating system the better. Then try again Run Once. To avoid making this for every VM you create, you should do the change in the template as well. By the way, please reply to the list, there may be other people
Re: [Users] [rhevm-api] Assign IP address to VM using Java SDK
On 02/13/2014 02:39 PM, Tejesh M wrote: Hi All, Thanks alot. I have created one VM with minimal installation installed cloud-init package. And, converted that VM into Template. Then executed the code given in http://lists.ovirt.org/pipermail/users/2014-February/021302.html , but no luck, the code is not setting root password. What version of the engine are you running? I may not have the required cloud-init support. Try to run the application in debug mode: Api api = new Api( https://whatever/api;, user@domain, password, null, null, null, null, true, null, true // - This is to enable debug mode ); It will send to the log the actual XML documents sent to the server. We can use it to see if the request is generated correctly. It may also happen that cloud-init support isn't working correctly. To verify this try to use the cloud-init support manually from webadmin. Does it work from there? Also, there is no option to set *Hostname *for the VM. To set the host name you need to add something like this: Host hostData = new Host(); hostData.setAddress(the.host.name); cloudData.setHost(hostData); _*Code:*_ /*Begin Customize VM*/ // Generate the random password, using whatever mechanism you // prefer: String password = cJql3P9XLQG4drCYVG/6Q/; // You need to know the name of the template, the cluster and // the VM you are going to create: String templateName = rhel2_temp; String clusterName = testCluster; String vmName = myvm; // 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); // Send the request to create the VM to the server: api.getVMs().add(vmDataForCreate); String state; // White till the VM is down (it will be locked for a while): for (;;) { state = api.getVMs().get(vmName).getStatus().getState(); if (down.equals(state)) { break; } Thread.sleep(1000); } System.out.println(System Status:+state); // Populate parameters for the action to start the VM with cloud-init: 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); 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); System.out.println(After : +api.getVMs().get(vmName).getStatus()); /*End Customize VM*/ Thanks Regards, Tejesh On Thu, Feb 13, 2014 at 2:26 PM, Juan Hernandez jhern...@redhat.com mailto:jhern...@redhat.com wrote: On 02/13/2014 09:29 AM, Shahar Havivi wrote: On 13.02.14 00:59, Oved Ourfalli wrote: - Original Message - From: Shahar Havivi shah...@redhat.com mailto:shah...@redhat.com To: users@ovirt.org mailto:users@ovirt.org Cc: Juan Antonio Hernandez Fernandez jhern...@redhat.com mailto:jhern...@redhat.com, rhevm-...@lists.fedorahosted.org mailto:rhevm-...@lists.fedorahosted.org, Tejesh M tejes...@gmail.com mailto:tejes...@gmail.com Sent: Wednesday, February 12, 2014 11:22:20 PM Subject: Re: [Users] [rhevm-api] Assign IP address to VM using Java SDK On 12.02.14 22:55, Itamar Heim wrote: On 02/12/2014 03:14 PM, Tejesh M wrote: Hi, Can anyone share sample code on how to assign IP address to guest os changing the root password while creating VM from Template using Java SDK? Hi Tejesh, You should start here: http://www.ovirt.org/Api This link will explain the basics for fetching VM via the API using HTTP via curl command line. Every VM have a collection of networks and manipulating
Re: [Users] [rhevm-api] Assign IP address to VM using Java SDK
On 02/13/2014 02:58 PM, Sven Kieske wrote: Hi, what cloud-init version and which OS do you run inside the vm? background: the ovirt-payload function generates an iso file from your cloud-init data and attaches this to the vm. this feature is just working if you got cloud-init = 0.7.2 inside the vm, which is not available e.g. in centos 6.5 and ubuntu 12.04. I don't know which data format the java sdk uses as default, so make sure you are passing XML, not JSON. The Java SDK always uses XML. HTH Am 13.02.2014 14:39, schrieb Tejesh M: Hi All, Thanks alot. I have created one VM with minimal installation installed cloud-init package. And, converted that VM into Template. Then executed the code given in http://lists.ovirt.org/pipermail/users/2014-February/021302.html , but no luck, the code is not setting root password. Also, there is no option to set *Hostname *for the VM. *Code:* /*Begin Customize VM*/ // Generate the random password, using whatever mechanism you // prefer: String password = cJql3P9XLQG4drCYVG/6Q/; // You need to know the name of the template, the cluster and // the VM you are going to create: String templateName = rhel2_temp; String clusterName = testCluster; String vmName = myvm; // 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); // Send the request to create the VM to the server: api.getVMs().add(vmDataForCreate); String state; // White till the VM is down (it will be locked for a while): for (;;) { state = api.getVMs().get(vmName).getStatus().getState(); if (down.equals(state)) { break; } Thread.sleep(1000); } System.out.println(System Status:+state); // Populate parameters for the action to start the VM with cloud-init: 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); 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); System.out.println(After : +api.getVMs().get(vmName).getStatus()); /*End Customize VM*/ Thanks Regards, Tejesh On Thu, Feb 13, 2014 at 2:26 PM, Juan Hernandez jhern...@redhat.com wrote: On 02/13/2014 09:29 AM, Shahar Havivi wrote: On 13.02.14 00:59, Oved Ourfalli wrote: - Original Message - From: Shahar Havivi shah...@redhat.com To: users@ovirt.org Cc: Juan Antonio Hernandez Fernandez jhern...@redhat.com, rhevm-...@lists.fedorahosted.org, Tejesh M tejes...@gmail.com Sent: Wednesday, February 12, 2014 11:22:20 PM Subject: Re: [Users] [rhevm-api] Assign IP address to VM using Java SDK On 12.02.14 22:55, Itamar Heim wrote: On 02/12/2014 03:14 PM, Tejesh M wrote: Hi, Can anyone share sample code on how to assign IP address to guest os changing the root password while creating VM from Template using Java SDK? Hi Tejesh, You should start here: http://www.ovirt.org/Api This link will explain the basics for fetching VM via the API using HTTP via curl command line. Every VM have a collection of networks and manipulating them can be seeing here with the REST API examples: http://www.ovirt.org/Features/Design/Network/SetupNetworks#REST the section for you is Attaching a network to a NIC under the REST category. Shahar Havivi. Actually it looks like Tejesh is referring to the Guests and not the hosts, so you can use cloud-init in order to do that. See more in http://www.ovirt.org/Features/Cloud-Init_Integration;. If the VM's operating system is defined as some kind of Linux, then you'll be able to set some stuff using cloud-init, either via the Run-Once Dialog, or in the regular VM properties dialog. Omer - we have REST
Re: [Users] [rhevm-api] Assign IP address to VM using Java SDK
On 02/13/2014 03:59 PM, Shahar Havivi wrote: On 13.02.14 20:17, Tejesh M wrote: 1. The Version is RHEV-M 3.3 Cloud-init is cloud-init-0.6.3-0.12.bzr532.el6.noarch 2. In Webadmin, i don't find any option to set Cloud-init data's. I checked under New VM-Initial Run.. Am i looking at the right place? How to enable cloud-init support in engine? You will not found it since you are working in 3.3 and this feature presented in 3.4. In 3.3 you can try to set the Cloud-Init via the Run-Once button. In 3.3 you need first to create the VM. Once it is created select it, click the Run Once button, then click on the plus sign next to Initial Run, check the Cloud-Init box, and populate the fields you want. I have installed cloud-init package in RHEV-M also in Template. Please suggest. On Thu, Feb 13, 2014 at 7:31 PM, Juan Hernandez jhern...@redhat.com wrote: On 02/13/2014 02:39 PM, Tejesh M wrote: Hi All, Thanks alot. I have created one VM with minimal installation installed cloud-init package. And, converted that VM into Template. Then executed the code given in http://lists.ovirt.org/pipermail/users/2014-February/021302.html , but no luck, the code is not setting root password. What version of the engine are you running? I may not have the required cloud-init support. Try to run the application in debug mode: Api api = new Api( https://whatever/api;, user@domain, password, null, null, null, null, true, null, true // - This is to enable debug mode ); It will send to the log the actual XML documents sent to the server. We can use it to see if the request is generated correctly. It may also happen that cloud-init support isn't working correctly. To verify this try to use the cloud-init support manually from webadmin. Does it work from there? Also, there is no option to set *Hostname *for the VM. To set the host name you need to add something like this: Host hostData = new Host(); hostData.setAddress(the.host.name); cloudData.setHost(hostData); _*Code:*_ /*Begin Customize VM*/ // Generate the random password, using whatever mechanism you // prefer: String password = cJql3P9XLQG4drCYVG/6Q/; // You need to know the name of the template, the cluster and // the VM you are going to create: String templateName = rhel2_temp; String clusterName = testCluster; String vmName = myvm; // 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); // Send the request to create the VM to the server: api.getVMs().add(vmDataForCreate); String state; // White till the VM is down (it will be locked for a while): for (;;) { state = api.getVMs().get(vmName).getStatus().getState(); if (down.equals(state)) { break; } Thread.sleep(1000); } System.out.println(System Status:+state); // Populate parameters for the action to start the VM with cloud-init: 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); 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); System.out.println(After : +api.getVMs().get(vmName).getStatus()); /*End Customize VM*/ Thanks Regards, Tejesh On Thu, Feb 13, 2014 at 2:26 PM, Juan Hernandez jhern...@redhat.com mailto:jhern...@redhat.com wrote: On 02/13/2014 09:29 AM, Shahar Havivi wrote: On 13.02.14 00:59, Oved Ourfalli wrote: - Original Message - From: Shahar Havivi shah...@redhat.com mailto:shah...@redhat.com To: users@ovirt.org mailto:users@ovirt.org Cc: Juan Antonio Hernandez
Re: [Users] [rhevm-api] Need help to Start and Stop VM using Java SDK
On 02/12/2014 10:08 AM, Tejesh M wrote: Thanks Juan... I'm in process of automating VM creation from Template i want to assign random root password.. can you suggest whether is it possible via java SDK? This is possible with a combination of cloud-init and the Java SDK. First you will need to create a VM manually, install the cloud-init package, and then make a template from this VM. Once you have this template you can use something like the following to create a VM from that template, and start it so that cloud-init will assign the password you want: // Generate the random password, using whatever mechanism you // prefer: String password = ...; // You need to know the name of the template, the cluster and // the VM you are going to create: String templateName = mytemplate; String clusterName = mycluster; String vmName = myvm; // Prepare the data to create the VM from the template: Template templateData = new Template(); templateData.setName(templateName); Cluster clusterData = new Cluster(); clusterData.setName(clusterName); VM vmDataForCreate = new VM(); vmDataForCreate.setName(vmName); vmDataForCreate.setCluster(clusterData); vmDataForCreate.setTemplate(templateData); // Send the request to create the VM to the server: api.getVMs().add(vmDataForCreate); // White till the VM is down (it will be locked for a while): for (;;) { String state = api.getVMs().get(vmName).getStatus().getState(); if (down.equals(state)) { break; } Thread.sleep(1000); } // Populate parameters for the action to start the VM with cloud-init: 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); 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); On Tue, Feb 11, 2014 at 9:01 PM, Juan Hernandez jhern...@redhat.com mailto:jhern...@redhat.com wrote: On 02/11/2014 04:16 PM, Itamar Heim wrote: On 02/11/2014 04:55 PM, Tejesh M wrote: Thanks for your fast response. But intelli sense is not listing vm.*start *function This is because you are using the VM class from the org.ovirt.engine.sdk.entities package, instead of from the org.ovirt.engine.sdk.decorators package. The entities package contains classes that plain containers for the data that is sent to and received from the server. The decorators package contains classes that extend those plain containers adding functionality like the action methods. I'm using rhevm-sdk-java-1.0.0.29-1.jar _*code:*_ import org.ovirt.engine.sdk.Api; import org.ovirt.engine.sdk.common.*; import org.ovirt.engine.sdk.decorators.VMDisk; import org.ovirt.engine.sdk.entities.*; import org.apache.commons.beanutils.*; public class rhvm { static Api api; public static void callAPI() { try{ api = new Api(https://rhevm:443/api;, admin@internal, password); org.ovirt.engine.sdk.entities.VM vm = api.getVMs().get(testVM3); //get VM If you want to be able to use the start method you will need something like this: org.ovirt.engine.sdk.decorators.VM vm = api.getVMs().get(testVM3); Then your IDE will show you the additional methods in the decorator, including the start method. vm.setDescription(java_sdk); System.out.print(VM ID: + vm.getStatus().getState()); System.out.print(VM ID: + vm.getId()); } catch(Exception e) { System.out.print(e); } finally { api.shutdown(); } } public static void main(String a[]) throws Exception { //rhvm obj = new rhvm(); callAPI(); System.out.println(\ncompleted); } } On Tue, Feb 11, 2014 at 8:08 PM, Ewoud Kohl van Wijngaarden ewoud+rhevm-...@kohlvanwijngaarden.nl mailto:ewoud%2brhevm-...@kohlvanwijngaarden.nl mailto:ewoud+rhevm-...@kohlvanwijngaarden.nl mailto:ewoud%2brhevm-...@kohlvanwijngaarden.nl wrote: On Tue, Feb 11, 2014 at 08:00:57PM +0530, Tejesh M wrote: Can anyone share sample on how to Start Stop VM using Java SDK? I couldn't find any document on JAVA SDK for RHEVM. While
Re: [Users] [rhevm-api] Need help to Start and Stop VM using Java SDK
On 02/11/2014 04:16 PM, Itamar Heim wrote: On 02/11/2014 04:55 PM, Tejesh M wrote: Thanks for your fast response. But intelli sense is not listing vm.*start *function This is because you are using the VM class from the org.ovirt.engine.sdk.entities package, instead of from the org.ovirt.engine.sdk.decorators package. The entities package contains classes that plain containers for the data that is sent to and received from the server. The decorators package contains classes that extend those plain containers adding functionality like the action methods. I'm using rhevm-sdk-java-1.0.0.29-1.jar _*code:*_ import org.ovirt.engine.sdk.Api; import org.ovirt.engine.sdk.common.*; import org.ovirt.engine.sdk.decorators.VMDisk; import org.ovirt.engine.sdk.entities.*; import org.apache.commons.beanutils.*; public class rhvm { static Api api; public static void callAPI() { try{ api = new Api(https://rhevm:443/api;, admin@internal, password); org.ovirt.engine.sdk.entities.VM vm = api.getVMs().get(testVM3); //get VM If you want to be able to use the start method you will need something like this: org.ovirt.engine.sdk.decorators.VM vm = api.getVMs().get(testVM3); Then your IDE will show you the additional methods in the decorator, including the start method. vm.setDescription(java_sdk); System.out.print(VM ID: + vm.getStatus().getState()); System.out.print(VM ID: + vm.getId()); } catch(Exception e) { System.out.print(e); } finally { api.shutdown(); } } public static void main(String a[]) throws Exception { //rhvm obj = new rhvm(); callAPI(); System.out.println(\ncompleted); } } On Tue, Feb 11, 2014 at 8:08 PM, Ewoud Kohl van Wijngaarden ewoud+rhevm-...@kohlvanwijngaarden.nl mailto:ewoud+rhevm-...@kohlvanwijngaarden.nl wrote: On Tue, Feb 11, 2014 at 08:00:57PM +0530, Tejesh M wrote: Can anyone share sample on how to Start Stop VM using Java SDK? I couldn't find any document on JAVA SDK for RHEVM. While this list hasn't been in use for some time, I hope I can still point you in the right direction. http://www.ovirt.org/Java-sdk#Examples has the following examples: // -- Create proxy // #1 - import import org.ovirt.engine.sdk.Api; // #2 - create proxy Api api = new Api(http://localhost:8080/api;, user@domain, password); // -- perform an action on resource // #1 - fetch resource VM vm = api.getVMs().get(test); // #2 - create params + perform an action Action res = vm.start(new Action() { { setVm(new org.ovirt.engine.sdk.entities.VM()); } }); I'd guess vm.stop is exactly the same as vm.start. ___ rhevm-api mailing list rhevm-...@lists.fedorahosted.org mailto:rhevm-...@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/rhevm-api -- Thanks Regards Tejesh ___ rhevm-api mailing list rhevm-...@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/rhevm-api moving to users@ovirt.org... thanks, Itamar ___ Users mailing list Users@ovirt.org http://lists.ovirt.org/mailman/listinfo/users -- 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: [Users] Storage server
On 02/06/2014 12:46 PM, Itamar Heim wrote: On 02/06/2014 12:43 PM, Koen Vanoppen wrote: Can I change the storagedomain ip from the ovirt-shell? Thanks in advance anything in the api should work from sdk and shell. while this falls in the storage domain, juan may know as well? In order to change the IP of the ISCSI server you need first to shutdown all the VMs. Then you need to deactivate the storage domain, and finally you can change the IP. For example, if you want to change it from 192.168.122.1 to 192.168.122.2 you can do the following: [oVirt shell (connected)]# list storageconnections --show-all id : b09b8de6-802e-4016-9c75-45e8e771ac56 address: 192.168.122.1 port : 3260 target : iqn.2014-01.com.example:example type : iscsi [oVirt shell (connected)]# update storageconnection b09b8de6-802e-4016-9c75-45e8e771ac56 --address 192.168.122.1 id : b09b8de6-802e-4016-9c75-45e8e771ac56 address: 192.168.122.1 port : 3260 target : iqn.2014-01.com.example:example type : iscsi Then you can activate the storage domain again, and start the VMs. 2014-02-06 Itamar Heim ih...@redhat.com mailto:ih...@redhat.com: On 02/06/2014 12:03 PM, Koen Vanoppen wrote: Can I change the storagedomain ip from the ovirt-shell? Thanks in advance please reply to list, thanks 2014-02-06 Itamar Heim ih...@redhat.com mailto:ih...@redhat.com mailto:ih...@redhat.com mailto:ih...@redhat.com: On 02/06/2014 05:16 AM, Koen Vanoppen wrote: It's not on DNS... The storage server in ovirt is on IP... So... What are my options in this case? you would need to 'edit the connection'. since 3.3.1 this is possible via the rest api without hacking the db: http://www.ovirt.org/Features/Manage_Storage_Connections http://www.ovirt.org/Features/__Manage_Storage_Connections http://www.ovirt.org/__Features/Manage_Storage___Connections http://www.ovirt.org/Features/Manage_Storage_Connections Thanx! Kind regards, Koen On Feb 5, 2014 9:08 AM, Itamar Heim ih...@redhat.com mailto:ih...@redhat.com mailto:ih...@redhat.com mailto:ih...@redhat.com mailto:ih...@redhat.com mailto:ih...@redhat.com mailto:ih...@redhat.com mailto:ih...@redhat.com wrote: On 02/04/2014 03:10 PM, Elad Ben Aharon wrote: Actually, the best way to do it would be to create another storage domain and migrate all the VMs's disks to it (you can do it while the VMs are running), then you won't suffer from a down time. notice this will create a snapshot for your vms and may change them from raw to qcow. also, this not supported for shared disks. If you don't have the option to do so, the best way to do it would be to shut down the VMs, put the storage domain to 'Maintenance' and then perform the storage server network change. When the connection to the storage is fixed, activate the domain and resume the VMs manually. that's assuming the domain was added using dns and not ip address, and that the dns expiration/caching on all hosts will notice the new ip address. - Original Message - From: Koen Vanoppen vanoppen.k...@gmail.com mailto:vanoppen.k...@gmail.com mailto:vanoppen.koen@gmail.__com mailto:vanoppen.k...@gmail.com mailto:vanoppen.koen@gmail. mailto:vanoppen.koen@gmail.com mailto:vanoppen.koen@gmail.__com mailto:vanoppen.k...@gmail.com To: Elad Ben Aharon ebena...@redhat.com mailto:ebena...@redhat.com mailto:ebena...@redhat.com mailto:ebena...@redhat.com mailto:ebena...@redhat.com mailto:ebena...@redhat.com mailto:ebena...@redhat.com mailto:ebena...@redhat.com__, users@ovirt.org mailto:users@ovirt.org mailto:users@ovirt.org mailto:users@ovirt.org mailto:users@ovirt.org mailto:users@ovirt.org mailto:users@ovirt.org mailto:users@ovirt.org
Re: [Users] novnc console button/ticket via REST-API?
On 01/21/2014 12:22 PM, Michal Skrivanek wrote: On Jan 21, 2014, at 11:48 , Sven Kieske s.kie...@mittwald.de wrote: Hi, we are quite impressed of the novnc console option to get access to the vms. however, we want to implement our own userportal. So is it possible to create the novnc ticket / open a vnc session with the vm event via REST-API? If yes how? setting the ticket is a VM's action ticket after that you can spawn your client and connect to the desired host/port you get from VM display's address, secureport Thanks, michal If not, how could this be achieved? To get the ticket for the VNC display you need to do the following: curl \ -k \ -X POST \ -H Accept: application/xml \ -H Content-Type: application/xml \ -d action/ \ -u admin@internal:** \ https://whatever/api/vms/your_vm_id/ticket That will return something like this: action ticket valueIKWW7PpFZhjP/value expiry7200/expiry /ticket vm href=... id=... ... /vm status statecomplete/state /status /action The ticket.value is the password for the VNC display. To connect to the display you will need also to get the host and port number from the VM details: curl \ -k \ -H Accept: application/xml \ -u admin@internal:** \ https://whatever/api/vms/your_vm_id This will return the following: vm href=... id=... ... display typevnc/type address192.168.122.20/address port5900/port ... /display ... /vm The the ticket.value, vm.display.address and vm.display.port you can complete the VNC connection. -- 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: [Users] Problem adding an IPA server to oVirt
On 01/21/2014 02:26 PM, Adam Litke wrote: On 21/01/14 12:49 +0100, Juan Hernandez wrote: On 01/20/2014 11:33 PM, Yair Zaslavsky wrote: Hi Adam, Looks like you have problems in running the Root DSE query. I would like you to try and troubleshoot by comparing this to the execution of - ldapsearch -x -h YOUR_IPA_SERVER_IP_ADDRESS -s base I think the problem is that your LDAP server is configured with a minimum security strength factor that triggers a bug in the Kerberos support in the Java virtual machine. This is a know issue. See here for details: http://gerrit.ovirt.org/21505 Thanks. Does this affect openIPA as well? I guess you mean FreeIPA. Yes, it affects any LDAP server that sets missf to 0 by default, including the the 389-ds used by FreeIPA. - Original Message - From: Adam Litke ali...@redhat.com To: users@ovirt.org Sent: Tuesday, January 21, 2014 12:12:03 AM Subject: [Users] Problem adding an IPA server to oVirt Hi, I am trying to set up an oVirt environment with an IPA provider and am hitting a GeneralException that I am unsure how to debug. I have configured freeIPA in a Fedora VM using the supplied configuration script and I can 'kinit admin' from the ovirt-engine machine. When I run the manage-domains command I get the following exception: I didn't realize it, but I had to add _kerberos srv records to my dnsmasq.conf in order for the script to even find my KDC. ./engine-manage-domains -action=add -provider=IPA -domain=alitke.net -user=admin -interactive -ldapServers=directory.alitke.net Enter password: General error has occurednull java.lang.NegativeArraySizeException at sun.security.jgss.krb5.CipherHelper.aes256Encrypt(CipherHelper.java:1367) at sun.security.jgss.krb5.CipherHelper.encryptData(CipherHelper.java:722) at sun.security.jgss.krb5.WrapToken_v2.init(WrapToken_v2.java:200) at sun.security.jgss.krb5.Krb5Context.wrap(Krb5Context.java:861) at sun.security.jgss.GSSContextImpl.wrap(GSSContextImpl.java:385) at com.sun.security.sasl.gsskerb.GssKrb5Base.wrap(GssKrb5Base.java:104) at com.sun.jndi.ldap.sasl.SaslOutputStream.write(SaslOutputStream.java:89) at com.sun.jndi.ldap.Connection.writeRequest(Connection.java:430) at com.sun.jndi.ldap.LdapClient.search(LdapClient.java:555) at com.sun.jndi.ldap.LdapCtx.doSearch(LdapCtx.java:1985) at com.sun.jndi.ldap.LdapCtx.searchAux(LdapCtx.java:1847) at com.sun.jndi.ldap.LdapCtx.c_search(LdapCtx.java:1772) at com.sun.jndi.toolkit.ctx.ComponentDirContext.p_search(ComponentDirContext.java:386) at com.sun.jndi.toolkit.ctx.PartialCompositeDirContext.search(PartialCompositeDirContext.java:356) at com.sun.jndi.toolkit.ctx.PartialCompositeDirContext.search(PartialCompositeDirContext.java:339) at javax.naming.directory.InitialDirContext.search(InitialDirContext.java:267) at org.ovirt.engine.core.ldap.RootDSEData.init(RootDSEData.java:52) at org.ovirt.engine.core.utils.kerberos.JndiAction.getDomainDN(JndiAction.java:254) at org.ovirt.engine.core.utils.kerberos.JndiAction.run(JndiAction.java:87) at java.security.AccessController.doPrivileged(Native Method) at javax.security.auth.Subject.doAs(Subject.java:356) at org.ovirt.engine.core.utils.kerberos.KerberosConfigCheck.promptSuccessfulAuthentication(KerberosConfigCheck.java:174) at org.ovirt.engine.core.utils.kerberos.KerberosConfigCheck.validateKerberosInstallation(KerberosConfigCheck.java:150) at org.ovirt.engine.core.utils.kerberos.KerberosConfigCheck.checkInstallation(KerberosConfigCheck.java:135) at org.ovirt.engine.core.domains.ManageDomains.checkKerberosConfiguration(ManageDomains.java:739) at org.ovirt.engine.core.domains.ManageDomains.testConfiguration(ManageDomains.java:909) at org.ovirt.engine.core.domains.ManageDomains.addDomain(ManageDomains.java:531) at org.ovirt.engine.core.domains.ManageDomains.runCommand(ManageDomains.java:308) at org.ovirt.engine.core.domains.ManageDomains.main(ManageDomains.java:205) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.jboss.modules.Module.run(Module.java:260) at org.jboss.modules.Main.main(Main.java:291) Failure while testing domain %1$s. Details: %2$s: One of the parameters for this error is null and no default message to show Any thoughts on what might be going wrong? -- 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 -- Dirección
Re: [Users] Register a disk image via oVirt REST api
On 01/17/2014 11:28 PM, Itamar Heim wrote: On 01/16/2014 07:21 PM, Satya Vempati wrote: I have a disk image (i.e. a file) that I want to register as a disk using the REST API. The REST API works with existing disks, but does the API work with disk images? can you pleas explain what do you mean by an image compared to a disk? I think that what you want is to take a file that you have that contains the image of a disk and create a disk in the system with the same content. As far as I know we don't have any direct way to do this. You will need to create an empty disk in oVirt, and then attach it to a virtual machine. Once it is attached to that virtual machine then you can write to it, but always via the virtual machine. For example, you can use the API as follows to create a new disk that isn't attached to any VM: curl \ -k \ -X POST \ -H Accept: application/xml \ -H Content-Type: application/xml \ -d disk namenewdisk/name size1073741824/size formatraw/format interfacevirtio/interface /disk \ -u admin@internal:** \ https://rhel.example.com/api/storagedomains/the_id_of_the_storage_domain/disks Then prepare a VM that you will use to copy the contents of your file to the new disk, and use the API to attach the new disk to this VM (you can preserve this VM, and use multiple times for this purpose): curl \ -k \ -X POST \ -H Accept: application/xml \ -H Content-Type: application/xml \ -d disk id='the_id_of_the_disk'/ \ -u admin@internal:** \ https://rhel.example.com/api/vms/the_id_of_the_vm/disks (Note that in order to attach the disk you have to provide the disk id returned by the API when you created it.) Then activate the disk, so that the VM can see it: curl \ -k \ -X POST \ -H Accept: application/xml \ -H Content-Type: application/xml \ -d action/ \ -u admin@internal:** \ https://rhel.example.com/api/vms/the_id_of_the_vm/disks/the_id_of_the_disk/activate Now you will have to copy the contents of the file to the disk via the VM. For example, assuming that you have SSH enabled on that VM and that the disk device inside the VM is /dev/vdb (it won't allways be this, depends on the number and order of attached disks) you can do something like this: ssh root@myvm 'cat /dev/vdb' myfile.img ssh root@myvm 'sync' Once the contents of the file have been copied you can deactivate the disk and detach it from this intermediate VM, and maybe attach it to another one. Take into account that all these operations are lengthy ones, specially the operation to create the disk, and that the RESTAPI will usually return once the operation is initiated, so you will need to wait till they are finished. For example, when creating the disk you should poll the state of the VM till it is ok. -- 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: [Users] engine-iso-uploader -- REST API not usable?
On 01/18/2014 07:49 PM, Ted Miller wrote: I ran into this problem when I tried to use engine-iso-uploader, but reading on the lists makes it sound like it may be a more general problem. There was a bug that caused this, but that was back in the ver. 3.0/3.1 days, and doesn't seem common since then. Back on Dec 24 I was able to upload an ISO file OK, so I am not sure what has changed since then. I am running a test setup, fully up to date: office2a host w/ glusterfs Centos 6 office4a host w/ glusterfs Centos 6 ov-eng01 engine on Centos 6 VM (not hosted on oVirt) office9 KVM host (not oVirt) for ov-eng01 whether I log in to ov-eng01 by ssh or execute the command from the console, I get: # engine-iso-uploader list -v Please provide the REST API password for the admin@internal oVirt Engine user (CTRL+D to abort): ERROR: Problem connecting to the REST API. Is the service available and does the CA certificate exist? checking on some things suggested on a thread about engine-iso-uploader back in March, I get: # ls -la /etc/pki/ovirt-engine/ca.pem -rw-r--r--. 1 root root 4569 Nov 10 15:13 /etc/pki/ovirt-engine/ca.pem # cat /var/log/ovirt-engine/ovirt-iso-uploader/ovirt-iso-uploader/20140117112938.log 2014-01-17 11:29:44::ERROR::engine-iso-uploader::512::root:: Problem connecting to the REST API. Is the service available and does the CA certificate exist? The thread back in March gave a work-around to upload ISO images directly, so I am not blocked from uploading images, but I would like to get things working right, as I am afraid the problem will turn around and bite me down the road. Ted Miller To discard an actual problem with the REST API I would suggest you to run the following command, from the same machine: # curl \ --cacert /etc/pki/ovirt-engine/ca.pem \ --user admin@internal:your_password \ https://your_host/api This should give you a XML document containing the entry point of the API, something like this: ?xml version=1.0 encoding=UTF-8 standalone=yes? api ... /api I would also suggest to check the /etc/ovirt-engine/isouploader.conf file, as you may have changed something there in the past. -- 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: [Users] connecting to oVirt/RHEV VMs through proxy and the oVirt API
On 01/17/2014 12:30 AM, i iordanov wrote: Hello, My apologies for cross-posting, but this discussion concerns both mailing lists, I think. In Opaque, I recently started setting the proxy property of SpiceSession from a console file, as is done in remote-viewer, in order to support installations where the nodes are not visible from the point of view of the client. However, then I remembered that I have not seen the proxy property being available through the oVirt/RHEV API. I looked at the latest remote-viewer code, and I looked through the oVirt/RHEV API documentation, and indeed, I see no way to get proxy information other than through the console.vv file. If I am correct, then this means that both Opaque and remote-viewer cannot connect to VMs behind a proxy unless a console.vv file is used, which also means that since console.vv files are unobtainable through the User Portal on mobile devices, mobile devices effectively cannot at all connect to such VMs if the user is not an Administrator. Would it be possible to expose the proxy parameter through the API? I couldn't find a bug opened about this, but it doesn't mean it isn't there :). Thanks! iordan You are right. Obtaining the global proxy setting is currently impossible in the API. There is no bug requesting it, as far as I know. Can you open a new one? -- 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: [Users] SPICE on OSX
On 01/17/2014 03:14 PM, Karli Sjöberg wrote: Hi Juan! I´ve read a post you made about packaging Remote-Viewer for OS X. I tested extracting and running this[1] package on a 10.7.5 machine, logging in to our webadmin portal with Firefox, clicking for console on a VM, remote-viewer starts up but doesn´t seems to load the console.vv file (the VM´s console never shows up). Is it something I´m missing? oVirt 3.3.1-2.el6 [1] http://people.freedesktop.org/~teuf/spice-gtk-osx/dmg/0.5.7/RemoteViewer-0.5.7-1.dmg I didn't make a post about that. According to the name in the URL [1] you probably wanted to contact Christophe Fergeau. -- 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: [Users] Specifying values for cert, key, and CA for ovirt-shell
On 01/09/2014 11:00 AM, noc wrote: On 8-1-2014 23:08, Bob Doolittle wrote: On 01/08/2014 04:21 PM, Joop wrote: Bob Doolittle wrote: On 01/08/2014 02:31 PM, Joop wrote: Bob Doolittle wrote: On 01/08/2014 02:17 PM, Joop wrote: Bob Doolittle wrote: Hi, I want to run ovirt-shell directly (as root) on the Engine. Presumably all the files I need for CA, key, and cert are in the /etc/pki area. But when I use the attached .ovirtshellrc file I get: error: [Errno 336265218] _ssl.c:341: error:140B0002:SSL routines:SSL_CTX_use_PrivateKey_file:system lib How can I specify an appropriate configuration to get this working? I would prefer to keep using SSL if possible. Just guessing but I don't think that your fqdn is localhost in your certs. Use your fqdn for the url variable. Good thought. But now I am getting: error: [Errno 336265225] _ssl.c:341: error:140B0009:SSL routines:SSL_CTX_use_PrivateKey_file:PEM lib Some searching indicates that my keys and certs need to be in pem format, so maybe I have to convert them before use? Any tips on how to do that? What happens if you leave out the ca_file/key_file/cert_file variables? I just played around with ovirt-shell and made a .ovirtshellrc file, on the engine, and don't remember setting these and I could login and run scripts Can't access my test environment right now so this is also a shot in the dark. That's what I tried first. I get: error: server CA certificate file must be specified for SSL secured connection. And if I don't specify https I get: error: No response returned from server. If you're using HTTP protocol against a SSL secured server, then try using HTTPS instead. OK. Here is what I did: On ovirt-engine: wget https://engine_fqdn/ca.crt --no-check-certificate and used the following .ovirtshellrc [cli] autoconnect = True autopage = True [ovirt-shell] username = admin@internal timeout = -1 extended_prompt = False url = https://engine_fqdn/api insecure = False filter = False session_timeout = -1 ca_file = /root/ca.crt dont_validate_cert_chain = False key_file = None password = ** cert_file = None Something must be different about our setups. This is where I started. In both cases, either insecure = True or when I specify the ca_file only, I get: error: [401] - Unauthorized, HTTP Status 401 The one difference is that you are using ca_file = /root/ca.crt whereas I am using ca_file = ca.pem. I can't seem to find any .crt files in the /etc/pki/ovirt-engine area (or, for that matter, in the /etc/pki/vdsm area on the node). You have missed the step where I downloaded ca.crt with wget :-) The key_file and cert_file parameters are only needed when your web server has been manually configured to require client SSL certificates, and this isn't the default configuration, so leave them with None as the value. The only SSL parameter that you need to change is ca_file, and it should contain the absolute path name of the file containing the certificate of the authority that signed the certificate of the web server. If you didn't change the SSL configuration of the web server then this file is in /etc/pki/ovirt-engine/ca.pem. So, to summarize, the parameters that you need to change are the following: url = https://your_fully_qualified_host_name/api username = admin@internal password = the_password_for_the_above_user ca_file = /etc/pki/ovirt-engine/ca.pem -- 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: [Users] Free IPA + oVirt setup fails
On 11/24/2013 01:57 AM, i iordanov wrote: Hey, I actually realized that something I wrote is inaccurate. UserB, who was not granted permission to any VM was actually able to connect to a freshly booted UserA's VM. Subsequently, UserA was unable to connect to his own VM anymore, and the error message was: Operation Failed: [user cannot force reconnect to vm] When UserB then shut down UserA's VM, UserA was able to power it on and attach to it. Subsequently, UserB was not able to connect to the VM again with the same message UserA was getting (user cannot force connect to vm). What I expected is that UserB would not see, not be able to power control, and not be able to attach at all to UserA's VM, so this behavior is quite puzzling to me! Any clarification and help would be appreciated! Thanks, iordan Here you are experiencing two security features of the engine. The first one is the multiple level administration (a.k.a. MLA). The engine organizes objets in hierarchy: a set of data centers, then inside each data center a set of clusters, and inside each cluster a set of virtual machines. When you assign a permission to a user or group you in fact assign it to one of these objects, and objects deeper in the tree inherit them. So if you assign the create vm permission to user A and the default data center, then that user will have permission to create VMs on any cluster of that data center. I guess that the two users that you initially created had the permission on the default data center or the default cluster, so they have the permissions apply to all the VMs. Try to go to the data center or cluster tabs and see if the users have permissions there, then remove them as needed. The other thing you are experiencing is the prevention of hijacking of the console of a VM. For desktop virtual machines the engine automatically remember who was the last user that connected to the console of the VM, and will not allow connections by other users. This is to protect the console. Imagine that user A opens the console of virtual machine X, then logs in to the operating system and opens its very confidential document in its favorite application. Then user B, tries to access the same console and gains access to the confidential document. To prevent this this console hijacking is disabled by default, in order to hijack the console the virtual machine X has to be first rebooted, because these guarantees that the confidential document isn't available. However, if you need to allow this console hijacking you can use a flag in the Console section of the VM properties dialog, click in Show advanced options and then you will see a Advanced parameters section that contains a Disable strict user checking checkbox. Checking that checkbox disables this behavior. Also, you can give the permission to hijack consoles to users editing their roles and adding the action VM - Administration Operations - Override opened console session. On Sat, Nov 23, 2013 at 7:50 PM, i iordanov iiorda...@gmail.com wrote: Hi Juan, On Sat, Nov 23, 2013 at 3:03 PM, Juan Hernandez jhern...@redhat.comwrote: Did you change it while the server was running? If so during stop the server will probably overwrite the file. Try to change it after stopping the server: Yes, it was absolutely because the server was running and was writing out its configuration upon being stopped. In fact modifying the file is not good practice, you may prefer to do it using LDAP: I guess this method would not have suffered from the clobbered config file :D. Thanks for the additional tip, I'm quite new to LDAP. I have just tested this in my local environment and with minssf=1 it works correctly, including the ability to search for users in the LDAP directory from the administration GUI and using those users to log in to both the administration GUI and to the user portal. I can definitely now confirm that changing minssf to 1 worked around the issue. However, I'm faced with either an issue or a misunderstanding of how things work in oVirt. I was able to add a couple of users to IPA (user A and user B) and then import them with UserRole into oVirt. What is puzzling is that both are able to see(!!) and power on/off(!) all the machines which were created by and for user admin@internal. Some of these machines are based on the Blank template and some on a different template (if that matters). Thankfully, at least the new users are unable to attach to the console of those machines. When I created a new virtual machine and in the permissions added user A as UserRole, user A now has access to the console of that VM. However, what was again puzzling is that user B can see and power on/off the new virtual machine, but at least cannot attach to the console (consistent with my previous findings). I would have thought that users would see and be able to power on/off only their own VMs, and something tells me
Re: [Users] Free IPA + oVirt setup fails
On 11/23/2013 05:36 PM, i iordanov wrote: Hi guys, I'm trying to work around the impossibility of adding local users into oVirt by setting up a FreeIPA server for my test rig... :( Everything is Fedora 19 and whatever package versions come with it. 1) I have an A-record, a PTR-record and the necessary SRV records for my server in dnsmasq on my OpenWRT router: ptr-record=60.2.168.192.in-addr.arpa,freeipa.iiordanov.com srv-host=_kerberos-master._tcp,freeipa.iiordanov.com,88,0,100 srv-host=_kerberos-master._udp,freeipa.iiordanov.com,88,0,100 srv-host=_kerberos._tcp,freeipa.iiordanov.com,88,0,100 srv-host=_kerberos._udp,freeipa.iiordanov.com,88,0,100 srv-host=_kpasswd._tcp,freeipa.iiordanov.com,464,0,100 srv-host=_kpasswd._udp,freeipa.iiordanov.com,464,0,100 srv-host=_ldap._tcp,freeipa.iiordanov.com,389,0,100 2) I have run ipa-server-install and everything completed without error. I've disabled the firewall on the server completely and the iptables chains are all clean. I've rebooted the server just in case. 3) When I try to add the IPA server to oVirt, I get a nasty error! # engine-manage-domains -action=add -domain=iiordanov.com -user=admin -provider=ipa -interactive Enter password: General error has occurednull java.lang.NegativeArraySizeException at sun.security.jgss.krb5.CipherHelper.aes256Encrypt(CipherHelper.java:1367) at sun.security.jgss.krb5.CipherHelper.encryptData(CipherHelper.java:722) at sun.security.jgss.krb5.WrapToken_v2.init(WrapToken_v2.java:200) at sun.security.jgss.krb5.Krb5Context.wrap(Krb5Context.java:861) at sun.security.jgss.GSSContextImpl.wrap(GSSContextImpl.java:385) at com.sun.security.sasl.gsskerb.GssKrb5Base.wrap(GssKrb5Base.java:104) at com.sun.jndi.ldap.sasl.SaslOutputStream.write(SaslOutputStream.java:89) at com.sun.jndi.ldap.Connection.writeRequest(Connection.java:430) at com.sun.jndi.ldap.LdapClient.search(LdapClient.java:555) at com.sun.jndi.ldap.LdapCtx.doSearch(LdapCtx.java:1985) at com.sun.jndi.ldap.LdapCtx.searchAux(LdapCtx.java:1847) at com.sun.jndi.ldap.LdapCtx.c_search(LdapCtx.java:1772) at com.sun.jndi.toolkit.ctx.ComponentDirContext.p_search(ComponentDirContext.java:386) at com.sun.jndi.toolkit.ctx.PartialCompositeDirContext.search(PartialCompositeDirContext.java:356) at com.sun.jndi.toolkit.ctx.PartialCompositeDirContext.search(PartialCompositeDirContext.java:339) at javax.naming.directory.InitialDirContext.search(InitialDirContext.java:267) at org.ovirt.engine.core.ldap.RootDSEData.init(RootDSEData.java:52) at org.ovirt.engine.core.utils.kerberos.JndiAction.getDomainDN(JndiAction.java:257) at org.ovirt.engine.core.utils.kerberos.JndiAction.run(JndiAction.java:87) at java.security.AccessController.doPrivileged(Native Method) at javax.security.auth.Subject.doAs(Subject.java:356) at org.ovirt.engine.core.utils.kerberos.KerberosConfigCheck.promptSuccessfulAuthentication(KerberosConfigCheck.java:174) at org.ovirt.engine.core.utils.kerberos.KerberosConfigCheck.validateKerberosInstallation(KerberosConfigCheck.java:150) at org.ovirt.engine.core.utils.kerberos.KerberosConfigCheck.checkInstallation(KerberosConfigCheck.java:135) at org.ovirt.engine.core.domains.ManageDomains.checkKerberosConfiguration(ManageDomains.java:746) at org.ovirt.engine.core.domains.ManageDomains.testConfiguration(ManageDomains.java:917) at org.ovirt.engine.core.domains.ManageDomains.addDomain(ManageDomains.java:539) at org.ovirt.engine.core.domains.ManageDomains.runCommand(ManageDomains.java:311) at org.ovirt.engine.core.domains.ManageDomains.main(ManageDomains.java:206) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.jboss.modules.Module.run(Module.java:260) at org.jboss.modules.Main.main(Main.java:291) Failure while testing domain %1$s. Details: %2$s: One of the parameters for this error is null and no default message to show Can anybody spot the trouble here? Any help is appreciated! This is an issue that we have already detected with OpenLDAP, and it looks like at least two users (including you) are experiencing it with IPA as well, maybe something changed in a recent versions of IPA. I believe this is related to the setting of the minimum security strength factor in the LDAP server. I have proposed a change to make the error from engine-manage-domains more explicit: http://gerrit.ovirt.org/21505 However this doesn't fix the issue, just makes it easier (hopefully) to detect. I would really appreciate if you can test to change the minssf parameter in your LDAP server. Locate the following parameter in the
Re: [Users] Free IPA + oVirt setup fails
On 11/23/2013 07:36 PM, i iordanov wrote: Hi Juan, I found the setting in the file you pointed me to: nsslapd-minssf: 0 I changed it to 1, but as soon as I restart the ipa service with: systemctl restart ipa or reboot it reverts back to 0! Why is this happening? Did you change it while the server was running? If so during stop the server will probably overwrite the file. Try to change it after stopping the server: # systemctl stop dirsrv@YOUR-REALM # sed -r -i 's/^(nsslapd-minssf):.*$/\1: 1/' /etc/dirsrv/slapd-YOUR-REALM/dse.ldif # systemctl start dirsrv@YOUR-REALM In fact modifying the file is not good practice, you may prefer to do it using LDAP: # cat fixssf.ldif . dn: cn=config replace: nsslapd-minssf nsslapd-minssf: 1 - . # ldapmodify -H ldap://your.ldap.server -D 'cn=Directory Manager' -x -w your_directory_manager_password -f fixssf.ldif I have just tested this in my local environment and with minssf=1 it works correctly, including the ability to search for users in the LDAP directory from the administration GUI and using those users to log in to both the administration GUI and to the user portal. -- 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: [Users] openldap
On 11/18/2013 12:17 PM, Jonas Israelsson wrote: On 17/10/13 17:22, Juan Hernandez wrote: On 10/17/2013 05:15 PM, Itamar Heim wrote: On 10/17/2013 09:57 AM, Jonas Israelsson wrote: I saw that openldap is now listed as a provider when invoking engine-manage-domains. I'm eager to find more information about this. Does anyone know if there is any updated documentation floating around somewhere ? Found this: http://www.ovirt.org/LDAP_Quick_Start But the article seem only half-finished. Rgds Jonas this may help you. https://bugzilla.redhat.com/show_bug.cgi?id=967327#c4 https://bugzilla.redhat.com/show_bug.cgi?id=967327#c5 help finishing the wiki would be great... thanks, Itamar I am attaching slightly updated notes on how to configure OpenLDAP and Kerberos for both Fedora and RHEL/CentOS. I just updated the wiki with the latest version of the instructions that I use. I think they work. Any enhancement is welcome. Anyone knows if ovirt is able to handle that the kdc and directory service are running on separate hosts ? In my environment this is the case where the kdc is located at a service with it's own name/IP (admin.elementary.se), and the directory-service on ldap.elementary.se. Even though I see both names are resolved by a name server lookup a network sniffer trace shows that later (ldap.elementary.se) used for both kerberos and ldap access. By default oVirt uses the Kerberos and LDAP servers that are provided by DNS. Can you please check what is the result of the following DNS query? # dig -t SRV _kerberos._tcp.elementary.se Furthermore this (incorrect) configuration file is created [libdefaults] default_realm = ELEMENTARY.SE dns_lookup_realm = false dns_lookup_kdc = false ticket_lifetime = 24h renew_lifetime = 7d forwardable = no default_tkt_enctypes = arcfour-hmac-md5 udp_preference_limit = 1 [realms] ELEMENTARY.SE = { kdc = ldap.elementary.se } [domain_realm] elementary.se = ELEMENTARY.SE In my lab both these services are actually placed on the same physical server and since the kdc binds to all local interfaces ovirt actually does reach the kdc via the incorrect name, this is however not the case later in production. This file is generated from the above mentioned DNS queries. Please let us know what is the content of your SRV DNS records. When trying to add the domain it crashes with the following stack trace General error has occurednull java.lang.NegativeArraySizeException at sun.security.jgss.krb5.CipherHelper.aes256Encrypt(CipherHelper.java:1367) at sun.security.jgss.krb5.CipherHelper.encryptData(CipherHelper.java:722) at sun.security.jgss.krb5.WrapToken_v2.init(WrapToken_v2.java:200) at sun.security.jgss.krb5.Krb5Context.wrap(Krb5Context.java:861) at sun.security.jgss.GSSContextImpl.wrap(GSSContextImpl.java:385) at com.sun.security.sasl.gsskerb.GssKrb5Base.wrap(GssKrb5Base.java:104) at com.sun.jndi.ldap.sasl.SaslOutputStream.write(SaslOutputStream.java:89) at com.sun.jndi.ldap.Connection.writeRequest(Connection.java:430) at com.sun.jndi.ldap.LdapClient.search(LdapClient.java:555) at com.sun.jndi.ldap.LdapCtx.doSearch(LdapCtx.java:1985) at com.sun.jndi.ldap.LdapCtx.searchAux(LdapCtx.java:1847) at com.sun.jndi.ldap.LdapCtx.c_search(LdapCtx.java:1772) at com.sun.jndi.toolkit.ctx.ComponentDirContext.p_search(ComponentDirContext.java:386) at com.sun.jndi.toolkit.ctx.PartialCompositeDirContext.search(PartialCompositeDirContext.java:356) at com.sun.jndi.toolkit.ctx.PartialCompositeDirContext.search(PartialCompositeDirContext.java:339) at javax.naming.directory.InitialDirContext.search(InitialDirContext.java:267) at org.ovirt.engine.core.ldap.RootDSEData.init(RootDSEData.java:52) at org.ovirt.engine.core.utils.kerberos.JndiAction.getDomainDN(JndiAction.java:257) at org.ovirt.engine.core.utils.kerberos.JndiAction.run(JndiAction.java:87) at java.security.AccessController.doPrivileged(Native Method) at javax.security.auth.Subject.doAs(Subject.java:356) at org.ovirt.engine.core.utils.kerberos.KerberosConfigCheck.promptSuccessfulAuthentication(KerberosConfigCheck.java:174) at org.ovirt.engine.core.utils.kerberos.KerberosConfigCheck.validateKerberosInstallation(KerberosConfigCheck.java:150) at org.ovirt.engine.core.utils.kerberos.KerberosConfigCheck.checkInstallation(KerberosConfigCheck.java:135) at org.ovirt.engine.core.domains.ManageDomains.checkKerberosConfiguration(ManageDomains.java:746) at org.ovirt.engine.core.domains.ManageDomains.testConfiguration(ManageDomains.java:917) at org.ovirt.engine.core.domains.ManageDomains.addDomain(ManageDomains.java:539) at org.ovirt.engine.core.domains.ManageDomains.runCommand
Re: [Users] engine-manage-domains fails when re-adding a domain
On 11/13/2013 10:11 PM, Junk wrote: Hi I was having odd issues with my IPA domain so rather than troubleshoot it properly I thought it would be a good idea to remove it and then add it again. I removed it with engine-manage-domains -action=delete -domain=clarkconnect.lan and when I try to add it with engine-manage-domains -action=add -domain=clarkconnect.lan -user=admin -provider=IPA -interactive which worked fine the first time I get General error has occurednull java.lang.NegativeArraySizeException at sun.security.jgss.krb5.CipherHelper.aes256Encrypt(CipherHelper.java:1367) at sun.security.jgss.krb5.CipherHelper.encryptData(CipherHelper.java:722) at sun.security.jgss.krb5.WrapToken_v2.init(WrapToken_v2.java:200) at sun.security.jgss.krb5.Krb5Context.wrap(Krb5Context.java:861) at sun.security.jgss.GSSContextImpl.wrap(GSSContextImpl.java:385) at com.sun.security.sasl.gsskerb.GssKrb5Base.wrap(GssKrb5Base.java:104) at com.sun.jndi.ldap.sasl.SaslOutputStream.write(SaslOutputStream.java:89) at com.sun.jndi.ldap.Connection.writeRequest(Connection.java:430) at com.sun.jndi.ldap.LdapClient.search(LdapClient.java:555) at com.sun.jndi.ldap.LdapCtx.doSearch(LdapCtx.java:1985) at com.sun.jndi.ldap.LdapCtx.searchAux(LdapCtx.java:1847) at com.sun.jndi.ldap.LdapCtx.c_search(LdapCtx.java:1772) at com.sun.jndi.toolkit.ctx.ComponentDirContext.p_search(ComponentDirContext.java:386) at com.sun.jndi.toolkit.ctx.PartialCompositeDirContext.search(PartialCompositeDirContext.java:356) at com.sun.jndi.toolkit.ctx.PartialCompositeDirContext.search(PartialCompositeDirContext.java:339) at javax.naming.directory.InitialDirContext.search(InitialDirContext.java:267) at org.ovirt.engine.core.ldap.RootDSEData.init(RootDSEData.java:52) at org.ovirt.engine.core.utils.kerberos.JndiAction.getDomainDN(JndiAction.java:257) at org.ovirt.engine.core.utils.kerberos.JndiAction.run(JndiAction.java:87) at java.security.AccessController.doPrivileged(Native Method) at javax.security.auth.Subject.doAs(Subject.java:356) at org.ovirt.engine.core.utils.kerberos.KerberosConfigCheck.promptSuccessfulAuthentication(KerberosConfigCheck.java:174) at org.ovirt.engine.core.utils.kerberos.KerberosConfigCheck.validateKerberosInstallation(KerberosConfigCheck.java:150) at org.ovirt.engine.core.utils.kerberos.KerberosConfigCheck.checkInstallation(KerberosConfigCheck.java:135) at org.ovirt.engine.core.domains.ManageDomains.checkKerberosConfiguration(ManageDomains.java:746) at org.ovirt.engine.core.domains.ManageDomains.testConfiguration(ManageDomains.java:917) at org.ovirt.engine.core.domains.ManageDomains.addDomain(ManageDomains.java:539) at org.ovirt.engine.core.domains.ManageDomains.runCommand(ManageDomains.java:311) at org.ovirt.engine.core.domains.ManageDomains.main(ManageDomains.java:206) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.jboss.modules.Module.run(Module.java:260) at org.jboss.modules.Main.main(Main.java:291) Failure while testing domain %1$s. Details: %2$s: One of the parameters for this error is null and no default message to show in the engine-manage-domains.log I get 2013-11-13 20:53:41,318 INFO [org.ovirt.engine.core.domains.ManageDomains] Creating kerberos configuration for domain(s): clarkconnect.lan 2013-11-13 20:53:41,525 INFO [org.ovirt.engine.core.domains.ManageDomains] Successfully created kerberos configuration for domain(s): clarkconnect.lan 2013-11-13 20:53:41,526 INFO [org.ovirt.engine.core.domains.ManageDomains] Testing kerberos configuration for domain: clarkconnect.lan 2013-11-13 20:53:48,718 ERROR [org.ovirt.engine.core.domains.ManageDomains] Failure while testing domain %1$s. Details: %2$s: One of the parameters for this error is null and no default message to show any ideas? Junk We have seen a similar issue with OpenLDAP that required to set the minimum security strength factor (SSF) to 1 instead of the default 0. This default triggers a bug in the Java virtual machine Kerberos support. IPA uses the 389 directory server, and it also has the possibility to configure this, as described here: http://directory.fedoraproject.org/wiki/Minimum_SSF_Setting To check that you can run a query like this in your IPA installation: # kinit admin # ldapsearch \ -H ldap://your_ipa_server \ -Y GSSAPI \ -LLL \ -b 'cn=config' \ -s base \ nsslapd-minssf The output will probably be like this: dn: cn=config nsslapd-minssf: 0 The important thing there is the value 0. You can try to change it to
Re: [Users] openldap
On 10/17/2013 05:15 PM, Itamar Heim wrote: On 10/17/2013 09:57 AM, Jonas Israelsson wrote: I saw that openldap is now listed as a provider when invoking engine-manage-domains. I'm eager to find more information about this. Does anyone know if there is any updated documentation floating around somewhere ? Found this: http://www.ovirt.org/LDAP_Quick_Start But the article seem only half-finished. Rgds Jonas this may help you. https://bugzilla.redhat.com/show_bug.cgi?id=967327#c4 https://bugzilla.redhat.com/show_bug.cgi?id=967327#c5 help finishing the wiki would be great... thanks, Itamar I am attaching slightly updated notes on how to configure OpenLDAP and Kerberos for both Fedora and RHEL/CentOS. -- 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. This are instructions to setup an environment for testing authentication of ovirt-engine with OpenLDAP. All the instructions are based on Fedora 18 and assume that the name of the domain is f19.example.com and that the name of the realm is F19.EXAMPLE.COM. 1. Install the OpenLDAP server and clients: # yum -y install openldap-{clients,servers} # yum -y install cyrus-sasl-gssapi 2. Start and enable the OpenLDAP service: # systemctl start slapd # systemctl enable slapd 3. Add the cosine and inetorgperson schemas: # ldapadd -H ldapi:/// -Y EXTERNAL -f /etc/openldap/schema/cosine.ldif # ldapadd -H ldapi:/// -Y EXTERNAL -f /etc/openldap/schema/inetorgperson.ldif 4. Add the memberof overlay: # cat memberof.ldif '.' dn: cn={0}module,cn=config objectClass: olcModuleList cn: {0}module olcModulePath: /usr/lib64/openldap olcModuleLoad: {0}memberof.la dn: olcOverlay={0}memberof,olcDatabase={2}hdb,cn=config objectClass: olcConfig objectClass: olcMemberOf objectClass: olcOverlayConfig objectClass: top olcOverlay: {0}memberof . # ldapadd -H ldapi:/// -Y EXTERNAL -f memberof.ldif 5. Create a password for the directory administrator (I used example123): # slappasswd New password: Re-enter new password: {SSHA}0EAIzAxRBMZ1LP/XAhq4q80DLpNpDzr2 6. Change the suffix and the credentians of the directory manager: # cat config.ldif '.' dn: cn=config replace: olcSaslSecProps olcSaslSecProps: noanonymous,noplain,minssf=1 - dn: olcDatabase={2}hdb,cn=config changetype: modify replace: olcSuffix olcSuffix: dc=f19,dc=example,dc=com - replace: olcRootDN olcRootDN: cn=Manager,dc=f19,dc=example,dc=com - replace: olcRootPW olcRootPW: {SSHA}0EAIzAxRBMZ1LP/XAhq4q80DLpNpDzr2 - . # ldapmodify -H ldapi:/// -Y EXTERNAL -f config.ldif 7. Create the top level structure of the directory, with a branch for users and another for groups: # cat structure.ldif '.' dn: dc=f19,dc=example,dc=com objectClass: dcObject objectClass: organization dc: f19 o: F19 Example Inc. dn: ou=Users,dc=f19,dc=example,dc=com objectClass: organizationalUnit ou: Users dn: ou=Groups,dc=f19,dc=example,dc=com objectClass: organizationalUnit ou: Groups . # ldapadd -H ldapi:/// -D 'cn=Manager,dc=f19,dc=example,dc=com' -x -W -f structure.ldif 8. Create some users: # cat users.ldif '.' dn: uid=user0,ou=Users,dc=f19,dc=example,dc=com objectclass: inetOrgPerson objectclass: uidObject uid: user0 cn: User2 givenName: User title: User mail: us...@f19.example.com sn: 0 dn: uid=user1,ou=Users,dc=f19,dc=example,dc=com objectclass: inetOrgPerson objectclass: uidObject uid: user1 cn: User1 givenName: User title: User mail: us...@f19.example.com sn: 1 . Note that the users don't need to have a memberof attribute, as this will be calculated and assigned by the memberof overlay when the group is created or modified. # ldapadd -H ldapi:/// -D 'cn=Manager,dc=f19,dc=example,dc=com' -x -W -f users.ldif 9. Create some groups: # cat groups.ldif '.' dn: cn=Group0,ou=Groups,dc=f19,dc=example,dc=com objectclass: groupOfNames cn: Group0 member: uid=user0,ou=Users,dc=f19,dc=example,dc=com member: uid=user1,ou=Users,dc=f19,dc=example,dc=com . # ldapadd -H ldapi:/// -D 'cn=Manager,dc=f19,dc=example,dc=com' -x -W -f groups.ldif Once this is done the directory should return the memberOf attributes when quering users: # ldapsearch -H ldapi:/// -b 'dc=f19,dc=example,dc=com' -x '(uid=user0)' memberOf -LLL dn: uid=user0,ou=Users,dc=f19,dc=example,dc=com memberOf: cn=Group0,ou=Groups,dc=f19,dc=example,dc=com 10. Install the kerberos server packages: # yum -y install krb5-{workstation,server} 11. Adjust the /etc/krb5.conf file, should be something like this: [logging] default = FILE:/var/log/krb5libs.log kdc = FILE:/var/log/krb5kdc.log admin_server = FILE:/var/log/kadmind.log [libdefaults] dns_lookup_realm = false ticket_lifetime = 24h renew_lifetime = 7d forwardable = true default_realm = F19.EXAMPLE.COM [realms] F19.EXAMPLE.COM = { kdc = f19.example.com admin_server = f19.example.com } [domain_realm] .f19.example.com = F19.EXAMPLE.COM f19.example.com =
Re: [Users] 3.3 Nightly Built July 31st: Still problems with gwt.rpc
On 08/01/2013 10:48 AM, Hans-Joachim wrote: Hello, I'm just installing 3.3 Nightly as of July 31st on my CentOS 6.4 server. When I try to login to the Web I got 'Error 500' Here the part of server.log .. 2013-08-01 10:40:05,098 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/webadmin]] (ajp--127.0.0.1-8702-6) Exception while dispatching incoming RPC call: java.lang.SecurityException: Blocked request without GWT base path header (XSRF attack?) at com.google.gwt.rpc.server.RpcServlet.getClientOracle(RpcServlet.java:95) [gwt-servlet.jar:] at com.google.gwt.rpc.server.RpcServlet.processPost(RpcServlet.java:205) [gwt-servlet.jar:] at com.google.gwt.user.server.rpc.AbstractRemoteServiceServlet.doPost(AbstractRemoteServiceServlet.java:62) [gwt-servlet.jar:] at javax.servlet.http.HttpServlet.service(HttpServlet.java:754) [jboss-servlet-api_3.0_spec-1.0.0.Final.jar:1.0.0.Final] ... Hans-Joachim Actually this isn't a problem with GWT RPC, but with the redirection that is performed from / to /ovirt-engine in the web server. You probably ended up with the following URL: https://whatever/ovirt-engine/webadmin/webadmin/WebAdmin.html This adds an extra ovirt-engine path element to the request, that the server side doesn't expect, so it assumes that there is a XSFR attach going on. Type an URL like this manually in the browser and it should work: https://whatever/webadmin/webadmin/WebAdmin.html -- 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: [Users] [Feedback required][host-deploy] Fedora-19 misses tar at minimal setup
On 07/28/2013 09:46 AM, Alon Bar-Lev wrote: Hello All, I would like to receive feedback regarding how we should cope with a state presented to use by Fedora. Fedora-19 minimal setup does not install tar utility which is required to deploy files during the host-deploy process (Hosts-Add Host). I guess because of 2.8M in size (including translations) -- a standard commonly used utility was removed. There are two alternatives : 1. Instruct users who are using minimal installations to manually install tar utility just like they configure repository, dns, etc.. Benefit: simplicity. Benefit: use standard tools. Benefit: lower payload to transmit. Drawback: require tar at destination machine. 2. Do not use tar but self extracting python script, a patch is ready[1]. Benefit: ability to deploy environment in which tar is missing. Drawback: non standard tool at destination machine. Drawback: complexity within our code. [[[ There was 3rd alternative, using python tar module to deploy tar. However, there is a bug in that module when processing last block if empty. This is edge condition but happened to at least one of the users and I could reproduce it. ]]] Regards, Alon Bar-Lev Consider using cpio instead of tar. It is required to build initrd, so available in any installation. It is also supported by the library currently used in the engine to build the tar archive. -- 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: [Users] alias to user and admin portal
On 05/07/2013 10:40 AM, Andrej Bagon wrote: Hi, what is the best practice to make a hostname alias for user and admin web portal? By default the admin portal is on hostname/webadmin/webadmin/WebAdmin.html and user portal on hostname/UserPortal/org.ovirt.engine.ui.userportal.UserPortal/UserPortal.html what are the best directives (apache) to run the applications on adminportal.hostname and userportal.hostname? Thank you. Best Regards, Andrej If you want something simple you can enable virtual hosts in the /etc/httpd/conf/httpd.conf file adding the following directive: NameVirtualHost *:80 Then you can create three virtual hosts, one to preserve the default behaviour, one for the userportal and one for webadmin, for example creating /etc/httpd/conf.d/00-default-vhost.conf, /etc/httpd/conf.d/01-userportal-vhost.conf and /etc/httpd/conf.d/02-webadmin-vhost.conf with the following content: # 00-default-vhost.conf VirtualHost *:80 ServerName hostname /VirtualHost # 01-userportal-vhost.conf VirtualHost *:80 ServerName webadmin.hostname RewriteEngine on RewriteRule / https://r6.example.com/webadmin/webadmin/WebAdmin.html [redirect] /VirtualHost # 02-webadmin-vhost.conf VirtualHost *:80 ServerName userportal.hostname RewriteEngine on RewriteRule / https://hostname/UserPortal/org.ovirt.engine.ui.userportal.UserPortal/UserPortal.html [redirect] /VirtualHost -- 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: [Users] Getting the following error when creating rpm on CentOS
On 03/29/2013 07:29 AM, qyddbear wrote: Hi, I am trying to create a rpm using ovirt-engine-3.1.0-3.26.3.el6.centos.alt.src.rpm on CentOS 6.3. After ran rpmbuild -ba ovirt-engine.spec, I got error message like this: Version 3.1.0 is not prepared to be built on CentOS. If you want to build it you will need to apply the patches prepared by Dreyou: http://www.dreyou.org/ovirt/ Or you can use version 3.2.1 which already includes similar changes. *** Deploying service # Install the files: install -dm 755 /root/rpmbuild/BUILDROOT/ovirt-engine-3.1.0-3.26.3.el6.x86_64/usr/share/ovirt-engine/service install -m 644 packaging/fedora/engine-service.xml.in /root/rpmbuild/BUILDROOT/ovirt-engine-3.1.0-3.26.3.el6.x86_64/usr/share/ovirt-engine/service install -m 644 packaging/fedora/engine-service-logging.properties /root/rpmbuild/BUILDROOT/ovirt-engine-3.1.0-3.26.3.el6.x86_64/usr/share/ovirt-engine/service install -m 755 packaging/fedora/engine-service.py /root/rpmbuild/BUILDROOT/ovirt-engine-3.1.0-3.26.3.el6.x86_64/usr/share/ovirt-engine/service install -m 644 packaging/fedora/engine-service.sysconfig /root/rpmbuild/BUILDROOT/ovirt-engine-3.1.0-3.26.3.el6.x86_64/etc/sysconfig/ovirt-engine install -m 644 packaging/fedora/engine-service.limits /root/rpmbuild/BUILDROOT/ovirt-engine-3.1.0-3.26.3.el6.x86_64/etc/security/limits.d/10-ovirt-engine.conf install -m 755 packaging/fedora/engine-service.systemv /root/rpmbuild/BUILDROOT/ovirt-engine-3.1.0-3.26.3.el6.x86_64/etc/rc.d/init.d/ovirt-engine # Install the links: ln -s /usr/share/ovirt-engine/service/engine-service.py /root/rpmbuild/BUILDROOT/ovirt-engine-3.1.0-3.26.3.el6.x86_64/usr/bin/engine-service + install -dm 755 /root/rpmbuild/BUILDROOT/ovirt-engine-3.1.0-3.26.3.el6.x86_64//var/lib/ovirt-engine/deployments + install -dm 755 /root/rpmbuild/BUILDROOT/ovirt-engine-3.1.0-3.26.3.el6.x86_64//var/lib/ovirt-engine/content + install -dm 755 /root/rpmbuild/BUILDROOT/ovirt-engine-3.1.0-3.26.3.el6.x86_64//var/log/ovirt-engine/notifier /root/rpmbuild/BUILDROOT/ovirt-engine-3.1.0-3.26.3.el6.x86_64//var/log/ovirt-engine/engine-manage-domains + install -dm 755 /root/rpmbuild/BUILDROOT/ovirt-engine-3.1.0-3.26.3.el6.x86_64//var/run/ovirt-engine/notifier + install -dm 755 /root/rpmbuild/BUILDROOT/ovirt-engine-3.1.0-3.26.3.el6.x86_64//var/lock/ovirt-engine + for war in restapi userportal webadmin + sed -i 's#transport-guaranteeNONE/transport-guarantee#transport-guaranteeCONFIDENTIAL/transport-guarantee#' /root/rpmbuild/BUILDROOT/ovirt-engine-3.1.0-3.26.3.el6.x86_64/usr/share/ovirt-engine/engine.ear/restapi.war/WEB-INF/web.xml + for war in restapi userportal webadmin + sed -i 's#transport-guaranteeNONE/transport-guarantee#transport-guaranteeCONFIDENTIAL/transport-guarantee#' /root/rpmbuild/BUILDROOT/ovirt-engine-3.1.0-3.26.3.el6.x86_64/usr/share/ovirt-engine/engine.ear/userportal.war/WEB-INF/web.xml + for war in restapi userportal webadmin + sed -i 's#transport-guaranteeNONE/transport-guarantee#transport-guaranteeCONFIDENTIAL/transport-guarantee#' /root/rpmbuild/BUILDROOT/ovirt-engine-3.1.0-3.26.3.el6.x86_64/usr/share/ovirt-engine/engine.ear/webadmin.war/WEB-INF/web.xml + for pom in '/root/rpmbuild/BUILDROOT/ovirt-engine-3.1.0-3.26.3.el6.x86_64/usr/share/maven2/poms/*.pom' ++ dirname /root/rpmbuild/BUILDROOT/ovirt-engine-3.1.0-3.26.3.el6.x86_64/usr/share/maven2/poms/ovirt-engine-backend.pom + pomdir=/root/rpmbuild/BUILDROOT/ovirt-engine-3.1.0-3.26.3.el6.x86_64/usr/share/maven2/poms ++ basename /root/rpmbuild/BUILDROOT/ovirt-engine-3.1.0-3.26.3.el6.x86_64/usr/share/maven2/poms/ovirt-engine-backend.pom + pom=ovirt-engine-backend.pom + jpppom=JPP.ovirt-engine-backend.pom + mv /root/rpmbuild/BUILDROOT/ovirt-engine-3.1.0-3.26.3.el6.x86_64/usr/share/maven2/poms/ovirt-engine-backend.pom /root/rpmbuild/BUILDROOT/ovirt-engine-3.1.0-3.26.3.el6.x86_64/usr/share/maven2/poms/JPP.ovirt-engine-backend.pom ++ sed -e 's/^ovirt-engine-//' -e 's/\.pom//' ++ echo ovirt-engine-backend.pom + artifact_id=backend + '[' -f /root/rpmbuild/BUILDROOT/ovirt-engine-3.1.0-3.26.3.el6.x86_64/usr/share/java/ovirt-engine/backend.jar ']' + %add_maven_depmap JPP.ovirt-engine-backend.pom /var/tmp/rpm-tmp.hR92jC: line 86: fg: no job control error: Bad exit status from /var/tmp/rpm-tmp.hR92jC (%install) RPM build errors: Bad exit status from /var/tmp/rpm-tmp.hR92jC (%install) And here is rpm-tmp.hR92jC: #!/bin/sh RPM_SOURCE_DIR=/root/rpmbuild/SOURCES RPM_BUILD_DIR=/root/rpmbuild/BUILD RPM_OPT_FLAGS=-O2 -g RPM_ARCH=x86_64 RPM_OS=linux export RPM_SOURCE_DIR RPM_BUILD_DIR RPM_OPT_FLAGS RPM_ARCH RPM_OS RPM_DOC_DIR=/usr/share/doc export RPM_DOC_DIR RPM_PACKAGE_NAME=ovirt-engine RPM_PACKAGE_VERSION=3.1.0 RPM_PACKAGE_RELEASE=3.26.3.el6 export RPM_PACKAGE_NAME RPM_PACKAGE_VERSION RPM_PACKAGE_RELEASE LANG=C export LANG unset CDPATH DISPLAY ||: RPM_BUILD_ROOT=/root/rpmbuild/BUILDROOT/ovirt-engine-3.1.0-3.26.3.el6.x86_64