Merge remote-tracking branch 'apache/4.18'

This commit is contained in:
Abhishek Kumar 2023-12-09 12:04:21 +05:30
commit 4bdf35b7b0
10 changed files with 55 additions and 12 deletions

View File

@ -166,11 +166,11 @@ public class UserVmResponse extends BaseResponseWithTagInformation implements Co
private String serviceOfferingName; private String serviceOfferingName;
@SerializedName(ApiConstants.DISK_OFFERING_ID) @SerializedName(ApiConstants.DISK_OFFERING_ID)
@Param(description = "the ID of the disk offering of the virtual machine", since = "4.4") @Param(description = "the ID of the disk offering of the virtual machine. This parameter should not be used for retrieving disk offering details of DATA volumes. Use listVolumes API instead", since = "4.4")
private String diskOfferingId; private String diskOfferingId;
@SerializedName("diskofferingname") @SerializedName("diskofferingname")
@Param(description = "the name of the disk offering of the virtual machine", since = "4.4") @Param(description = "the name of the disk offering of the virtual machine. This parameter should not be used for retrieving disk offering details of DATA volumes. Use listVolumes API instead", since = "4.4")
private String diskOfferingName; private String diskOfferingName;
@SerializedName(ApiConstants.BACKUP_OFFERING_ID) @SerializedName(ApiConstants.BACKUP_OFFERING_ID)

View File

@ -91,7 +91,7 @@ public class KubernetesClusterUpgradeWorker extends KubernetesClusterActionWorke
} }
try { try {
result = SshHelper.sshExecute(publicIpAddress, sshPort, getControlNodeLoginUser(), sshKeyFile, null, result = SshHelper.sshExecute(publicIpAddress, sshPort, getControlNodeLoginUser(), sshKeyFile, null,
String.format("sudo /opt/bin/kubectl drain %s --ignore-daemonsets --delete-local-data", hostName), String.format("sudo /opt/bin/kubectl drain %s --ignore-daemonsets --delete-emptydir-data", hostName),
10000, 10000, 60000); 10000, 10000, 60000);
} catch (Exception e) { } catch (Exception e) {
logTransitStateDetachIsoAndThrow(Level.ERROR, String.format("Failed to upgrade Kubernetes cluster : %s, unable to drain Kubernetes node on VM : %s", kubernetesCluster.getName(), vm.getDisplayName()), kubernetesCluster, clusterVMs, KubernetesCluster.Event.OperationFailed, e); logTransitStateDetachIsoAndThrow(Level.ERROR, String.format("Failed to upgrade Kubernetes cluster : %s, unable to drain Kubernetes node on VM : %s", kubernetesCluster.getName(), vm.getDisplayName()), kubernetesCluster, clusterVMs, KubernetesCluster.Event.OperationFailed, e);

View File

@ -137,7 +137,7 @@ if [ -d "$BINARIES_DIR" ]; then
systemctl stop kubelet systemctl stop kubelet
cp -a ${BINARIES_DIR}/k8s/{kubelet,kubectl} /opt/bin cp -a ${BINARIES_DIR}/k8s/{kubelet,kubectl} /opt/bin
chmod +x {kubelet,kubectl} chmod +x /opt/bin/{kubelet,kubectl}
systemctl daemon-reload systemctl daemon-reload
systemctl restart containerd systemctl restart containerd

View File

@ -28,7 +28,6 @@ import java.util.stream.Collectors;
import javax.inject.Inject; import javax.inject.Inject;
import com.cloud.vm.VirtualMachine;
import org.apache.cloudstack.affinity.AffinityGroupResponse; import org.apache.cloudstack.affinity.AffinityGroupResponse;
import org.apache.cloudstack.annotation.AnnotationService; import org.apache.cloudstack.annotation.AnnotationService;
import org.apache.cloudstack.annotation.dao.AnnotationDao; import org.apache.cloudstack.annotation.dao.AnnotationDao;
@ -45,6 +44,7 @@ import org.apache.cloudstack.context.CallContext;
import org.apache.cloudstack.framework.config.dao.ConfigurationDao; import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
import org.apache.cloudstack.query.QueryService; import org.apache.cloudstack.query.QueryService;
import org.apache.commons.lang3.BooleanUtils; import org.apache.commons.lang3.BooleanUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
@ -62,6 +62,7 @@ import com.cloud.storage.GuestOS;
import com.cloud.storage.Storage.TemplateType; import com.cloud.storage.Storage.TemplateType;
import com.cloud.storage.VnfTemplateDetailVO; import com.cloud.storage.VnfTemplateDetailVO;
import com.cloud.storage.VnfTemplateNicVO; import com.cloud.storage.VnfTemplateNicVO;
import com.cloud.storage.Volume;
import com.cloud.storage.dao.VnfTemplateDetailsDao; import com.cloud.storage.dao.VnfTemplateDetailsDao;
import com.cloud.storage.dao.VnfTemplateNicDao; import com.cloud.storage.dao.VnfTemplateNicDao;
import com.cloud.user.Account; import com.cloud.user.Account;
@ -77,6 +78,7 @@ import com.cloud.utils.db.SearchCriteria.Op;
import com.cloud.utils.net.Dhcp; import com.cloud.utils.net.Dhcp;
import com.cloud.vm.UserVmDetailVO; import com.cloud.vm.UserVmDetailVO;
import com.cloud.vm.UserVmManager; import com.cloud.vm.UserVmManager;
import com.cloud.vm.VirtualMachine;
import com.cloud.vm.VirtualMachine.State; import com.cloud.vm.VirtualMachine.State;
import com.cloud.vm.VmStats; import com.cloud.vm.VmStats;
import com.cloud.vm.dao.NicExtraDhcpOptionDao; import com.cloud.vm.dao.NicExtraDhcpOptionDao;
@ -591,6 +593,11 @@ public class UserVmJoinDaoImpl extends GenericDaoBaseWithTagInformation<UserVmJo
userVmData.addAffinityGroup(resp); userVmData.addAffinityGroup(resp);
} }
if (StringUtils.isEmpty(userVmData.getDiskOfferingId()) && !Volume.Type.ROOT.equals(uvo.getVolumeType())) {
userVmData.setDiskOfferingId(uvo.getDiskOfferingUuid());
userVmData.setDiskOfferingName(uvo.getDiskOfferingName());
}
return userVmData; return userVmData;
} }

