feat: Restore volume use snapshot
Restore volume based on its own snapshot Change-Id: I2e65474d3805b919552fbc16869a8bffda0edd08
This commit is contained in:
parent
ae3b0fa579
commit
0061ce4f15
@ -4,9 +4,11 @@
|
||||
"-1 means no connection limit": "-1 means no connection limit",
|
||||
".": ".",
|
||||
"1. The backup can only capture the data that has been written to the volume at the beginning of the backup task, excluding the data in the cache at that time.": "1. The backup can only capture the data that has been written to the volume at the beginning of the backup task, excluding the data in the cache at that time.",
|
||||
"1. The cloud disk associated with the snapshot is available.": "1. The cloud disk associated with the snapshot is available.",
|
||||
"1. The name of the custom resource class property should start with CUSTOM_, can only contain uppercase letters A ~ Z, numbers 0 ~ 9 or underscores, and the length should not exceed 255 characters (for example: CUSTOM_BAREMETAL_SMALL).": "1. The name of the custom resource class property should start with CUSTOM_, can only contain uppercase letters A ~ Z, numbers 0 ~ 9 or underscores, and the length should not exceed 255 characters (for example: CUSTOM_BAREMETAL_SMALL).",
|
||||
"1. The name of the trait should start with CUSTOM_, can only contain uppercase letters A ~ Z, numbers 0 ~ 9 or underscores, and the length should not exceed 255 characters (for example: CUSTOM_TRAIT1).": "1. The name of the trait should start with CUSTOM_, can only contain uppercase letters A ~ Z, numbers 0 ~ 9 or underscores, and the length should not exceed 255 characters (for example: CUSTOM_TRAIT1).",
|
||||
"1. The volume associated with the backup is available.": "1. The volume associated with the backup is available.",
|
||||
"2. The cloud hard disk associated with the snapshot has been mounted, and the cloud host is shut down.": "2. The cloud hard disk associated with the snapshot has been mounted, and the cloud host is shut down.",
|
||||
"2. The trait of the scheduled node needs to correspond to the trait of the flavor used by the ironic instance; by injecting the necessary traits into the ironic instance, the computing service will only schedule the instance to the bare metal node with all the necessary traits (for example, the ironic instance which use the flavor that has CUSTOM_TRAIT1 as a necessary trait, can be scheduled to the node which has the trait of CUSTOM_TRAIT1).": "2. The trait of the scheduled node needs to correspond to the trait of the flavor used by the ironic instance; by injecting the necessary traits into the ironic instance, the computing service will only schedule the instance to the bare metal node with all the necessary traits (for example, the ironic instance which use the flavor that has CUSTOM_TRAIT1 as a necessary trait, can be scheduled to the node which has the trait of CUSTOM_TRAIT1).",
|
||||
"2. The volume associated with the backup has been mounted, and the instance is shut down.": "2. The volume associated with the backup has been mounted, and the instance is shut down.",
|
||||
"2. To ensure the integrity of the data, it is recommended that you suspend the write operation of all files when creating a backup.": "2. To ensure the integrity of the data, it is recommended that you suspend the write operation of all files when creating a backup.",
|
||||
@ -221,6 +223,7 @@
|
||||
"Check Failed": "Check Failed",
|
||||
"Check In Progress": "Check In Progress",
|
||||
"Checksum": "Checksum",
|
||||
"Choose Snapshot": "Choose Snapshot",
|
||||
"Choose a host to live migrate instance to. If not selected, the scheduler will auto select target host.": "Choose a host to live migrate instance to. If not selected, the scheduler will auto select target host.",
|
||||
"Choose a host to migrate instance to. If not selected, the scheduler will auto select target host.": "Choose a host to migrate instance to. If not selected, the scheduler will auto select target host.",
|
||||
"Choosing a QoS policy can limit bandwidth and DSCP": "Choosing a QoS policy can limit bandwidth and DSCP",
|
||||
@ -1300,9 +1303,9 @@
|
||||
"Resource Type": "Resource Type",
|
||||
"Resource Types": "Resource Types",
|
||||
"Resources Synced": "Resources Synced",
|
||||
"Restore": "Restore",
|
||||
"Restore Backup": "Restore Backup",
|
||||
"Restore backup": "Restore backup",
|
||||
"Restore from snapshot": "Restore from snapshot",
|
||||
"Restoring": "Restoring",
|
||||
"Restoring Backup": "Restoring Backup",
|
||||
"Resume": "Resume",
|
||||
@ -1313,6 +1316,7 @@
|
||||
"Resuming": "Resuming",
|
||||
"Retyping": "Retyping",
|
||||
"Revert Resize/Migrate": "Revert Resize/Migrate",
|
||||
"Reverting": "Reverting",
|
||||
"Reverting Resize or Migrate": "Reverting Resize or Migrate",
|
||||
"Role": "Role",
|
||||
"Role Detail": "Role Detail",
|
||||
@ -1708,6 +1712,7 @@
|
||||
"When you delete an instance, the following resources will be released(Non-root disks will be unmounted and retained):": "When you delete an instance, the following resources will be released(Non-root disks will be unmounted and retained):",
|
||||
"When you do online backup of the volume that has been bound, you need to pay attention to the following points:": "When you do online backup of the volume that has been bound, you need to pay attention to the following points:",
|
||||
"When you restore a backup, you need to meet one of the following conditions:": "When you restore a backup, you need to meet one of the following conditions:",
|
||||
"When you restore a snapshot, one of the following conditions must be met:": "When you restore a snapshot, one of the following conditions must be met:",
|
||||
"When your Yaml file is a fixed template, variable variables can be stored in an environment variable file to implement template deployment. The parameters in the environment variable file need to match the parameters defined in the template file.": "When your Yaml file is a fixed template, variable variables can be stored in an environment variable file to implement template deployment. The parameters in the environment variable file need to match the parameters defined in the template file.",
|
||||
"Whether the Login Name can be used is up to the feasible configuration of cloud-init or cloudbase-init service in the image.": "Whether the Login Name can be used is up to the feasible configuration of cloud-init or cloudbase-init service in the image.",
|
||||
"Whether the boot device should be set only for the next reboot, or persistently.": "Whether the boot device should be set only for the next reboot, or persistently.",
|
||||
|
@ -4,9 +4,11 @@
|
||||
"-1 means no connection limit": "-1表示无连接限制",
|
||||
".": "。",
|
||||
"1. The backup can only capture the data that has been written to the volume at the beginning of the backup task, excluding the data in the cache at that time.": "1. 备份只能捕获在备份任务开始时已经写入磁盘的数据,不包括当时位于缓存的数据。",
|
||||
"1. The cloud disk associated with the snapshot is available.": "1. 快照关联的云硬盘处于可用状态。",
|
||||
"1. The name of the custom resource class property should start with CUSTOM_, can only contain uppercase letters A ~ Z, numbers 0 ~ 9 or underscores, and the length should not exceed 255 characters (for example: CUSTOM_BAREMETAL_SMALL).": "1. 自定义资源属性的命名应该以 CUSTOM_ 开头、只能包含大写字母A ~ Z、数字0 ~ 9或下划线、长度不超过255个字符(比如:CUSTOM_BAREMETAL_SMALL)。",
|
||||
"1. The name of the trait should start with CUSTOM_, can only contain uppercase letters A ~ Z, numbers 0 ~ 9 or underscores, and the length should not exceed 255 characters (for example: CUSTOM_TRAIT1).": "1. 特性的命名应该以 CUSTOM_ 开头、只能包含大写字母A ~ Z、数字0 ~ 9或下划线、长度不超过255个字符(比如:CUSTOM_TRAIT1)。",
|
||||
"1. The volume associated with the backup is available.": "1. 备份关联的云硬盘处于可用状态。",
|
||||
"2. The cloud hard disk associated with the snapshot has been mounted, and the cloud host is shut down.": "2. 快照关联的云硬盘已被挂载,且云主机处于关机状态。",
|
||||
"2. The trait of the scheduled node needs to correspond to the trait of the flavor used by the ironic instance; by injecting the necessary traits into the ironic instance, the computing service will only schedule the instance to the bare metal node with all the necessary traits (for example, the ironic instance which use the flavor that has CUSTOM_TRAIT1 as a necessary trait, can be scheduled to the node which has the trait of CUSTOM_TRAIT1).": "2. 被调度节点的特性需要与裸机实例使用的云主机类型的特性对应;通过给裸机实例注入必需特性,计算服务将只调度实例到具有所有必需特性的裸金属节点(比如:调度节点的有 CUSTOM_TRAIT1 特性, 云主机类型添加CUSTOM_TRAIT1为必要特性,可以调度到此节点)。",
|
||||
"2. The volume associated with the backup has been mounted, and the instance is shut down.": "2. 备份关联的云硬盘已被挂载,且云主机处于关机状态。",
|
||||
"2. To ensure the integrity of the data, it is recommended that you suspend the write operation of all files when creating a backup.": "2. 为了保证数据的完整性,建议您在创建备份时暂停所有文件的写操作。",
|
||||
@ -221,6 +223,7 @@
|
||||
"Check Failed": "检查失败",
|
||||
"Check In Progress": "正在检查",
|
||||
"Checksum": "校验和",
|
||||
"Choose Snapshot": "选择快照",
|
||||
"Choose a host to live migrate instance to. If not selected, the scheduler will auto select target host.": "选择计算节点来热迁移云主机,如果没有选择,调度器会自动选择目标计算节点。",
|
||||
"Choose a host to migrate instance to. If not selected, the scheduler will auto select target host.": "选择计算节点来迁移云主机,如果没有选择,调度器会自动选择目标计算节点。",
|
||||
"Choosing a QoS policy can limit bandwidth and DSCP": "选择QoS策略可以限制带宽和DSCP",
|
||||
@ -1300,9 +1303,9 @@
|
||||
"Resource Type": "资源类型",
|
||||
"Resource Types": "资源类型",
|
||||
"Resources Synced": "资源同步",
|
||||
"Restore": "恢复",
|
||||
"Restore Backup": "恢复备份",
|
||||
"Restore backup": "恢复备份",
|
||||
"Restore from snapshot": "从快照恢复",
|
||||
"Restoring": "恢复中",
|
||||
"Restoring Backup": "恢复备份中",
|
||||
"Resume": "恢复",
|
||||
@ -1313,6 +1316,7 @@
|
||||
"Resuming": "恢复中",
|
||||
"Retyping": "修改类型中",
|
||||
"Revert Resize/Migrate": "回滚修改配置/迁移",
|
||||
"Reverting": "恢复中",
|
||||
"Reverting Resize or Migrate": "正在回滚修改配置/迁移",
|
||||
"Role": "角色",
|
||||
"Role Detail": "角色详情",
|
||||
@ -1708,6 +1712,7 @@
|
||||
"When you delete an instance, the following resources will be released(Non-root disks will be unmounted and retained):": "删除云主机时,将释放以下资源(非根硬盘将会卸载并保留):",
|
||||
"When you do online backup of the volume that has been bound, you need to pay attention to the following points:": "当您对已经绑定的硬盘做在线备份时,需要注意以下几点:",
|
||||
"When you restore a backup, you need to meet one of the following conditions:": "当您恢复备份时,需要满足以下条件之一:",
|
||||
"When you restore a snapshot, one of the following conditions must be met:": "当您恢复快照时,需要满足以下条件之一:",
|
||||
"When your Yaml file is a fixed template, variable variables can be stored in an environment variable file to implement template deployment. The parameters in the environment variable file need to match the parameters defined in the template file.": "当您的Yaml文件为一个固定模版时,可变变量可以存放在环境变量文件中来实现模版部署,环境变量文件中的参数需要与模版文件中定义的参数保持匹配。",
|
||||
"Whether the Login Name can be used is up to the feasible configuration of cloud-init or cloudbase-init service in the image.": "用户名是否可登录取决于镜像中的cloud-init或cloudbase-init服务的预制配置",
|
||||
"Whether the boot device should be set only for the next reboot, or persistently.": "是否永久使用该引导设置。",
|
||||
|
@ -1,41 +0,0 @@
|
||||
// Copyright 2021 99cloud
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
import { ConfirmAction } from 'containers/Action';
|
||||
import globalVolumeStore from 'stores/cinder/volume';
|
||||
|
||||
export default class RestoreAction extends ConfirmAction {
|
||||
get id() {
|
||||
return 'restore';
|
||||
}
|
||||
|
||||
get title() {
|
||||
return t('Restore');
|
||||
}
|
||||
|
||||
get buttonText() {
|
||||
return t('Restore');
|
||||
}
|
||||
|
||||
get actionName() {
|
||||
return t('Restore');
|
||||
}
|
||||
|
||||
policy = 'volume:create';
|
||||
|
||||
onSubmit = () => {
|
||||
const { volume_id: id, id: snapshot_id } = this.item;
|
||||
return globalVolumeStore.revert(id, { snapshot_id });
|
||||
};
|
||||
}
|
@ -15,7 +15,6 @@
|
||||
import CreateVolume from './CreateVolume';
|
||||
import Edit from './Edit';
|
||||
import Delete from './Delete';
|
||||
// import RestoreActionConfig from './Restore';
|
||||
|
||||
const actionConfigs = {
|
||||
rowActions: {
|
||||
|
121
src/pages/storage/containers/Volume/actions/Restore.jsx
Normal file
121
src/pages/storage/containers/Volume/actions/Restore.jsx
Normal file
@ -0,0 +1,121 @@
|
||||
// Copyright 2021 99cloud
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
import { inject, observer } from 'mobx-react';
|
||||
import { ModalAction } from 'containers/Action';
|
||||
import { VolumeStore } from 'stores/cinder/volume';
|
||||
import globalSnapshotStore from 'stores/cinder/snapshot';
|
||||
import { volumeStatus } from 'resources/volume';
|
||||
import { getSinceTime } from 'utils/time';
|
||||
import { revertTip } from 'resources/snapshot';
|
||||
|
||||
@inject('rootStore')
|
||||
@observer
|
||||
export default class RestoreAction extends ModalAction {
|
||||
static id = 'Restore from snapshot';
|
||||
|
||||
static title = t('Restore from snapshot');
|
||||
|
||||
init() {
|
||||
this.store = new VolumeStore();
|
||||
this.snapshotStore = globalSnapshotStore;
|
||||
}
|
||||
|
||||
static get modalSize() {
|
||||
return 'middle';
|
||||
}
|
||||
|
||||
getModalSize() {
|
||||
return 'middle';
|
||||
}
|
||||
|
||||
get defaultValue() {
|
||||
const { name, id = '-', volume_type = '-', size } = this.item;
|
||||
const value = {
|
||||
volume: `${name || id}(${volume_type} | ${size}GB)`,
|
||||
};
|
||||
return value;
|
||||
}
|
||||
|
||||
get formItems() {
|
||||
const { id } = this.item;
|
||||
return [
|
||||
{
|
||||
name: 'volume',
|
||||
label: t('Volume'),
|
||||
type: 'label',
|
||||
iconType: 'volume',
|
||||
},
|
||||
{
|
||||
name: 'snapshot',
|
||||
label: t('Choose Snapshot'),
|
||||
type: 'select-table',
|
||||
backendPageStore: this.snapshotStore,
|
||||
extraParams: { volume_id: id },
|
||||
required: true,
|
||||
isMulti: false,
|
||||
isSortByBack: true,
|
||||
defaultSortKey: 'created_at',
|
||||
defaultSortOrder: 'descend',
|
||||
filterParams: [
|
||||
{
|
||||
label: t('Name'),
|
||||
name: 'name',
|
||||
},
|
||||
],
|
||||
columns: [
|
||||
{
|
||||
title: t('Name'),
|
||||
dataIndex: 'name',
|
||||
},
|
||||
{
|
||||
title: t('Size'),
|
||||
dataIndex: 'size',
|
||||
render: (value) => `${value}GB`,
|
||||
sorter: false,
|
||||
},
|
||||
{
|
||||
title: t('Status'),
|
||||
dataIndex: 'status',
|
||||
render: (value) => volumeStatus[value] || '-',
|
||||
},
|
||||
{
|
||||
title: t('Created At'),
|
||||
dataIndex: 'created_at',
|
||||
render: (time) => getSinceTime(time),
|
||||
},
|
||||
],
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
get tips() {
|
||||
return revertTip;
|
||||
}
|
||||
|
||||
get name() {
|
||||
return t('Restore from snapshot');
|
||||
}
|
||||
|
||||
static policy = 'volume:create';
|
||||
|
||||
static allowed = (item) => {
|
||||
return Promise.resolve(['available', 'in-use'].includes(item.status));
|
||||
};
|
||||
|
||||
onSubmit = (values) => {
|
||||
const { snapshot: { selectedRowKeys = [] } = {} } = values;
|
||||
const { id } = this.item;
|
||||
return this.store.revert(id, { snapshot_id: selectedRowKeys[0] });
|
||||
};
|
||||
}
|
@ -15,6 +15,7 @@
|
||||
import Create from './Create';
|
||||
import Edit from './Edit';
|
||||
import Delete from './Delete';
|
||||
import Restore from './Restore';
|
||||
import Attach from './Attach';
|
||||
import Detach from './Detach';
|
||||
import CreateSnapshot from './CreateSnapshot';
|
||||
@ -70,6 +71,9 @@ const actionConfigs = {
|
||||
{
|
||||
action: Delete,
|
||||
},
|
||||
{
|
||||
action: Restore,
|
||||
},
|
||||
],
|
||||
},
|
||||
batchActions: [Delete],
|
||||
|
19
src/resources/snapshot.jsx
Normal file
19
src/resources/snapshot.jsx
Normal file
@ -0,0 +1,19 @@
|
||||
import React from 'react';
|
||||
|
||||
export const revertTip = (
|
||||
<span>
|
||||
<span style={{ fontWeight: 600 }}>
|
||||
{t(
|
||||
'When you restore a snapshot, one of the following conditions must be met:'
|
||||
)}
|
||||
</span>
|
||||
<p style={{ paddingLeft: 20 }} className="tip">
|
||||
{t('1. The cloud disk associated with the snapshot is available.')}
|
||||
</p>
|
||||
<p style={{ paddingLeft: 20 }} className="tip">
|
||||
{t(
|
||||
'2. The cloud hard disk associated with the snapshot has been mounted, and the cloud host is shut down.'
|
||||
)}
|
||||
</p>
|
||||
</span>
|
||||
);
|
@ -37,6 +37,7 @@ export const volumeStatus = {
|
||||
rollbacking: t('Restoring'),
|
||||
retyping: t('Retyping'),
|
||||
reserved: t('Reserved'),
|
||||
reverting: t('Reverting'),
|
||||
};
|
||||
|
||||
export const creationMethod = {
|
||||
|
@ -186,4 +186,8 @@
|
||||
padding: 8px 16px;
|
||||
}
|
||||
}
|
||||
|
||||
.tip{
|
||||
color: @color-text-body;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user