From 600d81e345f915561bdbacdb595df2d133e5cc0f Mon Sep 17 00:00:00 2001 From: Hoang Nguyen Date: Fri, 8 Jul 2022 15:23:12 +0700 Subject: [PATCH 1/3] UI: Fixes some issues from zone wizard with VMWare hypervisor (#6480) * hide html warning in message * hidden ip address step * refill value of edit tariff * close modal when icon-close clicked * fixes modal not show when error * check valid traffic label with VMWare * remove automatic change clustername --- ui/src/locales/index.js | 3 ++- ui/src/views/infra/ClusterAdd.vue | 6 +++-- .../infra/zone/ZoneWizardAddResources.vue | 6 ++--- .../ZoneWizardPhysicalNetworkSetupStep.vue | 26 ++++++++++++------- 4 files changed, 26 insertions(+), 15 deletions(-) diff --git a/ui/src/locales/index.js b/ui/src/locales/index.js index d8ff08ff4a9..29c828b6447 100644 --- a/ui/src/locales/index.js +++ b/ui/src/locales/index.js @@ -26,7 +26,8 @@ export const i18n = createI18n({ fallbackLocale: 'en', silentTranslationWarn: true, messages: messages, - silentFallbackWarn: true + silentFallbackWarn: true, + warnHtmlInMessage: 'off' }) export function loadLanguageAsync (lang) { diff --git a/ui/src/views/infra/ClusterAdd.vue b/ui/src/views/infra/ClusterAdd.vue index cbf48766997..5450db9aedd 100644 --- a/ui/src/views/infra/ClusterAdd.vue +++ b/ui/src/views/infra/ClusterAdd.vue @@ -269,10 +269,12 @@ export default { this.addCluster() }, addCluster () { + let clustername = this.clustername + if (this.hypervisor === 'VMware') { const clusternameVal = this.clustername this.url = `http://${this.host}/${this.dataCenter}/${clusternameVal}` - this.clustername = `${this.host}/${this.dataCenter}/${clusternameVal}` + clustername = `${this.host}/${this.dataCenter}/${clusternameVal}` } this.loading = true this.parentToggleLoading() @@ -281,7 +283,7 @@ export default { hypervisor: this.hypervisor, clustertype: this.clustertype, podId: this.podId, - clustername: this.clustername, + clustername: clustername, url: this.url } if (this.ovm3pool) { diff --git a/ui/src/views/infra/zone/ZoneWizardAddResources.vue b/ui/src/views/infra/zone/ZoneWizardAddResources.vue index ad16ef30aa1..bc19870776a 100644 --- a/ui/src/views/infra/zone/ZoneWizardAddResources.vue +++ b/ui/src/views/infra/zone/ZoneWizardAddResources.vue @@ -137,14 +137,14 @@ export default { return this.prefillContent?.hypervisor || null }, localstorageenabled () { - return this.prefillContent?.localstorageenabled?.value || false + return this.prefillContent?.localstorageenabled || false }, localstorageenabledforsystemvm () { - return this.prefillContent?.localstorageenabledforsystemvm?.value || false + return this.prefillContent?.localstorageenabledforsystemvm || false }, steps () { const steps = [] - const hypervisor = this.prefillContent.hypervisor ? this.prefillContent.hypervisor.value : null + const hypervisor = this.prefillContent.hypervisor ? this.prefillContent.hypervisor : null steps.push({ title: 'label.cluster', fromKey: 'clusterResource', diff --git a/ui/src/views/infra/zone/ZoneWizardPhysicalNetworkSetupStep.vue b/ui/src/views/infra/zone/ZoneWizardPhysicalNetworkSetupStep.vue index 8d4b28144e5..5be870c7964 100644 --- a/ui/src/views/infra/zone/ZoneWizardPhysicalNetworkSetupStep.vue +++ b/ui/src/views/infra/zone/ZoneWizardPhysicalNetworkSetupStep.vue @@ -143,7 +143,7 @@ -
+
{{ $t('message.required.traffic.type') }}
{{ $t('label.cancel') }} @@ -161,7 +161,7 @@ 1 let isValid = true this.requiredTrafficTypes.forEach(type => { + if (!isValid) return false let foundType = false this.physicalNetworks.forEach(net => { net.traffics.forEach(traffic => { + if (!isValid) return false if (traffic.type === type) { foundType = true } - if (shouldHaveLabels && (!traffic.label || traffic.label.length === 0)) { - isValid = false + if (this.hypervisor !== 'VMware') { + if (shouldHaveLabels && (!traffic.label || traffic.label.length === 0)) { + isValid = false + } + } else { + if (shouldHaveLabels && (!traffic.vSwitchName || traffic.vSwitchName.length === 0)) { + isValid = false + } } }) }) @@ -477,12 +485,12 @@ export default { const fields = {} if (this.hypervisor === 'VMware') { delete this.trafficInEdit.traffic.label - fields.vSwitchName = null - fields.vlanId = null + fields.vSwitchName = this.trafficInEdit?.traffic?.vSwitchName || null + fields.vlanId = this.trafficInEdit?.traffic?.vlanId || null if (traffic.type === 'guest') { fields.vSwitchName = this.trafficInEdit?.traffic?.vSwitchName || 'vSwitch0' } - fields.vSwitchType = 'vmwaresvs' + fields.vSwitchType = this.trafficInEdit?.traffic?.vSwitchType || 'vmwaresvs' } else { delete this.trafficInEdit.traffic.vSwitchName delete this.trafficInEdit.traffic.vlanId From 764ee30ecc2c508d985b3ff2ea15b0c47448c167 Mon Sep 17 00:00:00 2001 From: Abhishek Kumar Date: Fri, 8 Jul 2022 20:00:04 +0530 Subject: [PATCH 2/3] ui: fix zone icon in vm deploy zone selection (#6543) * ui: fix zone icon in vm deploy zone selection Signed-off-by: Abhishek Kumar * unnecessary conditions Signed-off-by: Abhishek Kumar --- ui/src/components/view/ResourceIcon.vue | 4 ++++ ui/src/views/compute/DeployVM.vue | 12 ++++-------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/ui/src/components/view/ResourceIcon.vue b/ui/src/components/view/ResourceIcon.vue index 28c9820bead..176c0c7ca8f 100644 --- a/ui/src/components/view/ResourceIcon.vue +++ b/ui/src/components/view/ResourceIcon.vue @@ -43,6 +43,10 @@ export default { } }, getDimensions () { + const num = Number(this.size) + if (Number.isInteger(num) && num > 0) { + return num + } switch (this.size) { case '4x': return 56 diff --git a/ui/src/views/compute/DeployVM.vue b/ui/src/views/compute/DeployVM.vue index 312860f993c..49554c699ba 100644 --- a/ui/src/views/compute/DeployVM.vue +++ b/ui/src/views/compute/DeployVM.vue @@ -45,12 +45,11 @@
- + :image="zoneItem.icon.base64image" + size="36" + style="marginTop: -30px; marginLeft: 60px" />
@@ -1487,9 +1486,6 @@ export default { 'maxmemory' in serviceOffering.serviceofferingdetails && 'maxcpunumber' in serviceOffering.serviceofferingdetails && 'minmemory' in serviceOffering.serviceofferingdetails }, - getImg (image) { - return 'data:image/png;charset=utf-8;base64, ' + image - }, updateOverrideRootDiskShowParam (val) { if (val) { this.showRootDiskSizeChanger = false From ab9a0fd69f5af774dbed51d3827c3395224f0ec5 Mon Sep 17 00:00:00 2001 From: Harikrishna Date: Sat, 9 Jul 2022 21:21:11 +0530 Subject: [PATCH 3/3] Updated log message and throw error when unable to update the secret key file (#6542) This PR fixes issue #6232 to update the error message and throw the error when updating key file is failed. This helps to find out the proper reason for failure, mainly with umask. --- .../com/cloud/utils/crypt/EncryptionSecretKeyChanger.java | 2 +- setup/bindir/cloud-setup-databases.in | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/framework/db/src/main/java/com/cloud/utils/crypt/EncryptionSecretKeyChanger.java b/framework/db/src/main/java/com/cloud/utils/crypt/EncryptionSecretKeyChanger.java index ae103ff34f6..a958d4ada72 100644 --- a/framework/db/src/main/java/com/cloud/utils/crypt/EncryptionSecretKeyChanger.java +++ b/framework/db/src/main/java/com/cloud/utils/crypt/EncryptionSecretKeyChanger.java @@ -147,7 +147,7 @@ public class EncryptionSecretKeyChanger { { bwriter.write(newMSKey); } catch (IOException e) { - System.out.println("Failed to write new secret to file. Please update the file manually"); + System.out.println(String.format("Please update the file %s manually. Failed to write new secret to file with error %s", keyFile, e.getMessage())); } } } diff --git a/setup/bindir/cloud-setup-databases.in b/setup/bindir/cloud-setup-databases.in index 37b696f9fce..0532613dd81 100755 --- a/setup/bindir/cloud-setup-databases.in +++ b/setup/bindir/cloud-setup-databases.in @@ -397,7 +397,11 @@ for example: def saveMgmtServerSecretKey(): if self.encryptiontype == 'file': - open(self.encryptionKeyFile, 'w').write(self.mgmtsecretkey) + try: + open(self.encryptionKeyFile, 'w').write(self.mgmtsecretkey) + except IOError as e: + msg = "Failed to save management server secret key file %s due to %s, also please check the default umask"%(self.encryptionKeyFile, e.strerror) + self.errorAndExit(msg) def formatEncryptResult(value): return 'ENC(%s)'%value