Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,5 +81,5 @@ yarn build
### Make docker image

```bash
REGISTRY=registry.cn-beijing.aliyuncs.com/yunionio TAG=your-tag ./scripts/docker-push.sh
REGISTRY=registry.cn-beijing.aliyuncs.com/yunionio TAG=your-tag ./scripts/docker_push.sh
```
6 changes: 5 additions & 1 deletion containers/Compute/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -1708,5 +1708,9 @@
"compute.storage.check_status.host_status": "Host service or status is abnormal",
"compute.vmware.transfer.message": "Prompt message: The migration host must belong to the same Layer 2 network and the target host must be in normal state",
"compute.storage.check_status.status": "The block storage status is abnormal",
"compute.storage.check_status.enabled": "Block storage is not enabled"
"compute.storage.check_status.enabled": "Block storage is not enabled",
"compute.start_rescue": "Start Rescue",
"compute.stop_rescue": "Stop Rescue",
"compute.start_rescue_tips": "Use the account password below to access the rescue system. After exiting Rescue Mode, use the original account password to access. Instance memory requires 2GB or more.",
"compute.start_rescue_default_config": "Account:root Password:mosbaremetal"
}
6 changes: 5 additions & 1 deletion containers/Compute/locales/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -1711,5 +1711,9 @@
"compute.storage.check_status.host_status": "宿主机服务或状态异常",
"compute.vmware.transfer.message": "提示信息:迁移宿主机需属于同一个二层网络且目标宿主机状态正常",
"compute.storage.check_status.status": "块存储状态异常",
"compute.storage.check_status.enabled": "块存储未启用"
"compute.storage.check_status.enabled": "块存储未启用",
"compute.start_rescue": "启动救援",
"compute.stop_rescue": "退出救援",
"compute.start_rescue_tips": "使用下面的账号密码进入救援系统。退出救援模式后,使用原账号密码访问。实例内存需要2GB以上。",
"compute.start_rescue_default_config": "账号:root 密码:mosbaremetal"
}
32 changes: 32 additions & 0 deletions containers/Compute/views/vminstance/constants/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -476,6 +476,38 @@ const getSingleActions = function () {
},
hidden: () => !(hasSetupKey(['onecloud'])) || this.$isScopedPolicyMenuHidden('vminstance_hidden_menus.server_perform_sync_config'),
},
// 启动救援模式
{
label: i18n.t('compute.start_rescue'),
permission: 'server_perform_start_rescue',
action: () => {
this.createDialog('VmStartRescueDialog', {
data: [obj],
columns: this.columns,
onManager: this.onManager,
})
},
meta: () => {
return { validate: cloudEnabled('startRescue', obj) }
},
hidden: () => this.$isScopedPolicyMenuHidden('vminstance_hidden_menus.server_perform_start_rescue'),
},
// 退出救援模式 TODO
{
label: i18n.t('compute.stop_rescue'),
permission: 'server_perform_stop_rescue',
action: () => {
this.createDialog('VmStopRescueDialog', {
data: [obj],
columns: this.columns,
onManager: this.onManager,
})
},
meta: () => {
return { validate: cloudEnabled('stopRescue', obj) }
},
hidden: () => this.$isScopedPolicyMenuHidden('vminstance_hidden_menus.server_perform_stop_rescue'),
},
],
},
// * 属性设置
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
<template>
<base-dialog @cancel="cancelDialog">
<div slot="header">{{action}}</div>
<div slot="body">
<a-alert class="mb-2" type="warning">
<template v-slot:message>
<div>{{$t('compute.start_rescue_tips')}}</div>
<div class="mt-2">{{$t('compute.start_rescue_default_config')}}</div>
</template>
</a-alert>
<dialog-selected-tips :name="$t('dictionary.server')" :count="params.data.length" :action="action" />
<dialog-table :data="params.data" :columns="columns" />
</div>
<div slot="footer">
<a-button type="primary" @click="handleConfirm" :loading="loading">{{ $t('dialog.ok') }}</a-button>
<a-button @click="cancelDialog">{{ $t('dialog.cancel') }}</a-button>
</div>
</base-dialog>
</template>

<script>
import DialogMixin from '@/mixins/dialog'
import WindowsMixin from '@/mixins/windows'

