Skip to content

Commit 861601f

Browse files
committed
ui,api: support secondary staging store actions
Signed-off-by: Abhishek Kumar <[email protected]>
1 parent a60c8ca commit 861601f

File tree

11 files changed

+103
-6
lines changed

11 files changed

+103
-6
lines changed

api/src/main/java/org/apache/cloudstack/api/ApiConstants.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,7 @@ public class ApiConstants {
290290
public static final String NEXT_ACL_RULE_ID = "nextaclruleid";
291291
public static final String NEXT_HOP = "nexthop";
292292
public static final String MOVE_ACL_CONSISTENCY_HASH = "aclconsistencyhash";
293+
public static final String IMAGE_CACHE_STORES = "imagecachestores";
293294
public static final String IMAGE_PATH = "imagepath";
294295
public static final String INSTANCE_CONVERSION_SUPPORTED = "instanceconversionsupported";
295296
public static final String INTERNAL_DNS1 = "internaldns1";

engine/schema/src/main/java/org/apache/cloudstack/storage/datastore/db/ImageStoreDao.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ public interface ImageStoreDao extends GenericDao<ImageStoreVO, Long> {
4040

4141
List<ImageStoreVO> listImageStores();
4242

43+
Integer countAllImageCacheStores();
44+
4345
List<ImageStoreVO> listImageCacheStores();
4446

4547
List<ImageStoreVO> listStoresByZoneId(long zoneId);

engine/schema/src/main/java/org/apache/cloudstack/storage/datastore/db/ImageStoreDaoImpl.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,13 @@ public List<ImageStoreVO> listImageStores() {
174174
return listBy(sc);
175175
}
176176

177+
@Override
178+
public Integer countAllImageCacheStores() {
179+
SearchCriteria<ImageStoreVO> sc = createSearchCriteria();
180+
sc.addAnd("role", SearchCriteria.Op.EQ, DataStoreRole.Image);
181+
return getCount(sc);
182+
}
183+
177184
@Override
178185
public List<ImageStoreVO> listImageCacheStores() {
179186
SearchCriteria<ImageStoreVO> sc = createSearchCriteria();

plugins/metrics/src/main/java/org/apache/cloudstack/metrics/MetricsServiceImpl.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -557,6 +557,7 @@ public InfrastructureResponse listInfrastructure() {
557557
response.setHosts(hostCountAndCpuSockets.first());
558558
response.setStoragePools(storagePoolDao.countAll());
559559
response.setImageStores(imageStoreDao.countAllImageStores());
560+
response.setImageCacheStores(imageStoreDao.countAllImageCacheStores());
560561
response.setObjectStores(objectStoreDao.countAllObjectStores());
561562
response.setSystemvms(vmInstanceDao.countByTypes(VirtualMachine.Type.ConsoleProxy, VirtualMachine.Type.SecondaryStorageVm));
562563
response.setRouters(domainRouterDao.countAllByRole(VirtualRouter.Role.VIRTUAL_ROUTER));

plugins/metrics/src/main/java/org/apache/cloudstack/response/InfrastructureResponse.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919

2020
import com.cloud.serializer.Param;
2121
import com.google.gson.annotations.SerializedName;
22+
23+
import org.apache.cloudstack.api.ApiConstants;
2224
import org.apache.cloudstack.api.BaseResponse;
2325

2426
public class InfrastructureResponse extends BaseResponse {
@@ -75,6 +77,10 @@ public class InfrastructureResponse extends BaseResponse {
7577
@Param(description = "Number of Alerts")
7678
private Integer alerts;
7779

80+
@SerializedName(ApiConstants.IMAGE_CACHE_STORES)
81+
@Param(description = "Number of image cache stores", since = "4.22.0")
82+
private Integer imageCacheStores;
83+
7884
public InfrastructureResponse() {
7985
setObjectName("infrastructure");
8086
}
@@ -126,4 +132,8 @@ public void setManagementServers(Integer managementServers) {
126132
public void setObjectStores(Integer objectStores) {
127133
this.objectStores = objectStores;
128134
}
135+
136+
public void setImageCacheStores(Integer imageCacheStores) {
137+
this.imageCacheStores = imageCacheStores;
138+
}
129139
}

ui/public/locales/en.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@
105105
"label.action.delete.pod": "Delete Pod",
106106
"label.action.delete.primary.storage": "Delete Primary Storage",
107107
"label.action.delete.routing.firewall.rule": "Delete IPv4 Routing firewall rule",
108+
"label.action.delete.secondary.staging.storage": "Delete Secondary Staging Storage",
108109
"label.action.delete.secondary.storage": "Delete Secondary Storage",
109110
"label.action.delete.security.group": "Delete Security Group",
110111
"label.action.delete.snapshot": "Delete Snapshot",
@@ -315,6 +316,7 @@
315316
"label.add.routing.policy": "Add Routing Policy",
316317
"label.add.rule": "Add Rule",
317318
"label.add.secondary.ip": "Add Secondary IP",
319+
"label.add.secondary.staging.storage": "Add Secondary Staging Storage",
318320
"label.add.secondary.storage": "Add Secondary Storage",
319321
"label.add.security.group": "Add Security Group",
320322
"label.add.setting": "Add setting",
@@ -2167,6 +2169,7 @@
21672169
"label.search": "Search",
21682170
"label.secondary.isolated.vlan.type.isolated": "Isolated",
21692171
"label.secondary.isolated.vlan.type.promiscuous": "Promiscuous",
2172+
"label.secondary.staging.storage": "Secondary Staging Storage",
21702173
"label.secondary.storage": "Secondary Storage",
21712174
"label.secondary.storage.vm": "Secondary Storage VM",
21722175
"label.secondaryips": "Secondary IPs",
@@ -2878,6 +2881,7 @@
28782881
"message.action.delete.oauth.provider": "Please confirm that you want to delete the OAuth provider.",
28792882
"message.action.delete.physical.network": "Please confirm that you want to delete this physical Network.",
28802883
"message.action.delete.pod": "Please confirm that you want to delete this Pod.",
2884+
"message.action.delete.secondary.staging.storage": "Please confirm that you want to delete this secondary staging storage.",
28812885
"message.action.delete.secondary.storage": "Please confirm that you want to delete this secondary storage.",
28822886
"message.action.delete.security.group": "Please confirm that you want to delete this security group.",
28832887
"message.action.delete.snapshot": "Please confirm that you want to delete this Snapshot.",

ui/src/config/router.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ function generateRouterMap (section) {
6666
if ('show' in child && !child.show()) {
6767
continue
6868
}
69+
console.log('Generating route for child:', child.name)
6970
var component = child.component ? child.component : shallowRef(AutogenView)
7071
var route = {
7172
name: child.name,

ui/src/config/section/infra.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import clusters from '@/config/section/infra/clusters'
2323
import hosts from '@/config/section/infra/hosts'
2424
import primaryStorages from '@/config/section/infra/primaryStorages'
2525
import secondaryStorages from '@/config/section/infra/secondaryStorages'
26+
import secondaryStagingStorages from '@/config/section/infra/secondaryStagingStorages'
2627
import objectStorages from '@/config/section/infra/objectStorages'
2728
import systemVms from '@/config/section/infra/systemVms'
2829
import routers from '@/config/section/infra/routers'
@@ -50,6 +51,7 @@ export default {
5051
hosts,
5152
primaryStorages,
5253
secondaryStorages,
54+
secondaryStagingStorages,
5355
objectStorages,
5456
systemVms,
5557
routers,
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
// Licensed to the Apache Software Foundation (ASF) under one
2+
// or more contributor license agreements. See the NOTICE file
3+
// distributed with this work for additional information
4+
// regarding copyright ownership. The ASF licenses this file
5+
// to you under the Apache License, Version 2.0 (the
6+
// "License"); you may not use this file except in compliance
7+
// with the License. You may obtain a copy of the License at
8+
//
9+
// http://www.apache.org/licenses/LICENSE-2.0
10+
//
11+
// Unless required by applicable law or agreed to in writing,
12+
// software distributed under the License is distributed on an
13+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
// KIND, either express or implied. See the License for the
15+
// specific language governing permissions and limitations
16+
// under the License.
17+
18+
import store from '@/store'
19+
20+
export default {
21+
name: 'imagecachestore',
22+
title: 'label.secondary.staging.storage',
23+
icon: 'file-image-outlined',
24+
docHelp: 'adminguide/storage.html#secondary-storage',
25+
permission: ['listSecondaryStagingStores'],
26+
searchFilters: ['name', 'zoneid', 'provider'],
27+
hidden: true,
28+
columns: () => {
29+
var fields = ['name', 'url', 'protocol', 'scope', 'zonename']
30+
if (store.getters.apis.listSecondaryStagingStores.params.filter(x => x.name === 'readonly').length > 0) {
31+
fields.push({
32+
field: 'readonly',
33+
customTitle: 'access'
34+
})
35+
}
36+
return fields
37+
},
38+
details: () => {
39+
var fields = ['name', 'id', 'url', 'protocol', 'provider', 'scope', 'zonename']
40+
if (store.getters.apis.listSecondaryStagingStores.params.filter(x => x.name === 'readonly').length > 0) {
41+
fields.push('readonly')
42+
}
43+
return fields
44+
},
45+
resourceType: 'SecondaryStagingStorage',
46+
actions: [
47+
{
48+
api: 'createSecondaryStagingStore',
49+
icon: 'plus-outlined',
50+
docHelp: 'installguide/configuration.html#add-secondary-storage',
51+
label: 'label.add.secondary.staging.storage',
52+
listView: true,
53+
args: ['url', 'zoneid', 'scope', 'provider']
54+
},
55+
{
56+
api: 'deleteSecondaryStagingStore',
57+
icon: 'delete-outlined',
58+
label: 'label.action.delete.secondary.staging.storage',
59+
message: 'message.action.delete.secondary.staging.storage',
60+
dataView: true,
61+
displayName: (record) => { return record.name || record.displayName || record.id }
62+
}
63+
]
64+
}

ui/src/core/lazy_lib/icons_use.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ import {
8282
EyeOutlined,
8383
FieldTimeOutlined,
8484
FileDoneOutlined,
85+
FileImageOutlined,
8586
FileProtectOutlined,
8687
FileSyncOutlined,
8788
FileTextOutlined,
@@ -257,6 +258,7 @@ export default {
257258
app.component('EyeOutlined', EyeOutlined)
258259
app.component('FieldTimeOutlined', FieldTimeOutlined)
259260
app.component('FileDoneOutlined', FileDoneOutlined)
261+
app.component('FileImageOutlined', FileImageOutlined)
260262
app.component('FileProtectOutlined', FileProtectOutlined)
261263
app.component('FileSyncOutlined', FileSyncOutlined)
262264
app.component('FileTextOutlined', FileTextOutlined)

0 commit comments

Comments
 (0)