You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by al...@apache.org on 2013/12/23 21:36:10 UTC
git commit: updated refs/heads/master to 79e64aa
Updated Branches:
refs/heads/master 8f9342425 -> 79e64aa53
Resource metadata support for Disk Offering
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/79e64aa5
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/79e64aa5
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/79e64aa5
Branch: refs/heads/master
Commit: 79e64aa535f9a21af743b9cb49f7a4cefcc938ea
Parents: 8f93424
Author: Alena Prokharchyk <al...@citrix.com>
Authored: Mon Dec 23 11:48:45 2013 -0800
Committer: Alena Prokharchyk <al...@citrix.com>
Committed: Mon Dec 23 12:36:13 2013 -0800
----------------------------------------------------------------------
api/src/com/cloud/server/ResourceTag.java | 8 +-
.../spring-engine-schema-core-daos-context.xml | 1 +
.../resourcedetail/DiskOfferingDetailVO.java | 81 ++++++++++++++++++++
.../dao/DiskOfferingDetailsDao.java | 26 +++++++
.../dao/DiskOfferingDetailsDaoImpl.java | 33 ++++++++
.../metadata/ResourceMetaDataManagerImpl.java | 4 +
.../cloud/tags/TaggedResourceManagerImpl.java | 8 ++
setup/db/db/schema-430to440.sql | 2 +
8 files changed, 158 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/79e64aa5/api/src/com/cloud/server/ResourceTag.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/server/ResourceTag.java b/api/src/com/cloud/server/ResourceTag.java
index 93dccba..5aee114 100644
--- a/api/src/com/cloud/server/ResourceTag.java
+++ b/api/src/com/cloud/server/ResourceTag.java
@@ -25,11 +25,9 @@ public interface ResourceTag extends ControlledEntity, Identity, InternalIdentit
// FIXME - extract enum to another interface as its used both by resourceTags and resourceMetaData code
public enum ResourceObjectType {
UserVm(true, true), Template(true, true), ISO(true, false), Volume(true, true), Snapshot(true, false), Network(true, true), Nic(false, true), LoadBalancer(true, true), PortForwardingRule(
- true, true), FirewallRule(true, true),
-
- SecurityGroup(true, false), PublicIpAddress(true, true), Project(true, false), Vpc(true, true), NetworkACL(true, true), StaticRoute(true, false), VMSnapshot(true, false), RemoteAccessVpn(
- true, true), Zone(false, true), ServiceOffering(false, true), Storage(false, true), PrivateGateway(false, true), NetworkACLList(false, true), VpnGateway(false,
- true), CustomerGateway(false, true), VpnConnection(false, true);
+ true, true), FirewallRule(true, true), SecurityGroup(true, false), PublicIpAddress(true, true), Project(true, false), Vpc(true, true), NetworkACL(true, true), StaticRoute(
+ true, false), VMSnapshot(true, false), RemoteAccessVpn(true, true), Zone(false, true), ServiceOffering(false, true), Storage(false, true), PrivateGateway(false,
+ true), NetworkACLList(false, true), VpnGateway(false, true), CustomerGateway(false, true), VpnConnection(false, true), User(true, false), DiskOffering(false, true);
ResourceObjectType(boolean resourceTagsSupport, boolean resourceMetadataSupport) {
this.resourceTagsSupport = resourceTagsSupport;
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/79e64aa5/engine/schema/resources/META-INF/cloudstack/core/spring-engine-schema-core-daos-context.xml
----------------------------------------------------------------------
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 6ec63bc..5aa91c0 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
@@ -331,6 +331,7 @@
<bean id="Site2SiteVpnGatewayDetailsDaoImpl" class="org.apache.cloudstack.resourcedetail.dao.Site2SiteVpnGatewayDetailsDaoImpl" />
<bean id="Site2SiteCustomerGatewayDetailsDaoImpl" class="org.apache.cloudstack.resourcedetail.dao.Site2SiteCustomerGatewayDetailsDaoImpl" />
<bean id="Site2SiteVpnConnectionDetailsDaoImpl" class="org.apache.cloudstack.resourcedetail.dao.Site2SiteVpnConnectionDetailsDaoImpl" />
+ <bean id="DiskOfferingDetailsDaoImpl" class="org.apache.cloudstack.resourcedetail.dao.DiskOfferingDetailsDaoImpl" />
<bean id="databaseIntegrityChecker" class="com.cloud.upgrade.DatabaseIntegrityChecker" />
</beans>
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/79e64aa5/engine/schema/src/org/apache/cloudstack/resourcedetail/DiskOfferingDetailVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/org/apache/cloudstack/resourcedetail/DiskOfferingDetailVO.java b/engine/schema/src/org/apache/cloudstack/resourcedetail/DiskOfferingDetailVO.java
new file mode 100644
index 0000000..bdee3c1
--- /dev/null
+++ b/engine/schema/src/org/apache/cloudstack/resourcedetail/DiskOfferingDetailVO.java
@@ -0,0 +1,81 @@
+// 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.resourcedetail;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+import org.apache.cloudstack.api.ResourceDetail;
+
+@Entity
+@Table(name = "disk_offering_details")
+public class DiskOfferingDetailVO implements ResourceDetail {
+ @Id
+ @GeneratedValue(strategy = GenerationType.IDENTITY)
+ @Column(name = "id")
+ private long id;
+
+ @Column(name = "offering_id")
+ private long resourceId;
+
+ @Column(name = "name")
+ private String name;
+
+ @Column(name = "value", length = 1024)
+ private String value;
+
+ @Column(name = "display")
+ private boolean display;
+
+ public DiskOfferingDetailVO() {
+ }
+
+ public DiskOfferingDetailVO(long id, String name, String value) {
+ this.resourceId = id;
+ this.name = name;
+ this.value = value;
+ }
+
+ @Override
+ public long getId() {
+ return id;
+ }
+
+ @Override
+ public String getName() {
+ return name;
+ }
+
+ @Override
+ public String getValue() {
+ return value;
+ }
+
+ @Override
+ public long getResourceId() {
+ return resourceId;
+ }
+
+ @Override
+ public boolean isDisplay() {
+ return display;
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/79e64aa5/engine/schema/src/org/apache/cloudstack/resourcedetail/dao/DiskOfferingDetailsDao.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/org/apache/cloudstack/resourcedetail/dao/DiskOfferingDetailsDao.java b/engine/schema/src/org/apache/cloudstack/resourcedetail/dao/DiskOfferingDetailsDao.java
new file mode 100644
index 0000000..68a8614
--- /dev/null
+++ b/engine/schema/src/org/apache/cloudstack/resourcedetail/dao/DiskOfferingDetailsDao.java
@@ -0,0 +1,26 @@
+// 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.resourcedetail.dao;
+
+import org.apache.cloudstack.resourcedetail.DiskOfferingDetailVO;
+import org.apache.cloudstack.resourcedetail.ResourceDetailsDao;
+
+import com.cloud.utils.db.GenericDao;
+
+public interface DiskOfferingDetailsDao extends GenericDao<DiskOfferingDetailVO, Long>, ResourceDetailsDao<DiskOfferingDetailVO> {
+
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/79e64aa5/engine/schema/src/org/apache/cloudstack/resourcedetail/dao/DiskOfferingDetailsDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/org/apache/cloudstack/resourcedetail/dao/DiskOfferingDetailsDaoImpl.java b/engine/schema/src/org/apache/cloudstack/resourcedetail/dao/DiskOfferingDetailsDaoImpl.java
new file mode 100644
index 0000000..e2fc26e
--- /dev/null
+++ b/engine/schema/src/org/apache/cloudstack/resourcedetail/dao/DiskOfferingDetailsDaoImpl.java
@@ -0,0 +1,33 @@
+// 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.resourcedetail.dao;
+
+import javax.ejb.Local;
+
+import org.apache.cloudstack.resourcedetail.DiskOfferingDetailVO;
+import org.apache.cloudstack.resourcedetail.ResourceDetailsDaoBase;
+import org.springframework.stereotype.Component;
+
+@Component
+@Local(value = {DiskOfferingDetailsDao.class})
+public class DiskOfferingDetailsDaoImpl extends ResourceDetailsDaoBase<DiskOfferingDetailVO> implements DiskOfferingDetailsDao {
+
+ @Override
+ public void addDetail(long resourceId, String key, String value) {
+ super.addDetail(new DiskOfferingDetailVO(resourceId, key, value));
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/79e64aa5/server/src/com/cloud/metadata/ResourceMetaDataManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/metadata/ResourceMetaDataManagerImpl.java b/server/src/com/cloud/metadata/ResourceMetaDataManagerImpl.java
index 4cd9840..df082ec 100644
--- a/server/src/com/cloud/metadata/ResourceMetaDataManagerImpl.java
+++ b/server/src/com/cloud/metadata/ResourceMetaDataManagerImpl.java
@@ -26,6 +26,7 @@ import javax.naming.ConfigurationException;
import org.apache.cloudstack.api.ResourceDetail;
import org.apache.cloudstack.resourcedetail.ResourceDetailsDao;
+import org.apache.cloudstack.resourcedetail.dao.DiskOfferingDetailsDao;
import org.apache.cloudstack.resourcedetail.dao.FirewallRuleDetailsDao;
import org.apache.cloudstack.resourcedetail.dao.NetworkACLItemDetailsDao;
import org.apache.cloudstack.resourcedetail.dao.NetworkACLListDetailsDao;
@@ -101,6 +102,8 @@ public class ResourceMetaDataManagerImpl extends ManagerBase implements Resource
Site2SiteCustomerGatewayDetailsDao _customerGatewayDetailsDao;
@Inject
Site2SiteVpnConnectionDetailsDao _vpnConnectionDetailsDao;
+ @Inject
+ DiskOfferingDetailsDao _diskOfferingDetailsDao;
private static Map<ResourceObjectType, ResourceDetailsDao<? extends ResourceDetail>> s_daoMap = new HashMap<ResourceObjectType, ResourceDetailsDao<? extends ResourceDetail>>();
@@ -126,6 +129,7 @@ public class ResourceMetaDataManagerImpl extends ManagerBase implements Resource
s_daoMap.put(ResourceObjectType.VpnGateway, _vpnGatewayDetailsDao);
s_daoMap.put(ResourceObjectType.CustomerGateway, _customerGatewayDetailsDao);
s_daoMap.put(ResourceObjectType.VpnConnection, _vpnConnectionDetailsDao);
+ s_daoMap.put(ResourceObjectType.DiskOffering, _diskOfferingDetailsDao);
return true;
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/79e64aa5/server/src/com/cloud/tags/TaggedResourceManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/tags/TaggedResourceManagerImpl.java b/server/src/com/cloud/tags/TaggedResourceManagerImpl.java
index 3dd90ff..a202ad2 100644
--- a/server/src/com/cloud/tags/TaggedResourceManagerImpl.java
+++ b/server/src/com/cloud/tags/TaggedResourceManagerImpl.java
@@ -57,6 +57,7 @@ import com.cloud.server.ResourceTag;
import com.cloud.server.ResourceTag.ResourceObjectType;
import com.cloud.server.TaggedResourceService;
import com.cloud.service.dao.ServiceOfferingDao;
+import com.cloud.storage.dao.DiskOfferingDao;
import com.cloud.storage.dao.SnapshotDao;
import com.cloud.storage.dao.VMTemplateDao;
import com.cloud.storage.dao.VolumeDao;
@@ -64,6 +65,7 @@ import com.cloud.tags.dao.ResourceTagDao;
import com.cloud.user.Account;
import com.cloud.user.AccountManager;
import com.cloud.user.DomainManager;
+import com.cloud.user.dao.UserDao;
import com.cloud.utils.Pair;
import com.cloud.utils.component.ManagerBase;
import com.cloud.utils.db.DB;
@@ -147,6 +149,10 @@ public class TaggedResourceManagerImpl extends ManagerBase implements TaggedReso
Site2SiteCustomerGatewayDao _customerGatewayDao;
@Inject
Site2SiteVpnConnectionDao _vpnConnectionDao;
+ @Inject
+ UserDao _userDao;
+ @Inject
+ DiskOfferingDao _diskOffDao;
@Override
public boolean configure(String name, Map<String, Object> params) throws ConfigurationException {
@@ -176,6 +182,8 @@ public class TaggedResourceManagerImpl extends ManagerBase implements TaggedReso
s_daoMap.put(ResourceObjectType.VpnGateway, _vpnGatewayDao);
s_daoMap.put(ResourceObjectType.CustomerGateway, _customerGatewayDao);
s_daoMap.put(ResourceObjectType.VpnConnection, _vpnConnectionDao);
+ s_daoMap.put(ResourceObjectType.User, _userDao);
+ s_daoMap.put(ResourceObjectType.DiskOffering, _diskOffDao);
return true;
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/79e64aa5/setup/db/db/schema-430to440.sql
----------------------------------------------------------------------
diff --git a/setup/db/db/schema-430to440.sql b/setup/db/db/schema-430to440.sql
index f4dc2e6..0dd2c39 100644
--- a/setup/db/db/schema-430to440.sql
+++ b/setup/db/db/schema-430to440.sql
@@ -214,3 +214,5 @@ CREATE VIEW `cloud`.`volume_view` AS
and async_job.job_status = 0;
UPDATE `cloud`.`configuration` SET `description` = 'If set to true, StartCommand, StopCommand, CopyCommand, MigrateCommand will be synchronized on the agent side. If set to false, these commands become asynchronous. Default value is true.' WHERE `name` = 'execute.in.sequence.hypervisor.commands';
+
+ALTER TABLE `cloud`.`disk_offering_details` CHANGE `display_detail` `display` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'True if the detail can be displayed to the end user';
\ No newline at end of file