-
Notifications
You must be signed in to change notification settings - Fork 14
Vm template development
This guide considers that the code of Expedient, VT AM and Agent was already modified accordingly. In order to integrate a new VM template with OFELIA LDAP and address schema, these are the steps to follow:
-
In
src/python/plugins/vt_plugin/controller/VMcontroller/VMcontroller.py
add the new VM case:if instance.disc_image == 'IMAGE_NAME': instance.operatingSystemType = 'GNU/Linux' instance.operatingSystemVersion = '7.0' instance.operatingSystemDistribution = 'Debian' instance.hdOriginPath = "PATH_TO_TAMPLATE_IMAGE" instance.virtualization_setup_type = "hvm"
-
In
./src/python/plugins/vt_plugin/models/VM.py
: Change de following definitions accordingly
DISC_IMAGE_CHOICES = ( ('default','Default'), ('spirent','Spirent'), ('irati','IRATI'), ) HD_SETUP_TYPE_CHOICES = ( ('file-image','File Image'), #('logical-volume-image','Logical Volume'), ('full-file-image','File Image with Partitions'), ) VIRTUALIZATION_SETUP_TYPE_CHOICES = ( ('paravirtualization','Paravirtualization'), ('hvm','HVM'), ) ```
-
In
./views/templates/default/vt_plugin_aggregate_add_virtualmachines.html
: If you need to restrict the available options for the new vm add a case for it:} else if ($("#id_disc_image").val() == "irati") { $("#id_hdSetupType").val("full-file-image"); $("#id_virtualizationSetupType").val("hvm"); $("#id_memory").val("1024"); $("#id_hdSetupType").prop("disabled","disabled"); $("#id_virtualizationSetupType").prop("disabled","disabled");
-
In
./src/python/vt_manager/models/XenVM.py
: Add the configurator if an specific one is needed:
IMAGE_CONFIGURATORS = { 'default/default.tar.gz':'', 'irati/irati.img':'IratiDebianVMConfigurator', 'spirent/spirentSTCVM.img':'SpirentCentOSVMConfigurator', } ```
##In the OFELIA XEN AGENT (OXA)
-
In
/src/python/agent/xen/provisioning/hdmanagers/
Develope or modify a new HD Manager (/src/python/agent/xen/provisioning/hdmanagers/) and/or VM configurator and Xen config template file (/src/python/agent/xen/provisioning/configurators/) -
Update the VMConfigurator file
(xen/provisioning/VMConfigurator.py)
with your new Configurator:
if configurator and configurator != "": if configurator == MediacatVMConfigurator.getIdentifier(): return MediacatVMConfigurator; elif configurator == IratiDebianVMConfigurator.getIdentifier(): return IratiDebianVMConfigurator; elif configurator == SpirentCentOSVMConfigurator.getIdentifier(): return SpirentCentOSVMConfigurator; elif configurator == DebianWheezyVMConfigurator.getIdentifier(): return DebianWheezyVMConfigurator ```
-
If the image you want add is using the FileFullHdManager
(xen/provisioning/hdmanagers/FileFullHdManager.py)
, you may want to configure the offset of your image:
if vm.xen_configuration.configurator == IratiDebianVMConfigurator.getIdentifier(): FileFullHdManager.subprocessCall('/bin/mount -o loop,offset=44040192 '+str(vm_path)+" "+str(path)) ```
- Convert the VM image to
.img
format - If you want to use some Debian distro, you may create it through Xen...:
xen-create-image --hostname <hostname> --ip <ip> [ --vcpus 2 --pygrub \
--dist <lenny|squeeze|maverick|whatever> --size=<size>Gb \
--swap=<size>Gb --netmask=<netmask> --memory=<size>Mb \
--gateway=<gateway> --force ]
- ...And convert with the
dd
tool:
dd if=/dev/vserv/<vm_name>-disk of=<vm_name>.img
- Mount the VM image
- If you want to run it through Xen:
```
xm create /etc/xen/<vm_name>.cfg
```
For the config file to work you shall define the routes to the physical files `<vm_name>.img` and `<vm_name>_swap.img` first. You can use the config file generated in step _1.i_ for inspiration
- Install ldap module:
apt-get install pam_ldap
- Replace the following files of the new image with the ones of a default OFELIA image:
/etc/pam.d
/etc/pam.conf
/etc/nsswitch.conf
-
/etc/nslcd.conf
(this one may be missing) /etc/nscd.conf
- Create ofelia/users folder:
mkdir -p /ofelia/users
- Edit
/etc/resolv.conf
to have only https://ldap.ibbt.fp7-ofelia.eu - Empty any logs or existing users if desired
- Unmount, i.e. stop the image at Xen
- Use the existing
.img
file as your new template
- Overview
- Experimenting
-
Administering
- Installing
- Upgrading
-
Configuration
- Components
- Infrastructure
- Troubleshooting
- Theme manager
-
Contributing
- Developing
-
Reporting
- Issue tracker and Roadmap