Merge remote-tracking branch 'origin/4.15'

This commit is contained in:
Rohit Yadav 2021-03-17 17:46:16 +05:30
commit 775de36688
24 changed files with 86 additions and 48 deletions

View File

@ -23,6 +23,7 @@ import org.springframework.stereotype.Component;
import com.cloud.projects.ProjectAccount; import com.cloud.projects.ProjectAccount;
import com.cloud.projects.ProjectAccountVO; import com.cloud.projects.ProjectAccountVO;
import com.cloud.utils.db.Filter;
import com.cloud.utils.db.GenericDaoBase; import com.cloud.utils.db.GenericDaoBase;
import com.cloud.utils.db.GenericSearchBuilder; import com.cloud.utils.db.GenericSearchBuilder;
import com.cloud.utils.db.SearchBuilder; import com.cloud.utils.db.SearchBuilder;
@ -96,8 +97,8 @@ public class ProjectAccountDaoImpl extends GenericDaoBase<ProjectAccountVO, Long
public List<ProjectAccountVO> listByProjectId(long projectId) { public List<ProjectAccountVO> listByProjectId(long projectId) {
SearchCriteria<ProjectAccountVO> sc = AllFieldsSearch.create(); SearchCriteria<ProjectAccountVO> sc = AllFieldsSearch.create();
sc.setParameters("projectId", projectId); sc.setParameters("projectId", projectId);
Filter filter = new Filter(ProjectAccountVO.class, "id", Boolean.TRUE, null, null);
return listBy(sc); return listBy(sc, filter);
} }
@Override @Override

View File

@ -675,11 +675,9 @@ public class CapacityManagerImpl extends ManagerBase implements CapacityManager,
Map<String, String> vmDetails = _userVmDetailsDao.listDetailsKeyPairs(vm.getId()); Map<String, String> vmDetails = _userVmDetailsDao.listDetailsKeyPairs(vm.getId());
String vmDetailCpu = vmDetails.get("cpuOvercommitRatio"); String vmDetailCpu = vmDetails.get("cpuOvercommitRatio");
String vmDetailRam = vmDetails.get("memoryOvercommitRatio"); String vmDetailRam = vmDetails.get("memoryOvercommitRatio");
if (vmDetailCpu != null) { // if vmDetailCpu or vmDetailRam is not null it means it is running in a overcommitted cluster.
//if vmDetail_cpu is not null it means it is running in a overcommited cluster. cpuOvercommitRatio = (vmDetailCpu != null) ? Float.parseFloat(vmDetailCpu) : clusterCpuOvercommitRatio;
cpuOvercommitRatio = Float.parseFloat(vmDetailCpu); ramOvercommitRatio = (vmDetailRam != null) ? Float.parseFloat(vmDetailRam) : clusterRamOvercommitRatio;
ramOvercommitRatio = Float.parseFloat(vmDetailRam);
}
ServiceOffering so = offeringsMap.get(vm.getServiceOfferingId()); ServiceOffering so = offeringsMap.get(vm.getServiceOfferingId());
if (so == null) { if (so == null) {
so = _offeringsDao.findByIdIncludingRemoved(vm.getServiceOfferingId()); so = _offeringsDao.findByIdIncludingRemoved(vm.getServiceOfferingId());

View File

@ -495,8 +495,10 @@ public class ConsoleProxyServlet extends HttpServlet {
if (param.getHypervHost() != null || !ConsoleProxyManager.NoVncConsoleDefault.value()) { if (param.getHypervHost() != null || !ConsoleProxyManager.NoVncConsoleDefault.value()) {
sb.append("/ajax?token=" + encryptor.encryptObject(ConsoleProxyClientParam.class, param)); sb.append("/ajax?token=" + encryptor.encryptObject(ConsoleProxyClientParam.class, param));
} else { } else {
sb.append("/resource/noVNC/vnc.html?port=" + ConsoleProxyManager.DEFAULT_NOVNC_PORT + "&token=" sb.append("/resource/noVNC/vnc.html")
+ encryptor.encryptObject(ConsoleProxyClientParam.class, param)); .append("?autoconnect=true")
.append("&port=" + ConsoleProxyManager.DEFAULT_NOVNC_PORT)
.append("&token=" + encryptor.encryptObject(ConsoleProxyClientParam.class, param));
} }
// for console access, we need guest OS type to help implement keyboard // for console access, we need guest OS type to help implement keyboard

View File

@ -672,6 +672,10 @@ select:active {
max-width: 100%; max-width: 100%;
} }
:root:not(.noVNC_connected) #noVNC_fullscreen_button {
display: none;
}
/* Settings */ /* Settings */
#noVNC_settings { #noVNC_settings {
} }

