Comment 0 for bug 1642383

Revision history for this message
Stephen A. Zarkos (stevez) wrote :

I'm following the instructions to send cloud-config and repartition the ephemeral disk in Azure: https://wiki.ubuntu.com/AzureSwapPartitions. These instructions fail on Ubuntu 14.04 and 16.04 (did not test 12.04 yet).

Repro:

1) Add the following content to a file such as customdata.txt:

 #cloud-config
 disk_setup:
     ephemeral0:
         table_type: mbr
         layout: [66, [33, 82]]
         overwrite: True
 fs_setup:
     - device: ephemeral0.1
       filesystem: ext4
     - device: ephemeral0.2
       filesystem: swap
 mounts:
     - ["ephemeral0.1", "/mnt2"]
     - ["ephemeral0.2", "none", "swap", "sw", "0", "0"]

2) Create a VM in Azure with this cloud-config:

 $ azure group create ubtest 'east us'

 $ azure vm create ubtest ubtest-1604 Linux --image-urn canonical:UbuntuServer:16.04.0-LTS:latest --admin-username azureuser --admin-password '<PASSWORD>' --nic-name ubtest-1604 --location "East US" --vnet-name "ubtest" --vnet-address-prefix "10.0.0.0/24" --vnet-subnet-name "ubtest" --vnet-subnet-address-prefix "10.0.0.0/24" --public-ip-name "ubtest" --public-ip-domain-name "ubtest" --custom-data ./customdata.txt

Expected Result:

 - /dev/disk/cloud/azure_resource should have two partitions; one ext4 and a second swap
 - /dev/disk/cloud/azure_resource-part1 should be mounted on /mnt2
 - /dev/disk/cloud/azure_resource-part2 should be active swap space
 - /etc/fstab should be configured correctly

Actual Results:

 - /dev/disk/cloud/azure_resource-part1 is properly mounted on /mnt2.
 - On Ubuntu 14.04, /dev/disk/cloud/azure_resource is re-partitioned as expected.
 - On Ubuntu 16.04, /dev/disk/cloud/azure_resource is *not* re-partitioned. There is only a single partition (no swap space).
 - On Ubuntu 14.04 and 16.04, /etc/fstab includes an incorrect entry for the swap space:

   ephemeral0.2 none swap sw,comment=cloudconfig 0 0

This clearly won't work, it should resolve to "/dev/disk/cloud/azure_resource-part2". I do notice that on Ubuntu 14.04, the ephemeral disk is re-partitioned correctly, but there is no symlink in /dev/disk/azure/ to the second partition. These symlinks are created by /lib/udev/rules.d/66-azure-ephemeral.rules. Perhaps cloud-init needs to re-trigger this udev rule after repartitioning the disk.

FYI, I also tested with the latest cloud-init that is currently in xenial-proposed (0.7.8-47-gb6561a1-0ubuntu1~16.04.1) with the same results.