diff --git a/src/client/manila/index.js b/src/client/manila/index.js
index 68e64aa6..168d82c1 100644
--- a/src/client/manila/index.js
+++ b/src/client/manila/index.js
@@ -178,6 +178,11 @@ export class ManilaClient extends Base {
key: 'share-servers',
responseKey: 'share_server',
},
+ {
+ name: 'pools',
+ key: 'scheduler-stats/pools/detail',
+ responseKey: 'pool',
+ },
];
}
}
diff --git a/src/layouts/admin-menu.jsx b/src/layouts/admin-menu.jsx
index 127d62e6..fdc00117 100644
--- a/src/layouts/admin-menu.jsx
+++ b/src/layouts/admin-menu.jsx
@@ -561,6 +561,13 @@ const renderMenu = (t) => {
},
],
},
+ {
+ path: '/share/storage-admin',
+ name: t('Storage Backends'),
+ key: 'shareStorageBackendAdmin',
+ level: 1,
+ children: [],
+ },
],
},
{
diff --git a/src/pages/share/containers/Storage/index.jsx b/src/pages/share/containers/Storage/index.jsx
new file mode 100644
index 00000000..abc8160b
--- /dev/null
+++ b/src/pages/share/containers/Storage/index.jsx
@@ -0,0 +1,36 @@
+// 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 { observer, inject } from 'mobx-react';
+import { Storage as Base } from 'pages/storage/containers/Storage';
+import globalPoolStore from 'stores/manila/pool';
+import { poolColumns } from 'resources/cinder/cinder-pool';
+
+export class Storage extends Base {
+ init() {
+ this.store = globalPoolStore;
+ }
+
+ get policy() {
+ return 'scheduler_stats:pools:detail';
+ }
+
+ getColumns = () => {
+ const columns = [...poolColumns];
+ columns[2].dataIndex = 'share_backend_name';
+ return columns;
+ };
+}
+
+export default inject('rootStore')(observer(Storage));
diff --git a/src/pages/share/routes/index.js b/src/pages/share/routes/index.js
index 7969f5d5..c03da3b1 100644
--- a/src/pages/share/routes/index.js
+++ b/src/pages/share/routes/index.js
@@ -29,6 +29,7 @@ import ShareDetail from '../containers/Share/Detail';
import ShareCreate from '../containers/Share/actions/Create';
import ShareServer from '../containers/ShareServer';
import ShareServerDetail from '../containers/ShareServer/Detail';
+import Storage from '../containers/Storage';
const PATH = '/share';
export default [
@@ -137,6 +138,7 @@ export default [
component: ShareServerDetail,
exact: true,
},
+ { path: `${PATH}/storage-admin`, component: Storage, exact: true },
{ path: '*', component: E404 },
],
},
diff --git a/src/resources/cinder/cinder-pool.jsx b/src/resources/cinder/cinder-pool.jsx
index e201ea31..8d8a6688 100644
--- a/src/resources/cinder/cinder-pool.jsx
+++ b/src/resources/cinder/cinder-pool.jsx
@@ -33,16 +33,21 @@ export const poolColumns = [
title: t('Storage Capacity(GiB)'),
dataIndex: 'usedGBPercent',
isHideable: true,
- render: (value, record) => (
-
- ),
+ render: (value, record) =>
+ value ? (
+
+ ) : (
+ '-'
+ ),
stringify: (value, record) =>
- `${value}% (${t('Used')}: ${record.usedGB} / ${t('Total')}: ${
- record.total_capacity_gb
- })`,
+ value
+ ? `${value}% (${t('Used')}: ${record.usedGB} / ${t('Total')}: ${
+ record.total_capacity_gb
+ })`
+ : '-',
},
];
diff --git a/src/resources/skyline/policy.js b/src/resources/skyline/policy.js
index 8da54a50..a6f161db 100644
--- a/src/resources/skyline/policy.js
+++ b/src/resources/skyline/policy.js
@@ -73,7 +73,7 @@ export const policyMap = {
],
zun: ['capsule:', 'container:', 'host:get'],
panko: ['segregation', 'telemetry:events:index'],
- manila: ['share:', 'share_'],
+ manila: ['share:', 'share_', 'scheduler_stats:pools'],
trove: [
'instance:create',
'instance:delete',
diff --git a/src/stores/manila/pool.js b/src/stores/manila/pool.js
new file mode 100644
index 00000000..efff7f88
--- /dev/null
+++ b/src/stores/manila/pool.js
@@ -0,0 +1,40 @@
+// 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 { isNumber } from 'lodash';
+import client from 'client';
+import Base from 'stores/base';
+
+export class PoolStore extends Base {
+ get client() {
+ return client.manila.pools;
+ }
+
+ get mapper() {
+ return (data) => {
+ const { name, capabilities = {} } = data;
+ const newItem = { name, ...capabilities };
+ const { total_capacity_gb, free_capacity_gb } = capabilities;
+ if (isNumber(total_capacity_gb) && isNumber(free_capacity_gb)) {
+ newItem.usedGB = (total_capacity_gb - free_capacity_gb).toFixed(2);
+ newItem.usedGBPercent =
+ (newItem.usedGB / total_capacity_gb).toFixed(2) * 100;
+ }
+ return newItem;
+ };
+ }
+}
+
+const globalPoolStore = new PoolStore();
+export default globalPoolStore;