Re: [Users] Fwd: API usage - 3.1

Hi Tom,
-------- Original Message -------- Subject: [Users] API usage - 3.1 Date: Fri, 11 Jan 2013 16:27:03 +0000 From: Tom Brown <tom@ng23.net> To: users <users@ovirt.org>
Trying to get going adding VM's via the API and so far have managed to get quite far - I am however facing this
vm_template = """<vm> <name>%s</name> <cluster> <name>Default</name> </cluster> <template> <name>Blank</name> </template> <vm_type>server</vm_type> <memory>536870912</memory> <os> <boot dev="hd"/> </os> </vm>"""
The VM is created but the type ends up being a desktop and not a server -
What did i do wrong?
the name of the element is <type> (not <vm_type>).
thanks _______________________________________________ Users mailing list Users@ovirt.org http://lists.ovirt.org/mailman/listinfo/users
-- Michael Pasternak RedHat, ENG-Virtualization R&D

On 01/14/2013 01:12 PM, Tom Brown wrote:
the name of the element is <type> (not <vm_type>).
Many thanks - got it
Can i also ask is it possible to set an iso to boot from, the boot order and also the console type and if so what are those elements called?
1. you can find elements names in api schema (download it from [1] on your rhevm server). 2. vm creation details/examples can be found at [2]. [1] http://server:[port]/api?schema [2] https://access.redhat.com/knowledge/docs/en-US/Red_Hat_Enterprise_Virtualiza...
cheers
-- Michael Pasternak RedHat, ENG-Virtualization R&D

