Skip to content

Commit 1d95188

Browse files
author
Pearl Dsilva
committed
commit addresses systemvm iso not getting attached during bootup
1 parent 92d7271 commit 1d95188

9 files changed

Lines changed: 30 additions & 23 deletions

File tree

plugins/integrations/kubernetes-service/src/main/java/com/cloud/kubernetes/cluster/actionworkers/KubernetesClusterActionWorker.java

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,11 @@
4141
import com.cloud.kubernetes.cluster.KubernetesCluster;
4242
import com.cloud.kubernetes.cluster.KubernetesClusterDetailsVO;
4343
import com.cloud.kubernetes.cluster.KubernetesClusterManagerImpl;
44-
import com.cloud.kubernetes.cluster.KubernetesClusterService;
4544
import com.cloud.kubernetes.cluster.KubernetesClusterVO;
4645
import com.cloud.kubernetes.cluster.KubernetesClusterVmMapVO;
4746
import com.cloud.kubernetes.cluster.dao.KubernetesClusterDao;
4847
import com.cloud.kubernetes.cluster.dao.KubernetesClusterDetailsDao;
4948
import com.cloud.kubernetes.cluster.dao.KubernetesClusterVmMapDao;
50-
import com.cloud.kubernetes.cluster.utils.KubernetesClusterUtil;
5149
import com.cloud.kubernetes.version.KubernetesSupportedVersion;
5250
import com.cloud.kubernetes.version.dao.KubernetesSupportedVersionDao;
5351
import com.cloud.network.IpAddress;
@@ -319,7 +317,7 @@ protected Pair<String, Integer> getKubernetesClusterServerIpSshPort(UserVm maste
319317
}
320318

