This commit fixes #8622 by extract shared func into common.sh to avoid inconsistency in future. Signed-off-by: Daniel Jiang <jiangd@vmware.com>