Browse code

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

jianghua wang authored on 2015/09/18 19:17:46
Showing 2 changed files
... ...
@@ -179,7 +179,8 @@ function xenapi_ip_on {
179 179
     local bridge_or_net_name
180 180
     bridge_or_net_name=$1
181 181
 
182
-    ifconfig $(bridge_for "$bridge_or_net_name") | grep "inet addr" | cut -d ":" -f2 | sed "s/ .*//"
182
+    ip -4 addr show $(bridge_for "$bridge_or_net_name") |\
183
+    awk '/inet/{split($2, ip, "/"); print ip[1];}'
183 184
 }
184 185
 
185 186
 function xenapi_is_listening_on {
... ...
@@ -193,7 +193,10 @@ if [ -z "$templateuuid" ]; then
193 193
             TMP_DIR=/tmp/temp.$RANDOM
194 194
             mkdir -p $TMP_DIR
195 195
             mount -o loop $TOOLS_ISO $TMP_DIR
196
-            DEB_FILE=$(ls $TMP_DIR/Linux/*amd64.deb)
196
+            # the target deb package maybe *amd64.deb or *all.deb,
197
+            # so use *amd64.deb by default. If it doesn't exist,
198
+            # then use *all.deb.
199
+            DEB_FILE=$(ls $TMP_DIR/Linux/*amd64.deb || ls $TMP_DIR/Linux/*all.deb)
197 200
             cp $DEB_FILE $HTTP_SERVER_LOCATION
198 201
             umount $TMP_DIR
199 202
             rmdir $TMP_DIR