[Users] Related to python script for Attach Cd (.iso) to a vm
Michael Pasternak
mpastern at redhat.com
Mon Nov 5 05:55:28 UTC 2012
On 11/05/2012 07:51 AM, Michael Pasternak wrote:
> Hi Romil,
>
> In general you can use api guide [1] for this, anyway here is example:
>
> 1. create vm
> ============
> ...
>
> 2. insert cdrom
> ===============
>
> vm = api.vms.get(name="myvm")
> cdrom = vm.cdroms.get(id="00000000-0000-0000-0000-000000000000")
> isofile = params.File(id="myiso.iso")
> cdrom.set_file(isofile)
> cdrom.update()
>
> 3. change boot order (to boot from cdrom and then from hd)
> ==========================================================
>
> os=params.OperatingSystem(boot=[params.Boot(dev='cdrom'), params.Boot(dev='hd')], ...)
> api.vms.add(params.VM(name='myvm2',
> os=os,
> cluster=api.clusters.get('mycluster'),
> template=api.templates.get('mytemplate')))
use this ^ example for #1, or update boot order using same semantics
on existent vm.
>
> 4. run vm
> =========
> ...
>
> [1] https://access.redhat.com/knowledge/docs/en-US/Red_Hat_Enterprise_Virtualization/3.1-Beta/html-single/Developer_Guide/index.html#sect-REST_API_Guide-Example-Attach_CDROM
--
Michael Pasternak
RedHat, ENG-Virtualization R&D
More information about the Users
mailing list