From dec5ca0f201eaaa996b929aa36f2db5d9fb91aac Mon Sep 17 00:00:00 2001 From: Mate Lakat Date: Fri, 17 Oct 2014 13:13:35 +0200 Subject: [PATCH] XenAPI: Remove non-used functions Remove the no-longer used functions that were used to download plugins to dom0. Change-Id: I8dfd476781b683a8378efdae45d3cb1b46e7063c --- tools/xen/functions | 40 ---------------------------------- tools/xen/test_functions.sh | 43 ------------------------------------- 2 files changed, 83 deletions(-) diff --git a/tools/xen/functions b/tools/xen/functions index 4317796e39..c8efd57d88 100644 --- a/tools/xen/functions +++ b/tools/xen/functions @@ -19,10 +19,6 @@ function xapi_plugin_location { return 1 } -function zip_snapshot_location { - echo $1 | sed "s,^git://,http://,g;s:\.git$::;s:$:/zipball/$2:g" -} - function create_directory_for_kernels { if [ -d "/boot/guest" ]; then echo "INFO: /boot/guest directory already exists, using that" >&2 @@ -43,42 +39,6 @@ function create_directory_for_images { fi } -function extract_remote_zipball { - local ZIPBALL_URL=$1 - - local LOCAL_ZIPBALL=$(mktemp) - local EXTRACTED_FILES=$(mktemp -d) - - { - if ! wget -nv $ZIPBALL_URL -O $LOCAL_ZIPBALL --no-check-certificate; then - die_with_error "Failed to download [$ZIPBALL_URL]" - fi - unzip -q -o $LOCAL_ZIPBALL -d $EXTRACTED_FILES - rm -f $LOCAL_ZIPBALL - } >&2 - - echo "$EXTRACTED_FILES" -} - -function find_xapi_plugins_dir { - find $1 -path '*/xapi.d/plugins' -type d -print -} - -function install_xapi_plugins_from { - local XAPI_PLUGIN_DIR - local EXTRACTED_FILES - local EXTRACTED_PLUGINS_DIR - - EXTRACTED_FILES="$1" - - XAPI_PLUGIN_DIR=$(xapi_plugin_location) - - EXTRACTED_PLUGINS_DIR=$(find_xapi_plugins_dir $EXTRACTED_FILES) - - cp -pr $EXTRACTED_PLUGINS_DIR/* $XAPI_PLUGIN_DIR - chmod a+x ${XAPI_PLUGIN_DIR}* -} - function get_local_sr { xe pool-list params=default-SR minimal=true } diff --git a/tools/xen/test_functions.sh b/tools/xen/test_functions.sh index 838f86a525..924e773c00 100755 --- a/tools/xen/test_functions.sh +++ b/tools/xen/test_functions.sh @@ -116,18 +116,6 @@ function test_no_plugin_directory_found { grep "[ -d /usr/lib/xcp/plugins/ ]" $LIST_OF_ACTIONS } -function test_zip_snapshot_location_http { - diff \ - <(zip_snapshot_location "http://github.com/openstack/nova.git" "master") \ - <(echo "http://github.com/openstack/nova/zipball/master") -} - -function test_zip_snapsot_location_git { - diff \ - <(zip_snapshot_location "git://github.com/openstack/nova.git" "master") \ - <(echo "http://github.com/openstack/nova/zipball/master") -} - function test_create_directory_for_kernels { ( . mocks @@ -174,37 +162,6 @@ function test_create_directory_for_images_existing_dir { EOF } -function test_extract_remote_zipball { - local RESULT=$(. mocks && extract_remote_zipball "someurl") - - diff <(cat $LIST_OF_ACTIONS) - << EOF -wget -nv someurl -O tempfile --no-check-certificate -unzip -q -o tempfile -d tempdir -rm -f tempfile -EOF - - [ "$RESULT" = "tempdir" ] -} - -function test_extract_remote_zipball_wget_fail { - set +e - - local IGNORE - IGNORE=$(. mocks && extract_remote_zipball "failurl") - - assert_died_with "Failed to download [failurl]" -} - -function test_find_nova_plugins { - local tmpdir=$(mktemp -d) - - mkdir -p "$tmpdir/blah/blah/u/xapi.d/plugins" - - [ "$tmpdir/blah/blah/u/xapi.d/plugins" = $(find_xapi_plugins_dir $tmpdir) ] - - rm -rf $tmpdir -} - function test_get_local_sr { setup_xe_response "uuid123"