summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Watkins <daniel.watkins@canonical.com>2015-07-21 13:06:11 +0100
committerDaniel Watkins <daniel.watkins@canonical.com>2015-07-21 13:06:11 +0100
commit3aeec2dd6460fbdd3b8f217ad8aa231acb4bfd45 (patch)
tree3be4ff63902ce168869d4deb2b4fdbadf02ccf63
parent9461b1235f7278440ffb84f1e3d95b3f906e444b (diff)
downloadvyos-cloud-init-3aeec2dd6460fbdd3b8f217ad8aa231acb4bfd45.tar.gz
vyos-cloud-init-3aeec2dd6460fbdd3b8f217ad8aa231acb4bfd45.zip
Add udev rules for Azure ephemeral disks.
And install them in the Debian packaging.
-rw-r--r--packages/debian/dirs1
-rwxr-xr-xsetup.py2
-rw-r--r--udev/66-azure-ephemeral.rules18
3 files changed, 21 insertions, 0 deletions
diff --git a/packages/debian/dirs b/packages/debian/dirs
index f3de468d..9a633c60 100644
--- a/packages/debian/dirs
+++ b/packages/debian/dirs
@@ -3,3 +3,4 @@ usr/bin
etc/init
usr/share/doc/cloud
etc/cloud
+lib/udev/rules.d
diff --git a/setup.py b/setup.py
index e88d9e88..5f61681b 100755
--- a/setup.py
+++ b/setup.py
@@ -84,6 +84,7 @@ INITSYS_TYPES = sorted(list(INITSYS_ROOTS.keys()))
USR = "/usr"
ETC = "/etc"
USR_LIB_EXEC = "/usr/lib"
+LIB = "/lib"
if os.uname()[0] == 'FreeBSD':
USR = "/usr/local"
USR_LIB_EXEC = "/usr/local/lib"
@@ -167,6 +168,7 @@ else:
[f for f in glob('doc/examples/*') if is_f(f)]),
(USR + '/share/doc/cloud-init/examples/seed',
[f for f in glob('doc/examples/seed/*') if is_f(f)]),
+ (LIB + '/udev/rules.d', ['udev/66-azure-ephemeral.rules']),
]
# Use a subclass for install that handles
# adding on the right init system configuration files
diff --git a/udev/66-azure-ephemeral.rules b/udev/66-azure-ephemeral.rules
new file mode 100644
index 00000000..b9c5c3ef
--- /dev/null
+++ b/udev/66-azure-ephemeral.rules
@@ -0,0 +1,18 @@
+# Azure specific rules
+ACTION!="add|change", GOTO="cloud_init_end"
+SUBSYSTEM!="block", GOTO="cloud_init_end"
+ATTRS{ID_VENDOR}!="Msft", GOTO="cloud_init_end"
+ATTRS{ID_MODEL}!="Virtual_Disk", GOTO="cloud_init_end"
+
+# Root has a GUID of 0000 as the second value
+# The resource/resource has GUID of 0001 as the second value
+ATTRS{device_id}=="?00000000-0000-*", ENV{fabric_name}="azure_root", GOTO="ci_azure_names"
+ATTRS{device_id}=="?00000000-0001-*", ENV{fabric_name}="azure_resource", GOTO="ci_azure_names"
+GOTO="cloud_init_end"
+
+# Create the symlinks
+LABEL="ci_azure_names"
+ENV{DEVTYPE}=="disk", SYMLINK+="disk/cloud/$env{fabric_name}"
+ENV{DEVTYPE}=="partition", SYMLINK+="disk/cloud/$env{fabric_name}-part%n"
+
+LABEL="cloud_init_end"