Martin Peřina has uploaded a new change for review. Change subject: engine: Add support for multiple IDs in unlock_entity.sh ......................................................................
engine: Add support for multiple IDs in unlock_entity.sh Adds support to enter multiple IDs of same type as parameters of unlock_entity.sh script. This patch make '-i' parameter obsolete and entity IDs has to be entered as last parameter of the script. Example: unlock_entity.sh -t vm 1 2 3 Change-Id: Ic1f9807eef92b9d4cf6f0c020e059ffe549badf2 Bug-Url: https://bugzilla.redhat.com/960448 Signed-off-by: Martin Perina <[email protected]> --- M packaging/dbscripts/unlock_entity.sh 1 file changed, 9 insertions(+), 5 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/51/16551/1 diff --git a/packaging/dbscripts/unlock_entity.sh b/packaging/dbscripts/unlock_entity.sh index c9a363f..42bc472 100755 --- a/packaging/dbscripts/unlock_entity.sh +++ b/packaging/dbscripts/unlock_entity.sh @@ -8,10 +8,9 @@ set_defaults usage() { - printf "Usage: ${ME} -t TYPE -i ID [-h] [-s SERVERNAME [-p PORT]] [-d DATABASE] [-u USERNAME] [-l LOGFILE] [-r] [-q] [-v]\n" + printf "Usage: ${ME} -t TYPE [-h] [-s SERVERNAME [-p PORT]] [-d DATABASE] [-u USERNAME] [-l LOGFILE] [-r] [-q] [-v] ENTITIES\n" printf "\n" printf "\t-t TYPE - The object type {vm | template | disk | snapshot} \n" - printf "\t-i ID - The object name in case of vm/template , UUID in case of a disk \n" printf "\t-s SERVERNAME - The database servername for the database (def. ${SERVERNAME})\n" printf "\t-p PORT - The database port for the database (def. ${PORT})\n" printf "\t-d DATABASE - The database name (def. ${DATABASE})\n" @@ -21,6 +20,7 @@ printf "\t-q - Query db and display a list of the locked entites.\n" printf "\t-v - Turn on verbosity (WARNING: lots of output)\n" printf "\t-h - This help text.\n" + printf "\tENTITIES - The list of object names in case of vm/template, UUIDs in case of a disk \n" printf "\n" popd>/dev/null @@ -36,7 +36,6 @@ while getopts :ht:i:s:d:u:p:l:f:qrv option; do case $option in t) TYPE=$OPTARG;; - i) ID=$OPTARG;; s) SERVERNAME=$OPTARG;; p) PORT=$OPTARG;; d) DATABASE=$OPTARG;; @@ -50,6 +49,9 @@ esac done +shift $(( OPTIND - 1 )) +IDS="$@" + if [ ! -n "${QUERY}" ]; then echo "Caution, this operation may lead to data corruption and should be used with care. Please contact support prior to running this command" echo "Are you sure you want to proceed? [y/n]" @@ -62,8 +64,10 @@ fi fi -if [[ -n "${TYPE}" && -n "${ID}" ]]; then - unlock_entity "${TYPE}" "${ID}" "$(whoami)" ${RECURSIVE} +if [[ -n "${TYPE}" && -n "${IDS}" ]]; then + for ID in ${IDS} ; do + unlock_entity "${TYPE}" "${ID}" "$(whoami)" ${RECURSIVE} + done elif [[ -n "${TYPE}" && -n "${QUERY}" ]]; then query_locked_entities "${TYPE}" else -- To view, visit http://gerrit.ovirt.org/16551 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ic1f9807eef92b9d4cf6f0c020e059ffe549badf2 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Martin Peřina <[email protected]> _______________________________________________ Engine-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/engine-patches
