Friday, August 12, 2011

VM creation using Python for XenServer

I tried for 4-5 days to create a VM for XenServer using Python and finally I am able to create a VM for XEN. Here I am going to tell you the basic steps needed to be performed to do the operations.

VM creation involves 3 things in common.
1. Creation of VM.
2. Creation of disk referred as VDI.
3. Creation of VBD which acts as a link between VM and Disk.
(Network card is the other optional thing which can be added.. for that you need VIF)

So, In the code, I have first created a Disk, then created a VM, and then passed both as parameters while creating VBD which will attach Disk to the VM. Here is the code:-

1 comment:

  1. Getting following Error

    Traceback (most recent call last):
    File "test.py", line 5, in
    record_hh=session.xenapi.host.get_record(hh[0])
    IndexError: list index out of range

    ReplyDelete