Merge "fix: support capacity expansion of volume when instance is locked"

This commit is contained in:
Zuul 2022-08-26 11:07:23 +00:00 committed by Gerrit Code Review
commit 569aaa2b05
4 changed files with 3 additions and 33 deletions

View File

@ -1371,7 +1371,7 @@
"Lock": "Lock",
"Lock Instance": "Lock Instance",
"Lock Status": "Lock Status",
"Lock instance will lock the operations that have a direct impact on the operation of the instance, such as shutdown, restart, delete, etc. It does not involve the mounting, unmounting and capacity expansion of volume.": "Lock instance will lock the operations that have a direct impact on the operation of the instance, such as shutdown, restart, delete, etc. It does not involve the mounting, unmounting and capacity expansion of volume.",
"Lock instance will lock the operations that have a direct impact on the operation of the instance, such as: shutdown, restart, delete, the mounting and unmounting of volume, etc. It does not involve the capacity expansion and change type of volume.": "Lock instance will lock the operations that have a direct impact on the operation of the instance, such as: shutdown, restart, delete, the mounting and unmounting of volume, etc. It does not involve the capacity expansion and change type of volume.",
"Locked": "Locked",
"Log": "Log",
"Log in": "Log in",

View File

@ -1371,7 +1371,7 @@
"Lock": "锁定",
"Lock Instance": "锁定云主机",
"Lock Status": "锁定状态",
"Lock instance will lock the operations that have a direct impact on the operation of the instance, such as shutdown, restart, delete, etc. It does not involve the mounting, unmounting and capacity expansion of volume.": "云主机锁定操作会锁定对云主机运行有直接影响的操作, 例如: 关机, 重启, 删除等,不涉及云硬盘的挂载卸载和扩容。",
"Lock instance will lock the operations that have a direct impact on the operation of the instance, such as: shutdown, restart, delete, the mounting and unmounting of volume, etc. It does not involve the capacity expansion and change type of volume.": "云主机锁定操作会锁定对云主机运行有直接影响的操作, 例如: 关机、重启、删除,云硬盘的挂载、卸载等,不涉及到云硬盘的扩容与变更类型。",
"Locked": "锁定",
"Log": "日志",
"Log in": "登录",

View File

@ -70,7 +70,7 @@ export default class LockAction extends ConfirmAction {
name,
}) +
t(
'Lock instance will lock the operations that have a direct impact on the operation of the instance, such as shutdown, restart, delete, etc. It does not involve the mounting, unmounting and capacity expansion of volume.'
'Lock instance will lock the operations that have a direct impact on the operation of the instance, such as: shutdown, restart, delete, the mounting and unmounting of volume, etc. It does not involve the capacity expansion and change type of volume.'
)
);
};

View File

@ -16,7 +16,6 @@ import { inject, observer } from 'mobx-react';
import { ModalAction } from 'containers/Action';
import globalVolumeStore, { VolumeStore } from 'stores/cinder/volume';
import globalProjectStore from 'stores/keystone/project';
import globalServerStore from 'stores/nova/instance';
import {
isAvailableOrInUse,
setCreateVolumeSize,
@ -45,7 +44,6 @@ export class ExtendVolume extends ModalAction {
this.volumeStore = new VolumeStore();
this.projectStore = globalProjectStore;
fetchQuota(this, 1, this.item.volume_type);
this.checkAttachedServer();
}
get tips() {
@ -78,34 +76,6 @@ export class ExtendVolume extends ModalAction {
return [rest, typeSizeData];
}
async checkAttachedServer() {
const instanceIds = (this.item.attachments || []).map((it) => it.server_id);
if (!instanceIds.length) {
return;
}
const reqs = instanceIds.map((id) =>
globalServerStore.pureFetchDetail({ id })
);
const results = await Promise.allSettled(reqs);
const lockedInstances = results
.filter(({ status }) => {
return status === 'fulfilled';
})
.map((it) => it.value)
.filter((server) => server.locked)
.map(({ name }) => name);
if (lockedInstances.length) {
const name = lockedInstances.join(', ');
const lockedError = t(
'The server {name} is locked. Please unlock first.',
{ name }
);
this.setState({
lockedError,
});
}
}
get isQuotaLimited() {
const { gigabytes: { limit } = {} } = this.projectStore.cinderQuota || {};
return limit !== -1;