View File

@ -531,7 +531,7 @@ class TestKubernetesCluster(cloudstackTestCase):
@attr(tags=["advanced", "smoke"], required_hardware="true") @attr(tags=["advanced", "smoke"], required_hardware="true")
@skipTestIf("hypervisorNotSupported") @skipTestIf("hypervisorNotSupported")
def test_07_deploy_kubernetes_ha_cluster(self): def test_07_deploy_kubernetes_ha_cluster(self):
"""Test to deploy a new Kubernetes cluster """Test to deploy a new HA Kubernetes cluster
# Validate the following: # Validate the following:
# 1. createKubernetesCluster should return valid info for new cluster # 1. createKubernetesCluster should return valid info for new cluster
@ -542,14 +542,14 @@ class TestKubernetesCluster(cloudstackTestCase):
if self.default_network: if self.default_network:
self.skipTest("HA cluster on shared network requires external ip address, skipping it") self.skipTest("HA cluster on shared network requires external ip address, skipping it")
global k8s_cluster global k8s_cluster
k8s_cluster = self.getValidKubernetesCluster(1, 2) k8s_cluster = self.getValidKubernetesCluster(1, 3)
self.debug("HA Kubernetes cluster with ID: %s successfully deployed" % k8s_cluster.id) self.debug("HA Kubernetes cluster with ID: %s successfully deployed" % k8s_cluster.id)
return return
@attr(tags=["advanced", "smoke"], required_hardware="true") @attr(tags=["advanced", "smoke"], required_hardware="true")
@skipTestIf("hypervisorNotSupported") @skipTestIf("hypervisorNotSupported")
def test_08_upgrade_kubernetes_ha_cluster(self): def test_08_upgrade_kubernetes_ha_cluster(self):
"""Test to upgrade a Kubernetes cluster to newer version """Test to upgrade a HA Kubernetes cluster to newer version
# Validate the following: # Validate the following:
# 1. upgradeKubernetesCluster should return valid info for the cluster # 1. upgradeKubernetesCluster should return valid info for the cluster
@ -559,7 +559,7 @@ class TestKubernetesCluster(cloudstackTestCase):
if self.default_network: if self.default_network:
self.skipTest("HA cluster on shared network requires external ip address, skipping it") self.skipTest("HA cluster on shared network requires external ip address, skipping it")
global k8s_cluster global k8s_cluster
k8s_cluster = self.getValidKubernetesCluster(1, 2, version=self.kubernetes_version_v1) k8s_cluster = self.getValidKubernetesCluster(1, 3, version=self.kubernetes_version_v1)
time.sleep(self.services["sleep"]) time.sleep(self.services["sleep"])
self.debug("Upgrading HA Kubernetes cluster with ID: %s" % k8s_cluster.id) self.debug("Upgrading HA Kubernetes cluster with ID: %s" % k8s_cluster.id)
@ -586,7 +586,7 @@ class TestKubernetesCluster(cloudstackTestCase):
if self.default_network: if self.default_network:
self.skipTest("HA cluster on shared network requires external ip address, skipping it") self.skipTest("HA cluster on shared network requires external ip address, skipping it")
global k8s_cluster global k8s_cluster
k8s_cluster = self.getValidKubernetesCluster(1, 2) k8s_cluster = self.getValidKubernetesCluster(1, 3)
self.debug("Deleting Kubernetes cluster with ID: %s" % k8s_cluster.id) self.debug("Deleting Kubernetes cluster with ID: %s" % k8s_cluster.id)
return return

View File

