From 129f7836fd61fab69d7c8d9eeb77c6da7393ab46 Mon Sep 17 00:00:00 2001 From: David Scott Date: Sun, 15 May 2016 18:17:55 +0100 Subject: [PATCH] mobyconfig: on Hyper-V connect to the db over AF_HYPERV We detect Hyper-V by the presence of /sys/bus/vmbus and then run the /sbin/9pmount-vsock command to establish a socket connection and then pass the fd to /bin/mount This patch also hard-codes the database directory com.docker.driver.amd64-linux since we can't use the kernel commandline on Hyper-V hosts. It would probably be better to expose a generic directory name ( / ?) on all platforms and configure the datbase to store each VM's configuration in a different directory. Signed-off-by: David Scott --- alpine/packages/mobyconfig/mobyconfig | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/alpine/packages/mobyconfig/mobyconfig b/alpine/packages/mobyconfig/mobyconfig index e22ba3ab6..fdbfdb06f 100755 --- a/alpine/packages/mobyconfig/mobyconfig +++ b/alpine/packages/mobyconfig/mobyconfig @@ -12,16 +12,15 @@ then exit 1 fi -if ! cat /proc/cmdline | grep -q 'com.docker.database' -then - printf "Could not find database configuration information\n" 1>&2 - exit 1 -fi - if [ ! -d /Database ] then mkdir -p /Database - mount -t 9p -o trans=virtio,dfltuid=1001,dfltgid=50,version=9p2000 db /Database + if [ -d /sys/bus/vmbus ]; then + # Running on a Hyper-V hypervisor + /sbin/9pmount-vsock listen db /Database + else + mount -t 9p -o trans=virtio,dfltuid=1001,dfltgid=50,version=9p2000 db /Database + fi if [ $? -ne 0 ] then rm -rf /Database @@ -30,7 +29,7 @@ then fi fi -DATABASE="$(cat /proc/cmdline | sed -e 's/.*com.docker.database="//' -e 's/".*//')" +DATABASE="com.docker.driver.amd64-linux" BASE="/Database/branch/master/ro/${DATABASE}" KEY=$(echo $2 | sed 's@^/@@')