KVM Context not executing

Created a template for KVM nodes that has a START_SCRIPT = “#!/bin/bash
mkdir /root/test”
It does other things like extended the disk and distributing the storage to the LVMs…

The problem is that the script is never executed. I can see the context shell script created on the host node under the VM directory but I do not see it in the virtual machine /tmp/one-context directory nor do I see any logs when I instantiate the VM from Sunstone UI.

Am I missing something?
things I tried:

  • converting the script and passing a base64,
  • adding /tmp/var along side another directory into safe directory because i changed it to another directory where my packer images are.

Versions of the related components and OS (frontend, hypervisors, VMs):
OpenNebula 5.4 on CentOS7.3 1611 with KVM nodes

Steps to reproduce:
CONTEXT = [
CRYPTED_PASSWORD_BASE64 = “JDEkb3Blbm5lYnUkM0FXZFJsbFV6UlRjbjRnR281SnhyLgo=”,
DNS = “$NETWORK[DNS, NAME=“Public”]”,
DNS_HOSTNAME = “YES”,
HOSTNAME = “sj-mgt”,
IP_GEN = “10.0.0.$VMID”,
IP_PRIVATE = “$NIC[IP]”,
NETWORK = “YES”,
REGISTER_DNS = “YES”,
REPORT_READY = “YES”,
START_SCRIPT = “#!/bin/bash
mkdir /root/test
echo ‘XFS Formating:’
mkfs.xfs /dev/vdb;
echo -e ‘o\nn\np\n\n\n\nt\n\n8e\nw’ | fdisk /dev/vda
partprobe
pvcreate /dev/vda3
#vgdisplay
vgextend vg_system /dev/vda3
#pvscan
lvextend -l 40%FREE /dev/vg_system/var
lvextend -l 100%FREE /dev/vg_system/root
xfs_growfs /dev/vg_system/var
xfs_growfs /dev/vg_system/root” ]
CPU = “4”
DISK = [
DEV_PREFIX = “vd”,
IMAGE = “centos-7.3-1611”,
IMAGE_UNAME = “oneadmin”,
SIZE = “51200” ]
DISK = [
DEV_PREFIX = “vd”,
DRIVER = “qcow2”,
IMAGE = “empty-disk-local”,
IMAGE_UNAME = “oneadmin”,
SIZE = “51200” ]
GRAPHICS = [
LISTEN = “0.0.0.0”,
TYPE = “VNC” ]
HYPERVISOR = “kvm”
LABELS = “mgt,centos73”
LOGO = “images/logos/centos.png”
MEMORY = “32768”
NIC = [
NETWORK = “Global-Network”,
NETWORK_UNAME = “oneadmin”,
SECURITY_GROUPS = “0” ]
NIC_DEFAULT = [
MODEL = “virtio” ]
OS = [
ARCH = “x86_64” ]
USER_INPUTS = [
CPU = “O|fixed|| |4”,
MEMORY = “O|fixed|| |32768”,
VCPU = “O|fixed|| |4” ]
VCPU = “4”

Current results:
Context Script never ran

Expected results:
Bash script should have instantiated upon a VM start or provisionning

I believe I found my answer… one-context rpm must be installed on the OS of the image and not the Host ! :slight_smile: