mirror of
https://github.com/apache/cloudstack.git
synced 2025-11-03 04:12:31 +01:00
Fix ping NFS server on ssvm-check.sh (#6900)
This commit is contained in:
parent
89bf4750ab
commit
056e7d15bc
@ -48,6 +48,7 @@ import org.apache.cloudstack.storage.datastore.db.TemplateDataStoreDao;
|
||||
import org.apache.cloudstack.storage.datastore.db.VolumeDataStoreDao;
|
||||
import org.apache.cloudstack.utils.identity.ManagementServerNode;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
import org.apache.commons.lang3.BooleanUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.log4j.Logger;
|
||||
@ -1087,12 +1088,13 @@ public class SecondaryStorageManagerImpl extends ManagerBase implements Secondar
|
||||
buf.append(" template=domP type=secstorage");
|
||||
buf.append(" host=").append(com.cloud.utils.StringUtils.toCSVList(indirectAgentLB.getManagementServerList(dest.getHost().getId(), dest.getDataCenter().getId(), null)));
|
||||
buf.append(" port=").append(_mgmtPort);
|
||||
buf.append(" name=").append(profile.getVirtualMachine().getHostName());
|
||||
String vmName = profile.getVirtualMachine().getHostName();
|
||||
buf.append(" name=").append(vmName);
|
||||
|
||||
buf.append(" zone=").append(dest.getDataCenter().getId());
|
||||
buf.append(" pod=").append(dest.getPod().getId());
|
||||
|
||||
buf.append(" guid=").append(profile.getVirtualMachine().getHostName());
|
||||
buf.append(" guid=").append(vmName);
|
||||
|
||||
buf.append(" workers=").append(_configDao.getValue("workers"));
|
||||
String msPublicKey = _configDao.getValue("ssh.publickey");
|
||||
@ -1180,9 +1182,29 @@ public class SecondaryStorageManagerImpl extends ManagerBase implements Secondar
|
||||
s_logger.debug(String.format("Setting UseHttpsToUpload config on cmdline with [%s] value.", useHttpsToUpload));
|
||||
buf.append(" useHttpsToUpload=").append(useHttpsToUpload);
|
||||
|
||||
addSecondaryStorageServerAddressToBuffer(buf, secStore, vmName);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the secondary storage address to the buffer if it is in the following pattern: <protocol>//<address>/...
|
||||
*/
|
||||
protected void addSecondaryStorageServerAddressToBuffer(StringBuilder buffer, DataStore dataStore, String vmName) {
|
||||
String url = dataStore.getTO().getUrl();
|
||||
String[] urlArray = url.split("/");
|
||||
|
||||
s_logger.debug(String.format("Found [%s] as secondary storage's URL for SSVM [%s].", url, vmName));
|
||||
if (ArrayUtils.getLength(urlArray) < 3) {
|
||||
s_logger.debug(String.format("Could not retrieve secondary storage address from URL [%s] of SSVM [%s].", url, vmName));
|
||||
return;
|
||||
}
|
||||
|
||||
String address = urlArray[2];
|
||||
s_logger.info(String.format("Using [%s] as address of secondary storage of SSVM [%s].", address, vmName));
|
||||
buffer.append(" secondaryStorageServerAddress=").append(address);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean finalizeDeployment(Commands cmds, VirtualMachineProfile profile, DeployDestination dest, ReservationContext context) {
|
||||
|
||||
|
||||
@ -99,19 +99,36 @@ then
|
||||
fi
|
||||
done
|
||||
else
|
||||
echo "ERROR: NFS is not currently mounted"
|
||||
echo "Try manually mounting from inside the VM"
|
||||
NFSSERVER=`awk '{print $17}' $CMDLINE|awk -F= '{print $2}'|awk -F: '{print $1}'`
|
||||
echo "NFS server is " $NFSSERVER
|
||||
ping -c 2 $NFSSERVER
|
||||
if [ $? -eq 0 ]
|
||||
echo "ERROR: Storage $storage is not currently mounted"
|
||||
echo "Verifying if we can at least ping the storage"
|
||||
STORAGE_ADDRESS=`grep "secondaryStorageServerAddress" $CMDLINE | sed -E 's/.*secondaryStorageServerAddress=([^ ]*).*/\1/g'`
|
||||
|
||||
if [[ -z "$STORAGE_ADDRESS" ]]
|
||||
then
|
||||
echo "Good: Can ping $storage server"
|
||||
STORAGE_NETWORK_GATEWAY=`grep "storagegateway" $CMDLINE | sed -E 's/.*storagegateway=([^ ]*).*/\1/g'`
|
||||
echo "Storage address is empty, trying to ping storage network gateway instead ($STORAGE_NETWORK_GATEWAY)"
|
||||
ping -c 2 $STORAGE_NETWORK_GATEWAY
|
||||
if [ $? -eq 0 ]
|
||||
then
|
||||
echo "Good: Can ping $storage storage network gateway"
|
||||
else
|
||||
echo "WARNING: Cannot ping $storage storage network gateway"
|
||||
echo routing table follows
|
||||
route -n
|
||||
fi
|
||||
else
|
||||
echo "WARNING: cannot ping $storage server"
|
||||
echo routing table follows
|
||||
route -n
|
||||
echo "Storage address is $STORAGE_ADDRESS, trying to ping it"
|
||||
ping -c 2 $STORAGE_ADDRESS
|
||||
if [ $? -eq 0 ]
|
||||
then
|
||||
echo "Good: Can ping $storage storage address"
|
||||
else
|
||||
echo "WARNING: Cannot ping $storage storage address"
|
||||
echo routing table follows
|
||||
route -n
|
||||
fi
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user