feature #1163: merge xen3 and xen4 drivers, added parameters in xenrc

This commit is contained in:
Javi Fontan committed 2013-06-07 17:04:02 +02:00
1 parent 6ccd277d23
commit de856c09de
9 files changed
+19 -179

No files matched your search

+6 -6
View File
@@ -714,7 +714,7 @@ VMM_EXEC_KVM_SCRIPTS="src/vmm_mad/remotes/kvm/cancel \
#-------------------------------------------------------------------------------
VMM_EXEC_XEN3_SCRIPTS="src/vmm_mad/remotes/xen/cancel \
src/vmm_mad/remotes/xen/xen3/deploy \
src/vmm_mad/remotes/xen/deploy \
src/vmm_mad/remotes/xen/xen3/xenrc \
src/vmm_mad/remotes/xen/migrate \
src/vmm_mad/remotes/xen/restore \
@@ -723,8 +723,8 @@ VMM_EXEC_XEN3_SCRIPTS="src/vmm_mad/remotes/xen/cancel \
src/vmm_mad/remotes/xen/save \
src/vmm_mad/remotes/xen/poll \
src/vmm_mad/remotes/xen/poll_ganglia \
src/vmm_mad/remotes/xen/xen3/attach_disk \
src/vmm_mad/remotes/xen/xen3/detach_disk \
src/vmm_mad/remotes/xen/attach_disk \
src/vmm_mad/remotes/xen/detach_disk \
src/vmm_mad/remotes/xen/attach_nic \
src/vmm_mad/remotes/xen/detach_nic \
src/vmm_mad/remotes/xen/snapshot_create \
@@ -733,7 +733,7 @@ VMM_EXEC_XEN3_SCRIPTS="src/vmm_mad/remotes/xen/cancel \
src/vmm_mad/remotes/xen/shutdown"
VMM_EXEC_XEN4_SCRIPTS="src/vmm_mad/remotes/xen/cancel \
src/vmm_mad/remotes/xen/xen4/deploy \
src/vmm_mad/remotes/xen/deploy \
src/vmm_mad/remotes/xen/xen4/xenrc \
src/vmm_mad/remotes/xen/migrate \
src/vmm_mad/remotes/xen/restore \
@@ -742,8 +742,8 @@ VMM_EXEC_XEN4_SCRIPTS="src/vmm_mad/remotes/xen/cancel \
src/vmm_mad/remotes/xen/save \
src/vmm_mad/remotes/xen/poll \
src/vmm_mad/remotes/xen/poll_ganglia \
src/vmm_mad/remotes/xen/xen4/attach_disk \
src/vmm_mad/remotes/xen/xen4/detach_disk \
src/vmm_mad/remotes/xen/attach_disk \
src/vmm_mad/remotes/xen/detach_disk \
src/vmm_mad/remotes/xen/attach_nic \
src/vmm_mad/remotes/xen/detach_nic \
src/vmm_mad/remotes/xen/snapshot_create \
@@ -47,10 +47,8 @@ READONLY="${XPATH_ELEMENTS[2]}"
BUS="${XPATH_ELEMENTS[3]}"
CACHE="${XPATH_ELEMENTS[4]}"
DEFAULT_FILE_PREFIX="raw"
if [ -n "$IMAGE_PREFIX" ]; then
DEFAULT_FILE_PREFIX="$IMAGE_PREFIX"
if [ -z "$DEFAULT_FILE_PREFIX" ]; then
DEFAULT_FILE_PREFIX="file"
fi
case "$TYPE" in
@@ -74,5 +72,5 @@ else
MODE="w"
fi
exec_and_log "$XM_ATTACH_DISK $DOMAIN $FULL_DISK $TARGET $MODE" \
exec_and_log "$XM_ATTACH_DISK $DOMAIN $FULL_DISK ${TARGET_PREFIX}$TARGET $MODE" \
"Could not attach $FULL_DISK ($TARGET) to $DOMAIN"
File renamed without changes.
@@ -24,5 +24,5 @@ SOURCE="$2"
TARGET="$3"
TARGET_INDEX="$4"
exec_and_log "$XM_DETACH_DISK $DOMAIN $TARGET" \
exec_and_log "$XM_DETACH_DISK $DOMAIN ${TARGET_PREFIX}$TARGET" \
"Could not detach $TARGET from $DOMAIN"
-78
View File
@@ -1,78 +0,0 @@
#!/bin/bash
# -------------------------------------------------------------------------- #
# Copyright 2002-2013, OpenNebula Project (OpenNebula.org), C12G Labs #
# #
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
# not use this file except in compliance with the License. You may obtain #
# a copy of the License at #
# #
# http://www.apache.org/licenses/LICENSE-2.0 #
# #
# Unless required by applicable law or agreed to in writing, software #
# distributed under the License is distributed on an "AS IS" BASIS, #
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
# See the License for the specific language governing permissions and #
# limitations under the License. #
#--------------------------------------------------------------------------- #
source $(dirname $0)/xenrc
source $(dirname $0)/../../scripts_common.sh
DRIVER_PATH=$(dirname $0)
DOMAIN="$1"
SOURCE="$2"
TARGET="$3"
TARGET_INDEX="$4"
DRV_ACTION="$5"
XPATH="${DRIVER_PATH}/../../datastore/xpath.rb -b $DRV_ACTION"
unset i XPATH_ELEMENTS
DISK_XPATH="/VMM_DRIVER_ACTION_DATA/VM/TEMPLATE/DISK[ATTACH='YES']"
while IFS= read -r -d '' element; do
XPATH_ELEMENTS[i++]="$element"
done < <($XPATH $DISK_XPATH/DRIVER \
$DISK_XPATH/TYPE \
$DISK_XPATH/READONLY \
$DISK_XPATH/BUS \
$DISK_XPATH/CACHE)
DRIVER="${XPATH_ELEMENTS[0]:-$DEFAULT_TYPE}"
TYPE="${XPATH_ELEMENTS[1]}"
READONLY="${XPATH_ELEMENTS[2]}"
BUS="${XPATH_ELEMENTS[3]}"
CACHE="${XPATH_ELEMENTS[4]}"
DEFAULT_FILE_PREFIX="file"
if [ -n "$IMAGE_PREFIX" ]; then
DEFAULT_FILE_PREFIX="$IMAGE_PREFIX"
fi
case "$TYPE" in
block)
FILE_PREFIX="phy"
;;
*)
FILE_PREFIX="$DEFAULT_FILE_PREFIX"
;;
esac
if [ -n "$DRIVER" ]; then
FILE_PREFIX="$DRIVER"
fi
FULL_DISK="${FILE_PREFIX%:}:$SOURCE"
if [ "$READONLY" = "YES" ]; then
MODE="r"
else
MODE="w"
fi
exec_and_log "$XM_ATTACH_DISK $DOMAIN $FULL_DISK /dev/$TARGET $MODE" \
"Could not attach $FULL_DISK ($TARGET) to $DOMAIN"
-59
View File
@@ -1,59 +0,0 @@
#!/bin/bash
# -------------------------------------------------------------------------- #
# Copyright 2002-2013, OpenNebula Project (OpenNebula.org), C12G Labs #
# #
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
# not use this file except in compliance with the License. You may obtain #
# a copy of the License at #
# #
# http://www.apache.org/licenses/LICENSE-2.0 #
# #
# Unless required by applicable law or agreed to in writing, software #
# distributed under the License is distributed on an "AS IS" BASIS, #
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
# See the License for the specific language governing permissions and #
# limitations under the License. #
#--------------------------------------------------------------------------- #
source $(dirname $0)/xenrc
source $(dirname $0)/../../scripts_common.sh
function error_exit() {
exit_code=$1
message=$2
if [ "x$exit_code" != "x0" ]; then
error_message $message
exit $exit_code
fi
}
domain=$1
mkdir -p `dirname $domain`
cat > $domain
output=`$XM_CREATE $domain`
error_exit $? "Unable to create domain"
domain_name=`echo $output | grep 'Started domain' | sed 's/^.*Started domain //' | tr -d '\n' | cut -d' ' -f1`
out=`grep -e '^\#O CPU_CREDITS =' < $domain`
if [ "x$?" = "x0" ]; then
credits=`echo $out | cut -d= -f2 | tr -d ' '`
log_debug "Credits set to $credits"
name=`grep -e '^name =' < $domain | cut -d= -f2 | tr -d ' ' | tr -d "\'" | cut -d' ' -f1`
$XM_CREDITS -d $name -w $credits
if [ "x$?" != "x0" ]; then
log_error "Unable to set VM credits"
fi
fi
echo $domain_name
-28
View File
@@ -1,28 +0,0 @@
#!/bin/bash
# -------------------------------------------------------------------------- #
# Copyright 2002-2013, OpenNebula Project (OpenNebula.org), C12G Labs #
# #
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
# not use this file except in compliance with the License. You may obtain #
# a copy of the License at #
# #
# http://www.apache.org/licenses/LICENSE-2.0 #
# #
# Unless required by applicable law or agreed to in writing, software #
# distributed under the License is distributed on an "AS IS" BASIS, #
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
# See the License for the specific language governing permissions and #
# limitations under the License. #
#--------------------------------------------------------------------------- #
source $(dirname $0)/xenrc
source $(dirname $0)/../../scripts_common.sh
DOMAIN="$1"
SOURCE="$2"
TARGET="$3"
TARGET_INDEX="$4"
exec_and_log "$XM_DETACH_DISK $DOMAIN /dev/$TARGET" \
"Could not detach $TARGET from $DOMAIN"
+5 -1
View File
@@ -41,7 +41,11 @@ export XM_NETWORK_LIST="sudo $XM_PATH network-list"
# Xen 4 uses the new blktap2 and tap:aio handler is no longer supported.
# To make it work uncomment this line. This will be used as the default
# handler for disk hot plug
#export IMAGE_PREFIX="tap:tapdisk:aio"
#export DEFAULT_FILE_PREFIX="tap:tapdisk:aio"
export DEFAULT_FILE_PREFIX="file"
# attach and detach disk target prefix
TARGET_PREFIX="/dev/"
# Seconds to wait after shutdown until timeout
export SHUTDOWN_TIMEOUT=300
+4 -1
View File
@@ -41,7 +41,10 @@ export XM_CREDITS="sudo $XM_PATH sched-credit"
# Xen 4 uses the new blktap2 and tap:aio handler is no longer supported.
# To make it work uncomment this line. This will be used as the default
# handler for disk hot plug
export IMAGE_PREFIX="raw"
export DEFAULT_FILE_PREFIX="raw"
# attach and detach disk target prefix
TARGET_PREFIX=""
# Seconds to wait after shutdown until timeout
export SHUTDOWN_TIMEOUT=300