Merge "Create the /images directory used by the resize functionality."

This commit is contained in:
Jenkins 2013-06-27 20:45:46 +00:00 committed by Gerrit Code Review
commit cf225101fb
3 changed files with 34 additions and 0 deletions

View File

@ -24,6 +24,16 @@ function create_directory_for_kernels {
fi
}
function create_directory_for_images {
if [ -d "/images" ]; then
echo "INFO: /images directory already exists, using that" >&2
else
local LOCALPATH="$(get_local_sr_path)/os-images"
mkdir -p $LOCALPATH
ln -s $LOCALPATH /images
fi
}
function extract_remote_zipball {
local ZIPBALL_URL=$1

View File

@ -63,6 +63,7 @@ if [[ "$ENABLED_SERVICES" =~ "q-agt" && "$Q_PLUGIN" = "openvswitch" ]]; then
fi
create_directory_for_kernels
create_directory_for_images
#
# Configure Networking

View File

@ -138,6 +138,29 @@ function test_create_directory_for_kernels_existing_dir {
EOF
}
function test_create_directory_for_images {
(
. mocks
mock_out get_local_sr uuid1
create_directory_for_images
)
assert_directory_exists "/var/run/sr-mount/uuid1/os-images"
assert_symlink "/images" "/var/run/sr-mount/uuid1/os-images"
}
function test_create_directory_for_images_existing_dir {
(
. mocks
given_directory_exists "/images"
create_directory_for_images
)
diff -u $LIST_OF_ACTIONS - << EOF
[ -d /images ]
EOF
}
function test_extract_remote_zipball {
local RESULT=$(. mocks && extract_remote_zipball "someurl")