
may be done in two ways, either through CloudMonkey or through the UI.
Via CloudMonkey, the script must be assigned encoded in base64 format
(because of CloudMonkey’s architecture design, a base64 script may have up
to 32768 characters, or, 32KB size), with the userdata= parameter, followed by
the script encoded.
Example of assigning a user data script via CloudMonkey:
(localcloud) > deploy/update virtualmachine [...] userdata=IyEvYmluL2Jhc2gKCmVjaG8gInVzZXJkYXR
hIHRlc3QgLSAkKGRhdGUpIiA+IC90bXAvdXNlcmRhdGE=
The script above decoded:
#!/bin/bash
echo "userdata test - $(date)" > /tmp/userdata
Notice that [...] was only used to improve the visualization of the user data
script parameter, removing all other mandatory parameters.
The updateVirtualMachine API used in example the above, besides changing
the boot settings, can also be used to change other settings, such as memory
values, number of CPUs and CPU speed. Therefore, to prevent other settings
from being changed by the final user, it is necessary to add some values in the
global setting user.vm.denied.details.
These values are the settings names, comma separated. For example, to
block a user from changing the settings for memory and CPU, the setting must
have the following value: cpuNumber, cpuSpee d, memory. It is important to
highlight that the default value for this setting is: rootdisksize, cpu O v e r c o m m i
tRatio, memoryOvercommitRatio, Message.ReservedCapacityFreed.Flag.
Via UI, the user data script may be added manually, through the text field
available at the Manual Userdata Entr y tab, or by selecting a pre-configured
script, available at the Stored userdata tab. When added through the text field,
the base64 encoding is not needed, because CloudStack encodes the script
when its sent to the back-end.
If the script was introduced as a stored user data, the imposed limit is 3069
94