diff --git a/configs/stage3_ubuntu/opt/mlab/bin/write-metadata.sh b/configs/stage3_ubuntu/opt/mlab/bin/write-metadata.sh index 4e0ef13..9e2ab7a 100755 --- a/configs/stage3_ubuntu/opt/mlab/bin/write-metadata.sh +++ b/configs/stage3_ubuntu/opt/mlab/bin/write-metadata.sh @@ -10,3 +10,22 @@ mkdir -p $METADATA_DIR # Write the kernel version uname -r | tr -d '\n' > $METADATA_DIR/kernel-version + +# Write out the metadata value for "managed". This will allow data users to know +# what environment the test was run. For a "full" site M-Lab manages both the +# machine and an upstream switch. For "minimal" deployments M-Lab only manages +# the machine, and nothing upstream. +PREFIX_LEN=$(egrep -o 'epoxy.ipv4=[^ ]+' /proc/cmdline | cut -d= -f2 | cut -d, -f1 | cut -d/ -f 2) +case "$PREFIX_LEN" in + 26) + MANAGED="switch,machine" + ;; + 28|29) + MANAGED="machine" + ;; + *) + echo "ERROR: cannot set MANAGED. Unknown prefix length ${PREFIX_LEN}" + MANAGED="unknown" + ;; +esac +echo -n "$MANAGED" > $METADATA_DIR/managed diff --git a/configs/virtual_ubuntu/opt/mlab/bin/write-metadata.sh b/configs/virtual_ubuntu/opt/mlab/bin/write-metadata.sh index 8cef4ef..53b4829 100755 --- a/configs/virtual_ubuntu/opt/mlab/bin/write-metadata.sh +++ b/configs/virtual_ubuntu/opt/mlab/bin/write-metadata.sh @@ -63,3 +63,7 @@ echo -n ${machine_type##*/} > $METADATA_DIR/machine-type echo -n "PREMIUM" > $METADATA_DIR/network-tier echo -n $(uname -r) > $METADATA_DIR/kernel-version + +# For virtual machines this indicates that M-Lab manages only the machine and +# none of the infrastructure upstream of it. +echo -n "machine" > $METADATA_DIR/managed