--Apple-Mail=_D334F1C7-2C4E-4041-9F48-EAD680C4FF9D Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=iso-8859-1
=20 1. you can find elements names in api schema (download it from [1] on = your rhevm server). 2. vm creation details/examples can be found at [2]. =20 [1] http://server:[port]/api?schema [2] = https://access.redhat.com/knowledge/docs/en-US/Red_Hat_Enterprise_Virtuali= zation/3.1/pdf/Developer_Guide/Red_Hat_Enterprise_Virtualization-3.1-Devel= oper_Guide-en-US.pdf =20
thankyou - i am however finding it hard to attach an iso image to a VM - = I have the console etc sorted however what would be required to do the = same with an iso image? The below is working apart from the iso thanks vm_template =3D """<vm> <name>%s</name> <cluster> <name>Default</name> </cluster> <template> <name>Blank</name> </template> <type>server</type> <memory>536870912</memory> <display> <type>vnc</type> </display> <os> <boot dev=3D"hd"/> <boot dev=3D"cdrom"/> </os> <cdrom> <cdrom id=3D"cobbler-base.iso"/> </cdrom> </vm>""" --Apple-Mail=_D334F1C7-2C4E-4041-9F48-EAD680C4FF9D Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=iso-8859-1 <html><head></head><body style=3D"word-wrap: break-word; = -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; = "><div><br><blockquote type=3D"cite"><div><br>1. you can find elements = names in api schema (download it from [1] on your rhevm server).<br>2. = vm creation details/examples can be found at [2].<br><br>[1] <a = href=3D"http://server:[port]/api?schema">http://server:[port]/api?schema</= a><br>[2] <a = href=3D"https://access.redhat.com/knowledge/docs/en-US/Red_Hat_Enterprise_= Virtualization/3.1/pdf/Developer_Guide/Red_Hat_Enterprise_Virtualization-3= .1-Developer_Guide-en-US.pdf">https://access.redhat.com/knowledge/docs/en-= US/Red_Hat_Enterprise_Virtualization/3.1/pdf/Developer_Guide/Red_Hat_Enter= prise_Virtualization-3.1-Developer_Guide-en-US.pdf</a><br><font = class=3D"Apple-style-span" = color=3D"#007427"><br></font></div></blockquote><br></div><div>thankyou = - i am however finding it hard to attach an iso image to a VM - I have = the console etc sorted however what would be required to do the same = with an iso image?</div><div><br></div><div>The below is working apart = from the = iso</div><div><br></div><div>thanks</div><div><br></div><div><div>vm_templ= ate =3D = """<vm></div><div><name>%s</name></div><div><cluster&= gt;</div><div> = <name>Default</name></div><div></cluster></div><div><= template></div><div> = <name>Blank</name></div><div></template></div><div><t= ype>server</type></div><div><memory>536870912</memory>= ;</div><div><display></div><div> = <type>vnc</type></div><div></display></div><div><os&g= t;</div><div> <boot dev=3D"hd"/></div><div> <boot = dev=3D"cdrom"/></div><div></os></div><div><cdrom></div><div=
<cdrom = id=3D"cobbler-base.iso"/></div><div></cdrom></div><div></vm>= ;"""</div></div><br></body></html>=
--Apple-Mail=_D334F1C7-2C4E-4041-9F48-EAD680C4FF9D--

--Apple-Mail=_7A777383-4E9A-4CC7-A77A-EB58DA0323B9 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=iso-8859-1 >>=20 >=20 > thankyou - i am however finding it hard to attach an iso image to a VM = - I have the console etc sorted however what would be required to do the = same with an iso image? >=20 > The below is working apart from the iso >=20 > thanks >=20 > vm_template =3D """<vm> > <name>%s</name> > <cluster> > <name>Default</name> > </cluster> > <template> > <name>Blank</name> > </template> > <type>server</type> > <memory>536870912</memory> > <display> > <type>vnc</type> > </display> > <os> > <boot dev=3D"hd"/> > <boot dev=3D"cdrom"/> > </os> > <cdrom> > <cdrom id=3D"cobbler-base.iso"/> > </cdrom> > </vm>""" >=20 i have also tried=20 <cdrom > <file id=3D"rhel-server-6.0-x86_64-dvd.iso"/> </cdrom > as per the docs but no joy=20= --Apple-Mail=_7A777383-4E9A-4CC7-A77A-EB58DA0323B9 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=iso-8859-1 <html><head></head><body style=3D"word-wrap: break-word; = -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; = "><div><blockquote type=3D"cite"><div style=3D"word-wrap: break-word; = -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; = "><div><blockquote type=3D"cite"><div><font class=3D"Apple-style-span" = color=3D"#007427"><br></font></div></blockquote><br></div><div>thankyou = - i am however finding it hard to attach an iso image to a VM - I have = the console etc sorted however what would be required to do the same = with an iso image?</div><div><br></div><div>The below is working apart = from the = iso</div><div><br></div><div>thanks</div><div><br></div><div><div>vm_templ= ate =3D = """<vm></div><div><name>%s</name></div><div><cluster&= gt;</div><div> = <name>Default</name></div><div></cluster></div><div><= template></div><div> = <name>Blank</name></div><div></template></div><div><t= ype>server</type></div><div><memory>536870912</memory>= ;</div><div><display></div><div> = <type>vnc</type></div><div></display></div><div><os&g= t;</div><div> <boot dev=3D"hd"/></div><div> <boot = dev=3D"cdrom"/></div><div></os></div><div><cdrom></div><div= > <cdrom = id=3D"cobbler-base.iso"/></div><div></cdrom></div><div></vm>= ;"""</div></div><br></div></blockquote></div><br><div>i have also = tried </div><div><br></div><div> =09 =09 =09 <div class=3D"column"><p><span style=3D"font-size: = 10.000000pt; font-family: 'LiberationMono'"><cdrom ><br> <file id=3D"rhel-server-6.0-x86_64-dvd.iso"/></span></p><p><span = class=3D"Apple-style-span" style=3D"font-family: LiberationMono; = font-size: 13px; "></cdrom ></span></p><p><span = class=3D"Apple-style-span" style=3D"font-family: LiberationMono; = font-size: 13px; ">as per the docs but no joy </span></p> </div></div></body></html>= --Apple-Mail=_7A777383-4E9A-4CC7-A77A-EB58DA0323B9--

Hi Tom, On 01/15/2013 05:43 PM, Tom Brown wrote:
thankyou - i am however finding it hard to attach an iso image to a VM - I have the console etc sorted however what would be required to do the same with an iso image?
The below is working apart from the iso
thanks
vm_template = """<vm> <name>%s</name> <cluster> <name>Default</name> </cluster> <template> <name>Blank</name> </template> <type>server</type> <memory>536870912</memory> <display> <type>vnc</type> </display> <os> <boot dev="hd"/> <boot dev="cdrom"/> </os> <cdrom> <cdrom id="cobbler-base.iso"/> </cdrom> </vm>"""
i have also tried
<cdrom > <file id="rhel-server-6.0-x86_64-dvd.iso"/>
</cdrom >
as per the docs but no joy
cdroms is a sub-collection of vm, you have to: 1. create vm 2. insert cd in to cdrom (this is done via updating cdrom) 3. run vm specifying CD as first boot device i'd also suggest you looking in to the sdk (python/java), you may find it easier than working with api directly over http.
-- Michael Pasternak RedHat, ENG-Virtualization R&D

cdroms is a sub-collection of vm, you have to:
1. create vm 2. insert cd in to cdrom (this is done via updating cdrom) 3. run vm specifying CD as first boot device
based on my previous posts i dont suppose you have a working example do you as i am having great difficulty making it work how i would imagine. I can create the VM fine, set the boot order and have the console all correct, its just 'attaching' the iso that is the issue.
i'd also suggest you looking in to the sdk (python/java), you may find it easier than working with api directly over http.
if i were starting from scratch you may well be correct, its just this is a small piece of some larger orchestration and its all a bit too embedded as is to start to rework it at this time. thanks

Tom, You'll want to the PUT method to attach an ISO to the cdrom drive. Here is a link to the relevant RHEV API documentation: https://access.redhat.com/knowledge/docs/en-US/Red_Hat_Enterprise_Virtualiza... Tony On Thu, Jan 17, 2013 at 11:35 AM, Tom Brown <tom@ng23.net> wrote:
cdroms is a sub-collection of vm, you have to:
1. create vm 2. insert cd in to cdrom (this is done via updating cdrom) 3. run vm specifying CD as first boot device
based on my previous posts i dont suppose you have a working example do you as i am having great difficulty making it work how i would imagine. I can create the VM fine, set the boot order and have the console all correct, its just 'attaching' the iso that is the issue.
i'd also suggest you looking in to the sdk (python/java), you may find it easier than working with api directly over http.
if i were starting from scratch you may well be correct, its just this is a small piece of some larger orchestration and its all a bit too embedded as is to start to rework it at this time.
thanks
_______________________________________________ Users mailing list Users@ovirt.org http://lists.ovirt.org/mailman/listinfo/users
participants (3)
-
Anthony James
-
Michael Pasternak
-
Tom Brown