From 6ccd277d230afa4411b4557a031c95b7749df7e1 Mon Sep 17 00:00:00 2001 From: Javi Fontan Date: Fri, 7 Jun 2013 15:52:23 +0200 Subject: [PATCH] feature #1163: get domain name from deployment file in xen4 deploy --- src/vmm_mad/remotes/xen/xen4/deploy | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/src/vmm_mad/remotes/xen/xen4/deploy b/src/vmm_mad/remotes/xen/xen4/deploy index 56f6a5f290..9dc2fa71a7 100755 --- a/src/vmm_mad/remotes/xen/xen4/deploy +++ b/src/vmm_mad/remotes/xen/xen4/deploy @@ -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