Add config drive support to the cloudstack VM. When config drive is selected all the user VM related data is placed in ISO disk and attached to VM.
Support attaching config drive to cloudstack VM. When dhcp service is used external to the cloudstack, config drive provides way for accessing vm data inside the user vm.
If user data and password services are needed, then the templates needs to be configured with UserData and password scripts.
TODO: Scripts locations will be updated similar to the existing password scripts
Config drive is an ISO attached to VM with files containing data includes userdata, metadata, password and ssh key.
On vm starting cloudstack creates an ISO with the vm data files and attach this iso to the VM in read only.
Once the VM boot up the iso can be mounted inside the VM. Using scripts the data inside the VM will be accessed.
For each VM an ISO will be created. One user VM can't have access to other user VM config drive ISO.
Config drive ISO device is created by-label. So the device and device number can be attached as below.
The default label is 'config' and it can be updated from the global settings "vm.configdrive.label".
Note: If "vm.configdrive.label" updated, make sure the same name is used in the user vm config drive scripts.
Device:
/dev/disk/by-label/config
DeviceId: Device can be found using blkid command
#blkid -t LABEL='config'
/dev/xvdb: LABEL="config" TYPE="iso9660"
Note:
If your guest operating system does not use udev
, the /dev/disk/by-label
directory is not present.
You can use the blkid command to identify the block device that corresponds to the configuration drive.
#mount /dev/disk/by-label/config /mnt/
mount: block device /dev/disk/by-label/config is write-protected, mounting read-only
[root@localhost ~]# cd /mnt/
[root@localhost mnt]# ls
cloudstack
Config drive contents:
[root@localhost mnt]# ls -lR
.:
total 1474
dr-xr-xr-x 1 root root 2048 Mar 10 07:13 cloudstack
./cloudstack:
total 4
dr-xr-xr-x 1 root root 2048 Mar 10 07:13 metadata
dr-xr-xr-x 1 root root 2048 Mar 10 07:13 password
./cloudstack/metadata:
total 3
-r-xr-xr-x 1 root root 5 Mar 10 10:23 availability_zone.txt
-r-xr-xr-x 1 root root 49 Mar 10 10:23 cloud_identifier.txt
-r-xr-xr-x 1 root root 9 Mar 10 10:23 instance_id.txt
-r-xr-xr-x 1 root root 9 Mar 10 10:23 local_hostname.txt
-r-xr-xr-x 1 root root 14 Mar 10 10:23 service_offering.txt
-r-xr-xr-x 1 root root 2 Mar 10 10:23 vm_id.txt
./cloudstack/password:
total 1
-r-xr-xr-x 1 root root 14 Mar 10 10:23 vm_password.txt
[root@localhost mnt]#
Once the windows VM is up and running ISO is mounted automatically. User can browse attached ISO inside the VM.
From this drive, user can access the UserData.
The password enabled template with the script inside the template, will automatically sets the VM password.
Note: The public location of the scripts for userdata/password are provided for download.
In network offering a new config drive provider get added. Config drive provider is for differentiating with VR for user data service.
When config driver provider is selected for user data in network offering, config drive is created for the user data.
As part of the VM deployment network creation process router won't be created for this network, if there are no services provided by the network.
ISO will be created in the MS with the userdata and password files.
mkisofs binaries should be available in the MS
mkisofs -iso-level 3 -V "config" -o <vmInternalName>.iso <isopath>;
No DB changes.
Network offering creation page will be updated to select 'config drive' for user data.
There are no upgrade changes. This feature works with fresh deployments.