diff --git a/api/src/org/apache/cloudstack/api/command/admin/storage/ListStorageTagsCmd.java b/api/src/org/apache/cloudstack/api/command/admin/storage/ListStorageTagsCmd.java new file mode 100644 index 00000000000..502427bb3fd --- /dev/null +++ b/api/src/org/apache/cloudstack/api/command/admin/storage/ListStorageTagsCmd.java @@ -0,0 +1,46 @@ +package org.apache.cloudstack.api.command.admin.storage; + +import org.apache.log4j.Logger; +import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiCommandJobType; +import org.apache.cloudstack.api.BaseListCmd; +import org.apache.cloudstack.api.response.ListResponse; +import org.apache.cloudstack.api.response.StorageTagResponse; + +@APICommand(name = "listStorageTags", description = "Lists storage tags", responseObject = StorageTagResponse.class, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) +public class ListStorageTagsCmd extends BaseListCmd { + public static final Logger s_logger = Logger.getLogger(ListStorageTagsCmd.class.getName()); + + private static final String s_name = "liststoragetagsresponse"; + + // /////////////////////////////////////////////////// + // ////////////// API parameters ///////////////////// + // /////////////////////////////////////////////////// + + // /////////////////////////////////////////////////// + // ///////////////// Accessors /////////////////////// + // /////////////////////////////////////////////////// + + // /////////////////////////////////////////////////// + // ///////////// API Implementation/////////////////// + // /////////////////////////////////////////////////// + + @Override + public String getCommandName() { + return s_name; + } + + @Override + public ApiCommandJobType getInstanceType() { + return ApiCommandJobType.StoragePool; + } + + @Override + public void execute() { + ListResponse response = _queryService.searchForStorageTags(this); + + response.setResponseName(getCommandName()); + + setResponseObject(response); + } +} diff --git a/api/src/org/apache/cloudstack/api/response/StorageTagResponse.java b/api/src/org/apache/cloudstack/api/response/StorageTagResponse.java new file mode 100644 index 00000000000..7d8db39b4e9 --- /dev/null +++ b/api/src/org/apache/cloudstack/api/response/StorageTagResponse.java @@ -0,0 +1,59 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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. +package org.apache.cloudstack.api.response; + +import com.google.gson.annotations.SerializedName; +import org.apache.cloudstack.api.BaseResponse; +import com.cloud.serializer.Param; + +public class StorageTagResponse extends BaseResponse { + @SerializedName("id") + @Param(description = "the ID of the storage tag") + private String id; + + @SerializedName("poolid") + @Param(description = "the pool ID of the storage tag") + private long poolId; + + @SerializedName("name") + @Param(description = "the name of the storage tag") + private String name; + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public long getPoolId() { + return poolId; + } + + public void setPoolId(long l) { + this.poolId = l; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } +} diff --git a/api/src/org/apache/cloudstack/query/QueryService.java b/api/src/org/apache/cloudstack/query/QueryService.java index 01af631f129..b45b7c3bf17 100644 --- a/api/src/org/apache/cloudstack/query/QueryService.java +++ b/api/src/org/apache/cloudstack/query/QueryService.java @@ -25,6 +25,7 @@ import org.apache.cloudstack.api.command.admin.router.ListRoutersCmd; import org.apache.cloudstack.api.command.admin.storage.ListImageStoresCmd; import org.apache.cloudstack.api.command.admin.storage.ListSecondaryStagingStoresCmd; import org.apache.cloudstack.api.command.admin.storage.ListStoragePoolsCmd; +import org.apache.cloudstack.api.command.admin.storage.ListStorageTagsCmd; import org.apache.cloudstack.api.command.admin.user.ListUsersCmd; import org.apache.cloudstack.api.command.user.account.ListAccountsCmd; import org.apache.cloudstack.api.command.user.account.ListProjectAccountsCmd; @@ -60,6 +61,7 @@ import org.apache.cloudstack.api.response.ResourceTagResponse; import org.apache.cloudstack.api.response.SecurityGroupResponse; import org.apache.cloudstack.api.response.ServiceOfferingResponse; import org.apache.cloudstack.api.response.StoragePoolResponse; +import org.apache.cloudstack.api.response.StorageTagResponse; import org.apache.cloudstack.api.response.TemplateResponse; import org.apache.cloudstack.api.response.UserResponse; import org.apache.cloudstack.api.response.UserVmResponse; @@ -125,5 +127,6 @@ public interface QueryService { public List listResourceDetails(ListResourceDetailsCmd cmd); ListResponse searchForInternalLbVms(ListInternalLBVMsCmd cmd); + public ListResponse searchForStorageTags(ListStorageTagsCmd cmd); } diff --git a/client/tomcatconf/commands.properties.in b/client/tomcatconf/commands.properties.in index c71f4bad8af..33699c04437 100644 --- a/client/tomcatconf/commands.properties.in +++ b/client/tomcatconf/commands.properties.in @@ -329,6 +329,7 @@ listAsyncJobs=15 #### storage pools commands listStoragePools=3 listStorageProviders=3 +listStorageTags=7 createStoragePool=1 updateStoragePool=1 deleteStoragePool=1 diff --git a/engine/schema/resources/META-INF/cloudstack/core/spring-engine-schema-core-daos-context.xml b/engine/schema/resources/META-INF/cloudstack/core/spring-engine-schema-core-daos-context.xml index c73d3d9952b..b21ff4308d6 100644 --- a/engine/schema/resources/META-INF/cloudstack/core/spring-engine-schema-core-daos-context.xml +++ b/engine/schema/resources/META-INF/cloudstack/core/spring-engine-schema-core-daos-context.xml @@ -262,6 +262,7 @@ + diff --git a/server/src/com/cloud/api/ApiDBUtils.java b/server/src/com/cloud/api/ApiDBUtils.java index 90a09a0436b..8809778cb77 100755 --- a/server/src/com/cloud/api/ApiDBUtils.java +++ b/server/src/com/cloud/api/ApiDBUtils.java @@ -50,6 +50,7 @@ import org.apache.cloudstack.api.response.ResourceTagResponse; import org.apache.cloudstack.api.response.SecurityGroupResponse; import org.apache.cloudstack.api.response.ServiceOfferingResponse; import org.apache.cloudstack.api.response.StoragePoolResponse; +import org.apache.cloudstack.api.response.StorageTagResponse; import org.apache.cloudstack.api.response.TemplateResponse; import org.apache.cloudstack.api.response.UserResponse; import org.apache.cloudstack.api.response.UserVmResponse; @@ -82,6 +83,7 @@ import com.cloud.api.query.dao.ResourceTagJoinDao; import com.cloud.api.query.dao.SecurityGroupJoinDao; import com.cloud.api.query.dao.ServiceOfferingJoinDao; import com.cloud.api.query.dao.StoragePoolJoinDao; +import com.cloud.api.query.dao.StorageTagDao; import com.cloud.api.query.dao.TemplateJoinDao; import com.cloud.api.query.dao.UserAccountJoinDao; import com.cloud.api.query.dao.UserVmJoinDao; @@ -103,6 +105,7 @@ import com.cloud.api.query.vo.ResourceTagJoinVO; import com.cloud.api.query.vo.SecurityGroupJoinVO; import com.cloud.api.query.vo.ServiceOfferingJoinVO; import com.cloud.api.query.vo.StoragePoolJoinVO; +import com.cloud.api.query.vo.StorageTagVO; import com.cloud.api.query.vo.TemplateJoinVO; import com.cloud.api.query.vo.UserAccountJoinVO; import com.cloud.api.query.vo.UserVmJoinVO; @@ -386,6 +389,7 @@ public class ApiDBUtils { static HostJoinDao s_hostJoinDao; static VolumeJoinDao s_volJoinDao; static StoragePoolJoinDao s_poolJoinDao; + static StorageTagDao s_tagDao; static ImageStoreJoinDao s_imageStoreJoinDao; static AccountJoinDao s_accountJoinDao; static AsyncJobJoinDao s_jobJoinDao; @@ -581,6 +585,8 @@ public class ApiDBUtils { @Inject private StoragePoolJoinDao poolJoinDao; @Inject + private StorageTagDao tagDao; + @Inject private ImageStoreJoinDao imageStoreJoinDao; @Inject private AccountJoinDao accountJoinDao; @@ -718,6 +724,7 @@ public class ApiDBUtils { s_hostJoinDao = hostJoinDao; s_volJoinDao = volJoinDao; s_poolJoinDao = poolJoinDao; + s_tagDao = tagDao; s_imageStoreJoinDao = imageStoreJoinDao; s_accountJoinDao = accountJoinDao; s_jobJoinDao = jobJoinDao; @@ -1733,6 +1740,10 @@ public class ApiDBUtils { return s_poolJoinDao.newStoragePoolResponse(vr); } + public static StorageTagResponse newStorageTagResponse(StorageTagVO vr) { + return s_tagDao.newStorageTagResponse(vr); + } + public static StoragePoolResponse fillStoragePoolDetails(StoragePoolResponse vrData, StoragePoolJoinVO vr) { return s_poolJoinDao.setStoragePoolResponse(vrData, vr); } diff --git a/server/src/com/cloud/api/query/QueryManagerImpl.java b/server/src/com/cloud/api/query/QueryManagerImpl.java index 60b082c0061..c30683ee75a 100644 --- a/server/src/com/cloud/api/query/QueryManagerImpl.java +++ b/server/src/com/cloud/api/query/QueryManagerImpl.java @@ -46,6 +46,7 @@ import org.apache.cloudstack.api.command.admin.router.ListRoutersCmd; import org.apache.cloudstack.api.command.admin.storage.ListImageStoresCmd; import org.apache.cloudstack.api.command.admin.storage.ListSecondaryStagingStoresCmd; import org.apache.cloudstack.api.command.admin.storage.ListStoragePoolsCmd; +import org.apache.cloudstack.api.command.admin.storage.ListStorageTagsCmd; import org.apache.cloudstack.api.command.admin.template.ListTemplatesCmdByAdmin; import org.apache.cloudstack.api.command.admin.user.ListUsersCmd; import org.apache.cloudstack.api.command.admin.vm.ListVMsCmdByAdmin; @@ -85,6 +86,7 @@ import org.apache.cloudstack.api.response.ResourceTagResponse; import org.apache.cloudstack.api.response.SecurityGroupResponse; import org.apache.cloudstack.api.response.ServiceOfferingResponse; import org.apache.cloudstack.api.response.StoragePoolResponse; +import org.apache.cloudstack.api.response.StorageTagResponse; import org.apache.cloudstack.api.response.TemplateResponse; import org.apache.cloudstack.api.response.UserResponse; import org.apache.cloudstack.api.response.UserVmResponse; @@ -115,6 +117,7 @@ import com.cloud.api.query.dao.ResourceTagJoinDao; import com.cloud.api.query.dao.SecurityGroupJoinDao; import com.cloud.api.query.dao.ServiceOfferingJoinDao; import com.cloud.api.query.dao.StoragePoolJoinDao; +import com.cloud.api.query.dao.StorageTagDao; import com.cloud.api.query.dao.TemplateJoinDao; import com.cloud.api.query.dao.UserAccountJoinDao; import com.cloud.api.query.dao.UserVmJoinDao; @@ -136,6 +139,7 @@ import com.cloud.api.query.vo.ResourceTagJoinVO; import com.cloud.api.query.vo.SecurityGroupJoinVO; import com.cloud.api.query.vo.ServiceOfferingJoinVO; import com.cloud.api.query.vo.StoragePoolJoinVO; +import com.cloud.api.query.vo.StorageTagVO; import com.cloud.api.query.vo.TemplateJoinVO; import com.cloud.api.query.vo.UserAccountJoinVO; import com.cloud.api.query.vo.UserVmJoinVO; @@ -284,6 +288,9 @@ public class QueryManagerImpl extends ManagerBase implements QueryService { @Inject private StoragePoolJoinDao _poolJoinDao; + @Inject + private StorageTagDao _storageTagDao; + @Inject private ImageStoreJoinDao _imageStoreJoinDao; @@ -2129,6 +2136,47 @@ public class QueryManagerImpl extends ManagerBase implements QueryService { } + @Override + public ListResponse searchForStorageTags(ListStorageTagsCmd cmd) { + Pair, Integer> result = searchForStorageTagsInternal(cmd); + ListResponse response = new ListResponse(); + List tagResponses = ViewResponseHelper.createStorageTagResponse(result.first().toArray(new StorageTagVO[result.first().size()])); + + response.setResponses(tagResponses, result.second()); + + return response; + } + + private Pair, Integer> searchForStorageTagsInternal(ListStorageTagsCmd cmd) { + Filter searchFilter = new Filter(StorageTagVO.class, "id", Boolean.TRUE, null, null); + + SearchBuilder sb = _storageTagDao.createSearchBuilder(); + + sb.select(null, Func.DISTINCT, sb.entity().getId()); // select distinct + + SearchCriteria sc = sb.create(); + + // search storage tag details by ids + Pair, Integer> uniqueTagPair = _storageTagDao.searchAndCount(sc, searchFilter); + Integer count = uniqueTagPair.second(); + + if (count.intValue() == 0) { + return uniqueTagPair; + } + + List uniqueTags = uniqueTagPair.first(); + Long[] vrIds = new Long[uniqueTags.size()]; + int i = 0; + + for (StorageTagVO v : uniqueTags) { + vrIds[i++] = v.getId(); + } + + List vrs = _storageTagDao.searchByIds(vrIds); + + return new Pair, Integer>(vrs, count); + } + @Override public ListResponse searchForImageStores(ListImageStoresCmd cmd) { Pair, Integer> result = searchForImageStoresInternal(cmd); diff --git a/server/src/com/cloud/api/query/ViewResponseHelper.java b/server/src/com/cloud/api/query/ViewResponseHelper.java index d06e1d11802..f31a3085763 100644 --- a/server/src/com/cloud/api/query/ViewResponseHelper.java +++ b/server/src/com/cloud/api/query/ViewResponseHelper.java @@ -44,6 +44,7 @@ import org.apache.cloudstack.api.response.ResourceTagResponse; import org.apache.cloudstack.api.response.SecurityGroupResponse; import org.apache.cloudstack.api.response.ServiceOfferingResponse; import org.apache.cloudstack.api.response.StoragePoolResponse; +import org.apache.cloudstack.api.response.StorageTagResponse; import org.apache.cloudstack.api.response.TemplateResponse; import org.apache.cloudstack.api.response.UserResponse; import org.apache.cloudstack.api.response.UserVmResponse; @@ -69,6 +70,7 @@ import com.cloud.api.query.vo.ResourceTagJoinVO; import com.cloud.api.query.vo.SecurityGroupJoinVO; import com.cloud.api.query.vo.ServiceOfferingJoinVO; import com.cloud.api.query.vo.StoragePoolJoinVO; +import com.cloud.api.query.vo.StorageTagVO; import com.cloud.api.query.vo.TemplateJoinVO; import com.cloud.api.query.vo.UserAccountJoinVO; import com.cloud.api.query.vo.UserVmJoinVO; @@ -289,6 +291,16 @@ public class ViewResponseHelper { return new ArrayList(vrDataList.values()); } + public static List createStorageTagResponse(StorageTagVO... storageTags) { + ArrayList list = new ArrayList(); + + for (StorageTagVO vr : storageTags) { + list.add(ApiDBUtils.newStorageTagResponse(vr)); + } + + return list; + } + public static List createImageStoreResponse(ImageStoreJoinVO... stores) { Hashtable vrDataList = new Hashtable(); // Initialise the vrdatalist with the input data diff --git a/server/src/com/cloud/api/query/dao/StorageTagDao.java b/server/src/com/cloud/api/query/dao/StorageTagDao.java new file mode 100644 index 00000000000..aa2d6e6e9f7 --- /dev/null +++ b/server/src/com/cloud/api/query/dao/StorageTagDao.java @@ -0,0 +1,30 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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. +package com.cloud.api.query.dao; + +import java.util.List; + +import org.apache.cloudstack.api.response.StorageTagResponse; + +import com.cloud.api.query.vo.StorageTagVO; +import com.cloud.utils.db.GenericDao; + +public interface StorageTagDao extends GenericDao { + StorageTagResponse newStorageTagResponse(StorageTagVO storageTag); + + List searchByIds(Long... storageTagIds); +} diff --git a/server/src/com/cloud/api/query/dao/StorageTagDaoImpl.java b/server/src/com/cloud/api/query/dao/StorageTagDaoImpl.java new file mode 100644 index 00000000000..d1511f2d61f --- /dev/null +++ b/server/src/com/cloud/api/query/dao/StorageTagDaoImpl.java @@ -0,0 +1,126 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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. +package com.cloud.api.query.dao; + +import java.util.ArrayList; +import java.util.List; + +import javax.ejb.Local; +import javax.inject.Inject; + +import org.apache.cloudstack.api.response.StorageTagResponse; +import org.apache.cloudstack.framework.config.dao.ConfigurationDao; +import org.apache.log4j.Logger; +import org.springframework.stereotype.Component; + +import com.cloud.api.query.vo.StorageTagVO; +import com.cloud.utils.db.GenericDaoBase; +import com.cloud.utils.db.SearchBuilder; +import com.cloud.utils.db.SearchCriteria; + +@Component +@Local(value = {StorageTagDao.class}) +public class StorageTagDaoImpl extends GenericDaoBase implements StorageTagDao { + public static final Logger s_logger = Logger.getLogger(StorageTagDaoImpl.class); + + @Inject + private ConfigurationDao _configDao; + + private final SearchBuilder stSearch; + private final SearchBuilder stIdSearch; + + protected StorageTagDaoImpl() { + stSearch = createSearchBuilder(); + + stSearch.and("idIN", stSearch.entity().getId(), SearchCriteria.Op.IN); + stSearch.done(); + + stIdSearch = createSearchBuilder(); + + stIdSearch.and("id", stIdSearch.entity().getId(), SearchCriteria.Op.EQ); + stIdSearch.done(); + + _count = "select count(distinct id) from storage_tag_view WHERE "; + } + + @Override + public StorageTagResponse newStorageTagResponse(StorageTagVO tag) { + StorageTagResponse tagResponse = new StorageTagResponse(); + + tagResponse.setName(tag.getName()); + tagResponse.setPoolId(tag.getPoolId()); + + tagResponse.setObjectName("storagetag"); + + return tagResponse; + } + + @Override + public List searchByIds(Long... stIds) { + String batchCfg = _configDao.getValue("detail.batch.query.size"); + + final int detailsBatchSize = batchCfg != null ? Integer.parseInt(batchCfg) : 2000; + + // query details by batches + List uvList = new ArrayList(); + int curr_index = 0; + + if (stIds.length > detailsBatchSize) { + while ((curr_index + detailsBatchSize) <= stIds.length) { + Long[] ids = new Long[detailsBatchSize]; + + for (int k = 0, j = curr_index; j < curr_index + detailsBatchSize; j++, k++) { + ids[k] = stIds[j]; + } + + SearchCriteria sc = stSearch.create(); + + sc.setParameters("idIN", (Object[])ids); + + List vms = searchIncludingRemoved(sc, null, null, false); + + if (vms != null) { + uvList.addAll(vms); + } + + curr_index += detailsBatchSize; + } + } + + if (curr_index < stIds.length) { + int batch_size = (stIds.length - curr_index); + // set the ids value + Long[] ids = new Long[batch_size]; + + for (int k = 0, j = curr_index; j < curr_index + batch_size; j++, k++) { + ids[k] = stIds[j]; + } + + SearchCriteria sc = stSearch.create(); + + sc.setParameters("idIN", (Object[])ids); + + List vms = searchIncludingRemoved(sc, null, null, false); + + if (vms != null) { + uvList.addAll(vms); + } + } + + return uvList; + } +} diff --git a/server/src/com/cloud/api/query/vo/StorageTagVO.java b/server/src/com/cloud/api/query/vo/StorageTagVO.java new file mode 100644 index 00000000000..f8d29fd5f85 --- /dev/null +++ b/server/src/com/cloud/api/query/vo/StorageTagVO.java @@ -0,0 +1,61 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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. +package com.cloud.api.query.vo; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Table; + +import org.apache.cloudstack.api.InternalIdentity; + +/** + * Storage Tags DB view. + * + */ +@Entity +@Table(name = "storage_tag_view") +public class StorageTagVO extends BaseViewVO implements InternalIdentity { + private static final long serialVersionUID = 1L; + + @Id + @Column(name = "id") + private long id; + + @Column(name = "name") + private String name; + + @Column(name = "pool_id") + long poolId; + + @Override + public long getId() { + return id; + } + + public String getName() { + return name; + } + + public long getPoolId() { + return poolId; + } + + public void setPoolId(long poolId) { + this.poolId = poolId; + } +} \ No newline at end of file diff --git a/server/src/com/cloud/server/ManagementServerImpl.java b/server/src/com/cloud/server/ManagementServerImpl.java index 7b5422e691f..280009b5e59 100755 --- a/server/src/com/cloud/server/ManagementServerImpl.java +++ b/server/src/com/cloud/server/ManagementServerImpl.java @@ -176,6 +176,7 @@ import org.apache.cloudstack.api.command.admin.storage.ListImageStoresCmd; import org.apache.cloudstack.api.command.admin.storage.ListS3sCmd; import org.apache.cloudstack.api.command.admin.storage.ListSecondaryStagingStoresCmd; import org.apache.cloudstack.api.command.admin.storage.ListStoragePoolsCmd; +import org.apache.cloudstack.api.command.admin.storage.ListStorageTagsCmd; import org.apache.cloudstack.api.command.admin.storage.ListStorageProvidersCmd; import org.apache.cloudstack.api.command.admin.storage.PreparePrimaryStorageForMaintenanceCmd; import org.apache.cloudstack.api.command.admin.storage.UpdateCloudToUseObjectStoreCmd; @@ -2623,6 +2624,7 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe cmdList.add(ListS3sCmd.class); cmdList.add(ListSwiftsCmd.class); cmdList.add(ListStoragePoolsCmd.class); + cmdList.add(ListStorageTagsCmd.class); cmdList.add(FindStoragePoolsForMigrationCmd.class); cmdList.add(PreparePrimaryStorageForMaintenanceCmd.class); cmdList.add(UpdateStoragePoolCmd.class); diff --git a/setup/db/db/schema-441to450.sql b/setup/db/db/schema-441to450.sql index 5323317de91..34d5f884200 100644 --- a/setup/db/db/schema-441to450.sql +++ b/setup/db/db/schema-441to450.sql @@ -22,6 +22,17 @@ -- Disable foreign key checking -- SET foreign_key_checks = 0; +DROP VIEW IF EXISTS `cloud`.`storage_tag_view`; +CREATE VIEW `cloud`.`storage_tag_view` AS + select + storage_pool_details.id, + storage_pool_details.pool_id, + storage_pool_details.name + from + `cloud`.`storage_pool_details` + where + value='true'; + ALTER TABLE `cloud`.`volumes` ADD COLUMN `provisioning_type` VARCHAR(32) NOT NULL DEFAULT 'thin' COMMENT 'pre allocation setting of the volume'; ALTER TABLE `cloud`.`disk_offering` ADD COLUMN `provisioning_type` VARCHAR(32) NOT NULL DEFAULT 'thin' COMMENT 'pre allocation setting of the volume';