Good news, we can easily integrate libcloud to run in OpenNebula. It is a piece of cake.
from libcloud.compute.types import Provider
from libcloud.compute.providers import get_driver
cloudManagerAPI = get_driver( Provider.OPENNEBULA )
c = cloudManagerAPI( user, pass, host=hostName,port=portNumber, secure=False )
i = c.list_images()[5]
n = c.ex_list_networks()[1]
s= c.list_sizes()[2]
c.create_node( name = vmName, size=s, image=i, networks=n, context={ 'var' : 'test' })
The only "but" is the number of disks, but default libcloud assumes there is only one disk to be mounted. We would need to hack a bit libcloud as we need two disks at the moment ( one HDD plus another with the contextualization scripts )
disk = ET.SubElement(compute, 'DISK')
ET.SubElement(disk,
'STORAGE',
{'href': '/storage/%s' % (str(kwargs['image'].id))})
disk = ET.SubElement(compute, 'DISK')
if not isinstance(kwargs['image'], list):
kwargs['image'] = [kwargs['image']]
for image in kwargs[ 'image' ]:
ET.SubElement(disk,
'STORAGE',
{'href': '/storage/%s' % (str(image.id))})