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_<version>_<arch>.deb" but now it delivers a
   single file for all Arch's and the file name is
   "xe-guest-utilities_<version>_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
This commit is contained in:
jianghua wang 2015-09-18 11:17:46 +01:00
parent c00e39901b
commit 78f6c1d70b
2 changed files with 6 additions and 2 deletions

View File

@ -179,7 +179,8 @@ function xenapi_ip_on {
local bridge_or_net_name local bridge_or_net_name
bridge_or_net_name=$1 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 { function xenapi_is_listening_on {

View File

@ -193,7 +193,10 @@ if [ -z "$templateuuid" ]; then
TMP_DIR=/tmp/temp.$RANDOM TMP_DIR=/tmp/temp.$RANDOM
mkdir -p $TMP_DIR mkdir -p $TMP_DIR
mount -o loop $TOOLS_ISO $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 cp $DEB_FILE $HTTP_SERVER_LOCATION
umount $TMP_DIR umount $TMP_DIR
rmdir $TMP_DIR rmdir $TMP_DIR