From 78f6c1d70b51c29e5d36143e6051e6ff96ceb41c Mon Sep 17 00:00:00 2001 From: jianghua wang Date: Fri, 18 Sep 2015 11:17:46 +0100 Subject: [PATCH] tools/Xen: failed to install domU in new XenServer Current install_os_domU.sh depends on some keywords which are changed in the next version XenServer which is upgraded to CentOS 7. So with the existing script to install domU in the new version XenServer, it will always fail. This patch is to make it to be compatible with all XenServer versions: 1. the output format of "ifconfig" is changed; the fix is to use the ip command to retrieve IP address. 2. In XS 6.5 and the previous XS, the "xe-guest-utilities" package file name is as "xe-guest-utilities__.deb" but now it delivers a single file for all Arch's and the file name is "xe-guest-utilities__all.deb". In order to make it to be compatible, the fix will try to search the old file name pattern by default. If it does't exist, then try to search the new file name pattern. Change-Id: I893e89e42a5ef7dd079b571ea308f318c9befc9e Closes-Bug: #1494241 --- tools/xen/functions | 3 ++- tools/xen/install_os_domU.sh | 5 ++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/tools/xen/functions b/tools/xen/functions index 4e9fede387..8c674dcce3 100644 --- a/tools/xen/functions +++ b/tools/xen/functions @@ -179,7 +179,8 @@ function xenapi_ip_on { local bridge_or_net_name bridge_or_net_name=$1 - ifconfig $(bridge_for "$bridge_or_net_name") | grep "inet addr" | cut -d ":" -f2 | sed "s/ .*//" + ip -4 addr show $(bridge_for "$bridge_or_net_name") |\ + awk '/inet/{split($2, ip, "/"); print ip[1];}' } function xenapi_is_listening_on { diff --git a/tools/xen/install_os_domU.sh b/tools/xen/install_os_domU.sh index b49347e09b..e24d9ed0b9 100755 --- a/tools/xen/install_os_domU.sh +++ b/tools/xen/install_os_domU.sh @@ -193,7 +193,10 @@ if [ -z "$templateuuid" ]; then TMP_DIR=/tmp/temp.$RANDOM mkdir -p $TMP_DIR mount -o loop $TOOLS_ISO $TMP_DIR - DEB_FILE=$(ls $TMP_DIR/Linux/*amd64.deb) + # the target deb package maybe *amd64.deb or *all.deb, + # so use *amd64.deb by default. If it doesn't exist, + # then use *all.deb. + DEB_FILE=$(ls $TMP_DIR/Linux/*amd64.deb || ls $TMP_DIR/Linux/*all.deb) cp $DEB_FILE $HTTP_SERVER_LOCATION umount $TMP_DIR rmdir $TMP_DIR