View File

@ -333,9 +333,4 @@
<source src="app/sounds/bell.mp3" type="audio/mpeg"> <source src="app/sounds/bell.mp3" type="audio/mpeg">
</audio> </audio>
</body> </body>
<script type="application/javascript">
window.onload = function() {
document.getElementById("noVNC_connect_button").click();
}
</script>
</html> </html>

View File

@ -202,6 +202,8 @@
"label.action.generate.keys": "Generate Keys", "label.action.generate.keys": "Generate Keys",
"label.action.generate.keys.processing": "Generate Keys....", "label.action.generate.keys.processing": "Generate Keys....",
"label.action.get.diagnostics": "Get Diagnostics Data", "label.action.get.diagnostics": "Get Diagnostics Data",
"label.action.image.store.read.only": "Make Image store read-only",
"label.action.image.store.read.write": "Make Image store read-write",
"label.action.iso.permission": "Update ISO Permissions", "label.action.iso.permission": "Update ISO Permissions",
"label.action.iso.share": "Update ISO Sharing", "label.action.iso.share": "Update ISO Sharing",
"label.action.list.nexusvswitch": "List Nexus 1000v", "label.action.list.nexusvswitch": "List Nexus 1000v",
@ -2438,6 +2440,8 @@
"message.action.revert.snapshot": "Please confirm that you want to revert the owning volume to this snapshot.", "message.action.revert.snapshot": "Please confirm that you want to revert the owning volume to this snapshot.",
"message.action.router.health.checks": "Health checks result will be fetched from router.", "message.action.router.health.checks": "Health checks result will be fetched from router.",
"message.action.router.health.checks.disabled.warning": "Please enable router health checks.", "message.action.router.health.checks.disabled.warning": "Please enable router health checks.",
"message.action.secondary.storage.read.only": "Please confirm that you want to make this secondary storage read only.",
"message.action.secondary.storage.read.write": "Please confirm that you want to make this secondary storage read write.",
"message.action.secure.host": "This will restart the host agent and libvirtd process after applying new X509 certificates, please confirm?", "message.action.secure.host": "This will restart the host agent and libvirtd process after applying new X509 certificates, please confirm?",
"message.action.settings.warning.vm.running": "Please stop the virtual machine to access settings", "message.action.settings.warning.vm.running": "Please stop the virtual machine to access settings",
"message.action.settings.warning.vm.started": "Virtual machine has been started. It needs to be stopped to access settings", "message.action.settings.warning.vm.started": "Virtual machine has been started. It needs to be stopped to access settings",
@ -3057,7 +3061,7 @@
"message.restart.mgmt.usage.server": "Please restart your management server(s) and usage server(s) for your new settings to take effect.", "message.restart.mgmt.usage.server": "Please restart your management server(s) and usage server(s) for your new settings to take effect.",
"message.restart.network": "All services provided by this network will be interrupted. Please confirm that you want to restart this network.", "message.restart.network": "All services provided by this network will be interrupted. Please confirm that you want to restart this network.",
"message.restart.vpc": "Please confirm that you want to restart the VPC", "message.restart.vpc": "Please confirm that you want to restart the VPC",
"message.restart.vpc.remark": "Please confirm that you want to restart the VPC <p><small><i>Remark: making a non-redundant VPC redundant will force a clean up. The networks will not be available for a couple of minutes</i>.</small></p>", "message.restart.vpc.remark": "Please confirm that you want to restart the VPC <p><i>Remark: making a non-redundant VPC redundant will force a clean up. The networks will not be available for a couple of minutes</i>.</p>",
"message.restorevm": "Do you want to restore the VM ?", "message.restorevm": "Do you want to restore the VM ?",
"message.role.ordering.fail": "Reordering of rule permissions aborted as the list has changed while you were making changes. Please try again.", "message.role.ordering.fail": "Reordering of rule permissions aborted as the list has changed while you were making changes. Please try again.",
"message.role.update.fail": "Failed updating rule permission", "message.role.update.fail": "Failed updating rule permission",
@ -3191,6 +3195,7 @@
"message.update.ipaddress.processing": "Updating IP Address...", "message.update.ipaddress.processing": "Updating IP Address...",
"message.update.os.preference": "Please choose a OS preference for this host. All virtual instances with similar preferences will be first allocated to this host before choosing another.", "message.update.os.preference": "Please choose a OS preference for this host. All virtual instances with similar preferences will be first allocated to this host before choosing another.",
"message.update.resource.count": "Please confirm that you want to update resource counts for this account.", "message.update.resource.count": "Please confirm that you want to update resource counts for this account.",
"message.update.resource.count.domain": "Please confirm that you want to update resource counts for this domain.",
"message.update.ssl": "Please submit a new X.509 compliant SSL certificate chain to be updated to each console proxy and secondary storage virtual instance:", "message.update.ssl": "Please submit a new X.509 compliant SSL certificate chain to be updated to each console proxy and secondary storage virtual instance:",
"message.update.ssl.failed": "Failed to update SSL Certificate.", "message.update.ssl.failed": "Failed to update SSL Certificate.",
"message.update.ssl.succeeded": "Update SSL Certificates succeeded", "message.update.ssl.succeeded": "Update SSL Certificates succeeded",

