feature #1163: get domain name from deployment file in xen4 deploy

This commit is contained in:
Javi Fontan committed 2013-06-07 15:52:23 +02:00
1 parent a5a8be2319
commit 6ccd277d23
1 file changed
+9 -12
+9 -12
View File
@@ -1,4 +1,4 @@
#!/bin/bash
#!/bin/bash
# -------------------------------------------------------------------------- #
# Copyright 2002-2013, OpenNebula Project (OpenNebula.org), C12G Labs #
@@ -29,6 +29,8 @@ function error_exit() {
}
domain=$1
id=$2
host=$3
mkdir -p `dirname $domain`
cat > $domain
@@ -37,26 +39,21 @@ 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`
domain_name=`grep -e '^name =' < $domain | cut -d= -f2 | tr -d ' ' | tr -d "\'" | 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
$XM_CREDITS -d $domain_name -w $credits
if [ "x$?" != "x0" ]; then
log_error "Unable to set VM credits"
fi
fi
DIR=$(dirname $domain)
NUMBER=$(basename $DIR)
echo one-$NUMBER
echo $domain_name