321319
protected void attachIsoKubernetesVMs(List<UserVm> clusterVMs, final KubernetesSupportedVersion kubernetesSupportedVersion) throws CloudRuntimeException {
322-
final long startTimeoutTime = System.currentTimeMillis() + KubernetesClusterService.KubernetesClusterStartTimeout.value() * 1000;
320+
//final long startTimeoutTime = System.currentTimeMillis() + KubernetesClusterService.KubernetesClusterStartTimeout.value() * 1000;
323321
KubernetesSupportedVersion version = kubernetesSupportedVersion;
324322
if (kubernetesSupportedVersion == null) {
325323
version = kubernetesSupportedVersionDao.findById(kubernetesCluster.getKubernetesVersionId());
@@ -342,16 +340,16 @@ protected void attachIsoKubernetesVMs(List<UserVm> clusterVMs, final KubernetesS
342340
if (!iso.getState().equals(VirtualMachineTemplate.State.Active)) {
343341
logTransitStateAndThrow(Level.ERROR, String.format("Unable to attach ISO to Kubernetes cluster ID: %s. Binaries ISO not active.", kubernetesCluster.getUuid()), kubernetesCluster.getId(), failedEvent);
344342
}
345-
Pair<String, Integer> clusterServerIpSshPort = getKubernetesClusterServerIpSshPort(null);
346-
long i = 0;
347-
348-
if (!containsMasterNode(clusterVMs)) {
349-
i = kubernetesCluster.getTotalNodeCount();
350-
}
343+
//Pair<String, Integer> clusterServerIpSshPort = getKubernetesClusterServerIpSshPort(null);
344+
// long i = 0;
345+
//
346+
// if (!containsMasterNode(clusterVMs)) {
347+
// i = kubernetesCluster.getTotalNodeCount();
348+
// }
351349
for (UserVm vm : clusterVMs) {
352350
try {
353-
while (!KubernetesClusterUtil.isKubernetesClusterMasterVmRunning(kubernetesCluster, clusterServerIpSshPort.first(), (int) (CLUSTER_NODES_DEFAULT_START_SSH_PORT + i), startTimeoutTime));
354-
i++;
351+
// while (!KubernetesClusterUtil.isKubernetesClusterMasterVmRunning(kubernetesCluster, clusterServerIpSshPort.first(), (int) (CLUSTER_NODES_DEFAULT_START_SSH_PORT + i), startTimeoutTime));
352+
// i++;
355353
templateService.attachIso(iso.getId(), vm.getId());
356354
if (LOGGER.isInfoEnabled()) {
357355
LOGGER.info(String.format("Attached binaries ISO for VM: %s in cluster: %s", vm.getUuid(), kubernetesCluster.getName()));

server/src/main/java/com/cloud/consoleproxy/ConsoleProxyManagerImpl.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1483,7 +1483,6 @@ public boolean finalizeCommandsOnStart(Commands cmds, VirtualMachineProfile prof
14831483
if(profile.getHypervisorType() == HypervisorType.Hyperv) {
14841484
controlNic = managementNic;
14851485
}
1486-
14871486
CheckSshCommand check = new CheckSshCommand(profile.getInstanceName(), controlNic.getIPv4Address(), 3922);
14881487
cmds.addCommand("checkSsh", check);
14891488

systemvm/debian/opt/cloud/bin/setup/CKSNode.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,9 @@ setup_k8s_node() {
5151
rm -f /etc/logrotate.d/cloud
5252

5353
log_it "Starting cloud-init services"
54-
systemctl enable --now --no-block docker
54+
systemctl enable --now --no-block containerd
55+
systemctl enable --now --no-block docker.socket
56+
systemctl enable --now --no-block docker.service
5557
systemctl enable --now --no-block cloud-init
5658
systemctl enable --now --no-block cloud-config
5759
systemctl enable --now --no-block cloud-final

systemvm/debian/opt/cloud/bin/setup/bootstrap.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,6 @@ patch_systemvm() {
171171
patch() {
172172
local PATCH_MOUNT=/media/cdrom
173173
local logfile="/var/log/patchsystemvm.log"
174-
ls -lrt ${PATCH_MOUNT}
175174

176175
if [ "$TYPE" == "consoleproxy" ] || [ "$TYPE" == "secstorage" ] && [ -f ${PATCH_MOUNT}/agent.zip ] && [ -f /var/cache/cloud/patch.required ]
177176
then

systemvm/debian/opt/cloud/bin/setup/cloud-early-config

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
# KIND, either express or implied. See the License for the
1616
# specific language governing permissions and limitations
1717
# under the License.
18-
set -x
18+
1919
PATH="/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin"
2020

2121
# Clear boot up flag, it would be created by rc.local after boot up done
@@ -61,7 +61,6 @@ patch() {
6161
[ -f ${md5file} ] && oldmd5=$(cat ${md5file})
6262
local newmd5=
6363
[ -f ${patchfile} ] && newmd5=$(md5sum ${patchfile} | awk '{print $1}')
64-
6564
log_it "Scripts checksum detected: oldmd5=$oldmd5 newmd5=$newmd5"
6665
if [ "$oldmd5" != "$newmd5" ] && [ -f ${patchfile} ] && [ "$newmd5" != "" ]
6766
then

systemvm/debian/opt/cloud/bin/setup/common.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -544,7 +544,7 @@ setup_system_rfc1918_internal() {
544544
public_ip=`getPublicIp`
545545
echo "$public_ip" | grep -E "^((127\.)|(10\.)|(172\.1[6-9]\.)|(172\.2[0-9]\.)|(172\.3[0-1]\.)|(192\.168\.))"
546546
if [ "$?" == "0" ]; then
547-
log_it "Not setting up route of RFC1918 space to $LOCAL_GW befause $public_ip is RFC1918."
547+
log_it "Not setting up route of RFC1918 space to $LOCAL_GW because $public_ip is RFC1918."
548548
else
549549
log_it "Setting up route of RFC1918 space to $LOCAL_GW"
550550
# Setup general route for RFC 1918 space, as otherwise it will be sent to

systemvm/debian/opt/cloud/bin/setup/postinit.sh

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,18 @@
2020

2121
set -x
2222

23+
log_it() {
24+
echo "$(date) $@" >> /var/log/cloud.log
25+
log_action_msg "$@"
26+
}
27+
2328
# Eject cdrom if any
24-
eject || true
29+
CMDLINE=/var/cache/cloud/cmdline
30+
export TYPE=$(grep -Po 'type=\K[a-zA-Z]*' $CMDLINE)
31+
if [ "$TYPE" -ne "CKSNode" ]; then
32+
log_it "ejecting iso!!!"
33+
eject || true
34+
fi
2535

2636
# Restart journald for setting changes to apply
2737
systemctl restart systemd-journald

tools/appliance/systemvmtemplate/scripts/configure_systemvm_services.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,11 @@ function configure_services() {
129129
systemctl disable qemu-guest-agent
130130

131131
# Disable docker service
132-
systemctl disable docker
132+
systemctl disable containerd
133+
systemctl disable docker.service
134+
systemctl stop docker.service
135+
systemctl disable docker.socket
136+
systemctl stop docker.socket
133137

134138
# Disable cloud init by default
135139
cat <<EOF > /etc/cloud/cloud.cfg.d/cloudstack.cfg

tools/appliance/systemvmtemplate/scripts/install_systemvm_packages.sh

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -96,10 +96,6 @@ function install_packages() {
9696
stable"
9797
apt-get update
9898
${apt_get} install docker-ce docker-ce-cli containerd.io
99-
# Also tried:
100-
# apt-get install --install-recommends docker-ce
101-
# and the below option, removing the addition of the repo step
102-
# curl -fsSL https://get.docker.com/ | sh
10399
fi
104100
apt_clean
105101

0 commit comments

Comments
 (0)