export default {
name: 'VmStartRescueDialog',
mixins: [DialogMixin, WindowsMixin],
data () {
return {
loading: false,
action: this.$t('compute.start_rescue'),
}
},
computed: {
columns () {
const showFields = ['name', 'ip', 'instance_type']
return this.params.columns.filter((item) => { return showFields.includes(item.field) })
},
},
methods: {
async doStartRescueSubmit () {
const ids = this.params.data.map(item => item.id)
return this.params.onManager('batchPerformAction', {
id: ids,
steadyStatus: 'running',
managerArgs: {
action: 'start-rescue',
},
})
},
async handleConfirm () {
this.loading = true
try {
await this.doStartRescueSubmit()
this.loading = false
this.cancelDialog()
} catch (error) {
this.loading = false
}
},
},
}
</script>
57 changes: 57 additions & 0 deletions containers/Compute/views/vminstance/dialogs/VmStopRescueDialog.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
<template>
<base-dialog @cancel="cancelDialog">
<div slot="header">{{action}}</div>
<div slot="body">
<dialog-selected-tips :name="$t('dictionary.server')" :count="params.data.length" :action="action" />
<dialog-table :data="params.data" :columns="columns" />
</div>
<div slot="footer">
<a-button type="primary" @click="handleConfirm" :loading="loading">{{ $t('dialog.ok') }}</a-button>
<a-button @click="cancelDialog">{{ $t('dialog.cancel') }}</a-button>
</div>
</base-dialog>
</template>

<script>
import DialogMixin from '@/mixins/dialog'
import WindowsMixin from '@/mixins/windows'

export default {
name: 'VmStopRescueDialog',
mixins: [DialogMixin, WindowsMixin],
data () {
return {
loading: false,
action: this.$t('compute.stop_rescue'),
}
},
computed: {
columns () {
const showFields = ['name', 'ip', 'instance_type']
return this.params.columns.filter((item) => { return showFields.includes(item.field) })
},
},
methods: {
async doStopRescueSubmit () {
const ids = this.params.data.map(item => item.id)
return this.params.onManager('batchPerformAction', {
id: ids,
steadyStatus: 'running',
managerArgs: {
action: 'stop-rescue',
},
})
},
async handleConfirm () {
this.loading = true
try {
await this.doStopRescueSubmit()
this.loading = false
this.cancelDialog()
} catch (error) {
this.loading = false
}
},
},
}
</script>
13 changes: 13 additions & 0 deletions containers/Compute/views/vminstance/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -631,6 +631,19 @@ const actionEableMap = {
onecloud: ['ready'],
},
},
startRescue: {
cn: i18n.t('compute.start_rescue'),
brand: {
onecloud: ['ready', 'running'],
},
},
stopRescue: {
cn: i18n.t('compute.stop_rescue'),
brand: {
// TODO: Add rescue status in frontend.
onecloud: true,
},
},
}

export const commonEnabled = (value, statusArr = ['ready']) => {
Expand Down
2 changes: 2 additions & 0 deletions src/constants/permission.js
Original file line number Diff line number Diff line change
Expand Up @@ -434,6 +434,8 @@ export const PERMISSION = {
server_get_cpuset_cores: ['compute', 'servers', 'get', 'cpuset-cores'],
server_perform_cpuset: ['compute', 'servers', 'perform', 'cpuset'],
server_perform_make_sshable: ['compute', 'servers', 'perform', 'make-sshable'],
server_perform_start_rescue: ['compute', 'servers', 'perform', 'start-rescue'],
server_perform_stop_rescue: ['compute', 'servers', 'perform', 'stop-rescue'],
/**
* images 相关操作
*/
Expand Down
5 changes: 4 additions & 1 deletion src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,10 @@
"on": "On",
"off": "Off",
"qga_exec_command_failed": "QGA execution failed",
"convert_failed": "Convert Failed"
"convert_failed": "Convert Failed",
"start_rescue": "Start Rescue",
"rescuing": "Rescuing",
"stop_rescue": "Stop Rescue"
},
"network": {
"init": "Initialize",
Expand Down
5 changes: 4 additions & 1 deletion src/locales/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,10 @@
"on": "运行中",
"off": "关机",
"qga_exec_command_failed": "QGA执行失败",
"convert_failed": "转换失败"
"convert_failed": "转换失败",
"start_rescue": "启动救援",
"rescuing": "救援中",
"stop_rescue": "退出救援"
},
"network": {
"init": "初始化",
Expand Down