View File

@ -17,7 +17,12 @@
<template> <template>
<span class="row-action-button"> <span class="row-action-button">
<a-tooltip arrowPointAtCenter placement="bottomRight">
<template slot="title">
{{ $t('label.view.console') }}
</template>
<console :resource="resource" :size="size" v-if="resource && resource.id && dataView" /> <console :resource="resource" :size="size" v-if="resource && resource.id && dataView" />
</a-tooltip>
<a-tooltip <a-tooltip
v-for="(action, actionIndex) in actions" v-for="(action, actionIndex) in actions"
:key="actionIndex" :key="actionIndex"

View File

@ -311,7 +311,7 @@ export default {
message: 'message.action.instance.reset.password', message: 'message.action.instance.reset.password',
dataView: true, dataView: true,
show: (record) => { return ['Running', 'Stopped'].includes(record.state) && record.passwordenabled }, show: (record) => { return ['Running', 'Stopped'].includes(record.state) && record.passwordenabled },
response: (result) => { return result.virtualmachine && result.virtualmachine.password ? `Password of the VM is ${result.virtualmachine.password}` : null } response: (result) => { return result.virtualmachine && result.virtualmachine.password ? `The password of VM <b>${result.virtualmachine.displayname}</b> is <b>${result.virtualmachine.password}</b>` : null }
}, },
{ {
api: 'resetSSHKeyForVirtualMachine', api: 'resetSSHKeyForVirtualMachine',
@ -537,6 +537,7 @@ export default {
api: 'deleteSSHKeyPair', api: 'deleteSSHKeyPair',
icon: 'delete', icon: 'delete',
label: 'label.remove.ssh.key.pair', label: 'label.remove.ssh.key.pair',
message: 'message.please.confirm.remove.ssh.key.pair',
dataView: true, dataView: true,
args: ['name', 'account', 'domainid'], args: ['name', 'account', 'domainid'],
mapping: { mapping: {

View File

@ -93,7 +93,7 @@ export default {
api: 'updateResourceCount', api: 'updateResourceCount',
icon: 'sync', icon: 'sync',
label: 'label.action.update.resource.count', label: 'label.action.update.resource.count',
message: 'message.update.resource.count', message: 'message.update.resource.count.domain',
listView: true, listView: true,
dataView: true, dataView: true,
args: ['domainid'], args: ['domainid'],

View File

@ -104,6 +104,7 @@ export default {
api: 'migrateSystemVm', api: 'migrateSystemVm',
icon: 'drag', icon: 'drag',
label: 'label.action.migrate.router', label: 'label.action.migrate.router',
message: 'message.migrate.router.confirm',
dataView: true, dataView: true,
show: (record, store) => { return record.state === 'Running' && ['Admin'].includes(store.userInfo.roletype) }, show: (record, store) => { return record.state === 'Running' && ['Admin'].includes(store.userInfo.roletype) },
component: () => import('@/views/compute/MigrateWizard'), component: () => import('@/views/compute/MigrateWizard'),

View File

@ -61,17 +61,11 @@ export default {
popup: true, popup: true,
component: () => import('@/views/infra/AddSecondaryStorage.vue') component: () => import('@/views/infra/AddSecondaryStorage.vue')
}, },
{
api: 'deleteImageStore',
icon: 'delete',
label: 'label.action.delete.secondary.storage',
message: 'message.action.delete.secondary.storage',
dataView: true
},
{ {
api: 'updateImageStore', api: 'updateImageStore',
icon: 'stop', icon: 'stop',
label: 'Make Image store read-only', label: 'label.action.image.store.read.only',
message: 'message.action.secondary.storage.read.only',
dataView: true, dataView: true,
defaultArgs: { readonly: true }, defaultArgs: { readonly: true },
show: (record) => { return record.readonly === false } show: (record) => { return record.readonly === false }
@ -79,10 +73,18 @@ export default {
{ {
api: 'updateImageStore', api: 'updateImageStore',
icon: 'check-circle', icon: 'check-circle',
label: 'Make Image store read-write', label: 'label.action.image.store.read.write',
message: 'message.action.secondary.storage.read.write',
dataView: true, dataView: true,
defaultArgs: { readonly: false }, defaultArgs: { readonly: false },
show: (record) => { return record.readonly === true } show: (record) => { return record.readonly === true }
},
{
api: 'deleteImageStore',
icon: 'delete',
label: 'label.action.delete.secondary.storage',
message: 'message.action.delete.secondary.storage',
dataView: true
} }
] ]
} }

View File

@ -69,6 +69,7 @@ export default {
api: 'migrateSystemVm', api: 'migrateSystemVm',
icon: 'drag', icon: 'drag',
label: 'label.action.migrate.systemvm', label: 'label.action.migrate.systemvm',
message: 'message.migrate.systemvm.confirm',
dataView: true, dataView: true,
show: (record, store) => { return record.state === 'Running' && ['Admin'].includes(store.userInfo.roletype) }, show: (record, store) => { return record.state === 'Running' && ['Admin'].includes(store.userInfo.roletype) },
component: () => import('@/views/compute/MigrateWizard'), component: () => import('@/views/compute/MigrateWizard'),

View File

@ -85,6 +85,7 @@ export default {
api: 'restartNetwork', api: 'restartNetwork',
icon: 'sync', icon: 'sync',
label: 'label.restart.network', label: 'label.restart.network',
message: 'message.restart.network',
dataView: true, dataView: true,
args: ['cleanup'], args: ['cleanup'],
show: (record) => record.type !== 'L2' show: (record) => record.type !== 'L2'
@ -165,7 +166,7 @@ export default {
api: 'restartVPC', api: 'restartVPC',
icon: 'sync', icon: 'sync',
label: 'label.restart.vpc', label: 'label.restart.vpc',
message: 'message.restart.vpc', message: (record) => { return record.redundantvpcrouter ? 'message.restart.vpc' : 'message.restart.vpc.remark' },
dataView: true, dataView: true,
args: (record) => { args: (record) => {
var fields = ['cleanup'] var fields = ['cleanup']

View File

@ -727,6 +727,13 @@ export default {
return 0 return 0
}) })
this.currentAction.paramFields = [] this.currentAction.paramFields = []
if ('message' in action) {
var message = action.message
if (typeof action.message === 'function') {
message = action.message(action.resource)
}
action.message = message
}
if ('args' in action) { if ('args' in action) {
var args = action.args var args = action.args
if (typeof action.args === 'function') { if (typeof action.args === 'function') {

View File

@ -17,14 +17,16 @@
<template> <template>
<div> <div>
<p v-html="$t('message.assign.instance.another')"></p>
<div class="form"> <div class="form">
<div v-if="loading" class="loading"> <div v-if="loading" class="loading">
<a-icon type="loading" style="color: #1890ff;"></a-icon> <a-icon type="loading" style="color: #1890ff;"></a-icon>
</div> </div>
<a-alert type="warning" style="margin-bottom: 20px">
<span slot="message" v-html="$t('message.assign.instance.another')"></span>
</a-alert>
<div class="form__item"> <div class="form__item">
<p class="form__label">{{ $t('label.accounttype') }}</p> <p class="form__label">{{ $t('label.accounttype') }}</p>
<a-select v-model="selectedAccountType" defaultValue="account"> <a-select v-model="selectedAccountType" defaultValue="account">
@ -226,6 +228,12 @@ export default {
<style scoped lang="scss"> <style scoped lang="scss">
.form { .form {
width: 85vw;
@media (min-width: 760px) {
width: 500px;
}
display: flex; display: flex;
flex-direction: column; flex-direction: column;

View File

@ -255,7 +255,7 @@ export default {
successMethod: () => { successMethod: () => {
this.parentFetchData() this.parentFetchData()
}, },
response: (result) => { return result.virtualmachine && result.virtualmachine.password ? `Password of the VM is ${result.virtualmachine.password}` : null } response: (result) => { return result.virtualmachine && result.virtualmachine.password ? `The password of VM <b>${result.virtualmachine.displayname}</b> is <b>${result.virtualmachine.password}</b>` : null }
}) })
this.closeAction() this.closeAction()
}).catch(error => { }).catch(error => {

View File

@ -369,7 +369,7 @@ export default {
params.networkdomain = values.networkdomain params.networkdomain = values.networkdomain
} }
api('createAccount', params).then(response => { api('createAccount', {}, 'POST', params).then(response => {
this.$emit('refresh-data') this.$emit('refresh-data')
this.$notification.success({ this.$notification.success({
message: this.$t('label.create.account'), message: this.$t('label.create.account'),

View File

@ -37,6 +37,9 @@
:form="form" :form="form"
@submit="handleSubmit" @submit="handleSubmit"
layout="vertical" > layout="vertical" >
<a-alert type="warning" v-if="action.message">
<span slot="message" v-html="$t(action.message)" />
</a-alert>
<a-form-item <a-form-item
v-for="(field, fieldIndex) in action.paramFields" v-for="(field, fieldIndex) in action.paramFields"
:key="fieldIndex" :key="fieldIndex"

View File

@ -88,7 +88,9 @@
:form="form" :form="form"
@submit="addUserToProject" @submit="addUserToProject"
layout="vertical"> layout="vertical">
<p v-html="$t('message.add.user.to.project')"></p> <a-alert type="warning" style="margin-bottom: 20px">
<span slot="message" v-html="$t('message.add.user.to.project')"></span>
</a-alert>
<a-form-item> <a-form-item>
<span slot="label"> <span slot="label">
{{ $t('label.user') }} {{ $t('label.user') }}

View File

@ -133,7 +133,7 @@ export default {
updateTable: false, updateTable: false,
rules: null, rules: null,
newRule: '', newRule: '',
newRulePermission: 'allow', newRulePermission: 'deny',
newRuleDescription: '', newRuleDescription: '',
newRuleSelectError: false, newRuleSelectError: false,
drag: false, drag: false,
@ -159,7 +159,7 @@ export default {
}, },
resetNewFields () { resetNewFields () {
this.newRule = '' this.newRule = ''
this.newRulePermission = 'allow' this.newRulePermission = 'deny'
this.newRuleDescription = '' this.newRuleDescription = ''
this.newRuleSelectError = false this.newRuleSelectError = false
}, },

View File

@ -18,9 +18,9 @@
<template> <template>
<a-spin :spinning="loading"> <a-spin :spinning="loading">
<div class="form-layout"> <div class="form-layout">
<label> <a-alert type="warning">
{{ $t('label.header.volume.snapshot') }} <span slot="message" v-html="$t('label.header.volume.snapshot')" />
</label> </a-alert>
<div class="form"> <div class="form">
<a-form <a-form
:form="form" :form="form"

View File

@ -17,9 +17,11 @@
<template> <template>
<div class="migrate-volume-container"> <div class="migrate-volume-container">
<div class="modal-form"> <div class="modal-form">
<div v-if="storagePools.length > 0"> <div v-if="storagePools.length > 0">
<a-alert type="warning">
<span slot="message" v-html="$t('message.migrate.volume')" />
</a-alert>
<p class="modal-form__label">{{ $t('label.storagepool') }}</p> <p class="modal-form__label">{{ $t('label.storagepool') }}</p>
<a-select v-model="selectedStoragePool" style="width: 100%;"> <a-select v-model="selectedStoragePool" style="width: 100%;">
<a-select-option v-for="(storagePool, index) in storagePools" :value="storagePool.id" :key="index"> <a-select-option v-for="(storagePool, index) in storagePools" :value="storagePool.id" :key="index">
@ -168,11 +170,10 @@ export default {
<style scoped lang="scss"> <style scoped lang="scss">
.migrate-volume-container { .migrate-volume-container {
width: 95vw; width: 85vw;
max-width: 100%;
@media (min-width: 760px) { @media (min-width: 760px) {
width: 50vw; width: 500px;
} }
} }

View File

@ -142,9 +142,10 @@ export default {
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.form-layout { .form-layout {
width: 75vw; width: 85vw;
@media (min-width: 700px) {
width: 40vw; @media (min-width: 760px) {
width: 500px;
} }
} }
.action-button { .action-button {

View File

@ -18,9 +18,9 @@
<template> <template>
<div class="take-snapshot"> <div class="take-snapshot">
<a-spin :spinning="loading || actionLoading"> <a-spin :spinning="loading || actionLoading">
<label> <a-alert type="warning">
{{ $t('label.header.volume.take.snapshot') }} <span slot="message" v-html="$t('label.header.volume.take.snapshot')" />
</label> </a-alert>
<a-form <a-form
class="form" class="form"
:form="form" :form="form"