@ -422,6 +422,7 @@
"label.cancel": "Cancel", "label.cancel": "Cancel",
"label.cancel.shutdown": "Cancel Shutdown", "label.cancel.shutdown": "Cancel Shutdown",
"label.cancelmaintenance": "Cancel maintenance", "label.cancelmaintenance": "Cancel maintenance",
"label.cancel.host.as.degraded": "Cancel host as degraded",
"label.capacity": "Capacity", "label.capacity": "Capacity",
"label.capacitybytes": "Capacity bytes", "label.capacitybytes": "Capacity bytes",
"label.capacityiops": "IOPS total", "label.capacityiops": "IOPS total",
@ -597,6 +598,7 @@
"label.db.usage.metrics": "DB/Usage server", "label.db.usage.metrics": "DB/Usage server",
"label.dbislocal": "The db runs locally", "label.dbislocal": "The db runs locally",
"label.dc.name": "DC name", "label.dc.name": "DC name",
"label.declare.host.as.degraded": "Declare host as degraded",
"label.decline.invitation": "Decline invitation", "label.decline.invitation": "Decline invitation",
"label.dedicate": "Dedicate", "label.dedicate": "Dedicate",
"label.dedicate.cluster": "Dedicate cluster", "label.dedicate.cluster": "Dedicate cluster",

View File

@ -295,6 +295,26 @@ export default {
} }
} }
}, },
{
api: 'declareHostAsDegraded',
icon: 'exception-outlined',
label: 'label.declare.host.as.degraded',
message: 'label.declare.host.as.degraded',
dataView: true,
show: (record) => {
return record.resourcestate !== 'Degraded' && (record.state === 'Alert' || record.state === 'Disconnected')
}
},
{
api: 'cancelHostAsDegraded',
icon: 'file-done-outlined',
label: 'label.cancel.host.as.degraded',
message: 'label.cancel.host.as.degraded',
dataView: true,
show: (record) => {
return record.resourcestate === 'Degraded'
}
},
{ {
api: 'deleteHost', api: 'deleteHost',
icon: 'delete-outlined', icon: 'delete-outlined',

View File

@ -73,10 +73,12 @@ import {
DragOutlined, DragOutlined,
EditOutlined, EditOutlined,
EnvironmentOutlined, EnvironmentOutlined,
ExceptionOutlined,
ExclamationCircleOutlined, ExclamationCircleOutlined,
EyeInvisibleOutlined, EyeInvisibleOutlined,
EyeOutlined, EyeOutlined,
FieldTimeOutlined, FieldTimeOutlined,
FileDoneOutlined,
FileProtectOutlined, FileProtectOutlined,
FilterOutlined, FilterOutlined,
FilterTwoTone, FilterTwoTone,
@ -230,10 +232,12 @@ export default {
app.component('DragOutlined', DragOutlined) app.component('DragOutlined', DragOutlined)
app.component('EditOutlined', EditOutlined) app.component('EditOutlined', EditOutlined)
app.component('EnvironmentOutlined', EnvironmentOutlined) app.component('EnvironmentOutlined', EnvironmentOutlined)
app.component('ExceptionOutlined', ExceptionOutlined)
app.component('ExclamationCircleOutlined', ExclamationCircleOutlined) app.component('ExclamationCircleOutlined', ExclamationCircleOutlined)
app.component('EyeInvisibleOutlined', EyeInvisibleOutlined) app.component('EyeInvisibleOutlined', EyeInvisibleOutlined)
app.component('EyeOutlined', EyeOutlined) app.component('EyeOutlined', EyeOutlined)
app.component('FieldTimeOutlined', FieldTimeOutlined) app.component('FieldTimeOutlined', FieldTimeOutlined)
app.component('FileDoneOutlined', FileDoneOutlined)
app.component('FileProtectOutlined', FileProtectOutlined) app.component('FileProtectOutlined', FileProtectOutlined)
app.component('FilterOutlined', FilterOutlined) app.component('FilterOutlined', FilterOutlined)
app.component('FilterTwoTone', FilterTwoTone) app.component('FilterTwoTone', FilterTwoTone)

View File

@ -278,7 +278,7 @@ export default {
initForm () { initForm () {
this.formRef = ref() this.formRef = ref()
this.form = reactive({ this.form = reactive({
controlnodes: 2, controlnodes: 3,
size: 1, size: 1,
noderootdisksize: 8 noderootdisksize: 8
}) })

View File

@ -333,7 +333,17 @@ export default {
result += columnDelimiter result += columnDelimiter
} }
result += typeof item[key] === 'string' && item[key].includes(columnDelimiter) ? `"${item[key]}"` : item[key] if (key === 'tags') {
var tags = '"'
if (item[key].length > 0) {
item[key].forEach(tag => {
tags += '(' + tag.key + ',' + tag.value + ')'
})
}
result += tags + '"'
} else {
result += typeof item[key] === 'string' && item[key].includes(columnDelimiter) ? `"${item[key]}"` : item[key]
}
ctr++ ctr++
}) })
result += lineDelimiter result += lineDelimiter