Merge pull request #14 from jodh-intel/fix-config-hypervisor-script

scripts: Re-add tags for hypervisor config script
This commit is contained in:
Jose Carlos Venegas Munoz 2018-04-13 12:03:34 -05:00 committed by GitHub
commit d0085e8edf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -92,8 +92,12 @@ check_tag()
local tag="$1" local tag="$1"
local entry="$2" local entry="$2"
[ -z "$tag" ] && die "no tag for entry '$entry'"
[ -z "$entry" ] && die "no entry for tag '$tag'"
value="${recognised_tags[$tag]}" value="${recognised_tags[$tag]}"
# each tag MUST have a description
[ -n "$value" ] && return [ -n "$value" ] && return
die "invalid tag '$tag' found for entry '$entry'" die "invalid tag '$tag' found for entry '$entry'"
@ -105,6 +109,7 @@ check_tags()
local entry="$2" local entry="$2"
[ -z "$tags" ] && die "entry '$entry' doesn't have any tags" [ -z "$tags" ] && die "entry '$entry' doesn't have any tags"
[ -z "$entry" ] && die "no entry for tags '$tags'"
tags=$(echo "$tags"|tr ',' '\n') tags=$(echo "$tags"|tr ',' '\n')
@ -143,9 +148,13 @@ show_array()
for entry in "${_array[@]}" for entry in "${_array[@]}"
do do
[ -z "$entry" ] && die "found empty entry"
tags=$(echo "$entry"|cut -s -d: -f1) tags=$(echo "$entry"|cut -s -d: -f1)
elem=$(echo "$entry"|cut -s -d: -f2-) elem=$(echo "$entry"|cut -s -d: -f2-)
[ -z "$elem" ] && die "no option for entry '$entry'"
check_tags "$tags" "$entry" check_tags "$tags" "$entry"
if [ "$action" = "dump" ] if [ "$action" = "dump" ]
@ -175,6 +184,17 @@ show_array()
# Entry point # Entry point
main() main()
{ {
local qemu_version_file="VERSION"
[ -f ${qemu_version_file} ] || die "QEMU version file '$qemu_version_file' not found"
local qemu_version_major=$(cut -d. -f1 "${qemu_version_file}")
local qemu_version_minor=$(cut -d. -f2 "${qemu_version_file}")
[ -n "${qemu_version_major}" ] \
|| die "cannot determine qemu major version from file $qemu_version_file"
[ -n "${qemu_version_minor}" ] \
|| die "cannot determine qemu minor version from file $qemu_version_file"
arch=$(arch) arch=$(arch)
# Array of configure options. # Array of configure options.
@ -270,8 +290,8 @@ main()
# SECURITY: Don't build a static binary (lowers security) # SECURITY: Don't build a static binary (lowers security)
# needed if qemu version is less than 2.7 # needed if qemu version is less than 2.7
if [ ${qemu_version_major} -eq 2 ] && [ ${qemu_version_minor} -lt 7 ]; then if [ "${qemu_version_major}" -eq 2 ] && [ "${qemu_version_minor}" -lt 7 ]; then
qemu_options+=(--disable-static) qemu_options+=(security:--disable-static)
fi fi
# Not required as "-uuid ..." is always passed to the qemu binary # Not required as "-uuid ..." is always passed to the qemu binary
@ -313,8 +333,8 @@ main()
# Always strip binaries # Always strip binaries
# needed if qemu version is less than 2.7 # needed if qemu version is less than 2.7
if [ ${qemu_version_major} -eq 2 ] && [ ${qemu_version_minor} -lt 7 ]; then if [ "${qemu_version_major}" -eq 2 ] && [ "${qemu_version_minor}" -lt 7 ]; then
qemu_options+=(--enable-strip) qemu_options+=(size:--enable-strip)
fi fi
# Support Ceph RADOS Block Device (RBD) # Support Ceph RADOS Block Device (RBD)