You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by bf...@apache.org on 2013/10/16 23:45:28 UTC

[1/8] git commit: updated refs/heads/ui-restyle to 116e06e

Updated Branches:
  refs/heads/ui-restyle 2edd97ec8 -> 116e06e3b


CLOUDSTACK-4872:VM provisioned using a registered Windows Server 2012
template will show as other os in VCenter.


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/b05f19eb
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/b05f19eb
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/b05f19eb

Branch: refs/heads/ui-restyle
Commit: b05f19eb9e9a4fc796099b1b2055723566838881
Parents: 56129c3
Author: Min Chen <mi...@citrix.com>
Authored: Tue Oct 15 12:16:41 2013 -0700
Committer: Min Chen <mi...@citrix.com>
Committed: Tue Oct 15 13:56:13 2013 -0700

----------------------------------------------------------------------
 setup/db/db/schema-420to421.sql                                  | 3 +++
 setup/db/templates.sql                                           | 4 ----
 .../com/cloud/hypervisor/vmware/util/VmwareGuestOsMapper.java    | 2 +-
 3 files changed, 4 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b05f19eb/setup/db/db/schema-420to421.sql
----------------------------------------------------------------------
diff --git a/setup/db/db/schema-420to421.sql b/setup/db/db/schema-420to421.sql
index fc43fe5..4dfe4e6 100644
--- a/setup/db/db/schema-420to421.sql
+++ b/setup/db/db/schema-420to421.sql
@@ -24,3 +24,6 @@ INSERT IGNORE INTO `cloud`.`configuration` VALUES ('Advanced', 'DEFAULT', 'manag
 
 INSERT IGNORE INTO `cloud`.`configuration` VALUES ("Storage", 'DEFAULT', 'management-server', "enable.ha.storage.migration", "true", "Enable/disable storage migration across primary storage during HA"); 
 
+-- Remove Windows Server 8 from guest_os_type dropdown to use Windows Server 2012
+DELETE FROM `cloud`.`guest_os_hypervisor` where guest_os_id=168;
+DELETE FROM `cloud`.`guest_os` where id=168;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b05f19eb/setup/db/templates.sql
----------------------------------------------------------------------
diff --git a/setup/db/templates.sql b/setup/db/templates.sql
index e030852..e5a653c 100755
--- a/setup/db/templates.sql
+++ b/setup/db/templates.sql
@@ -217,7 +217,6 @@ INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (164
 INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (165, UUID(), 6, 'Windows 8 (32-bit)');
 INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (166, UUID(), 6, 'Windows 8 (64-bit)');
 INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (167, UUID(), 6, 'Windows Server 2012 (64-bit)');
-INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (168, UUID(), 6, 'Windows Server 8 (64-bit)');
 INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (169, UUID(), 10, 'Ubuntu 11.04 (32-bit)');
 INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (170, UUID(), 10, 'Ubuntu 11.04 (64-bit)');
 INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (171, UUID(), 1, 'CentOS 6.3 (32-bit)');
@@ -373,8 +372,6 @@ INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest
 INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES  ("XenServer", 'Windows 8 (32-bit)', 165);
 INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES  ("XenServer", 'Windows 8 (64-bit)', 166);
 INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES  ("XenServer", 'Windows Server 2012 (64-bit)', 167);
-INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES  ("XenServer", 'Windows Server 8 (64-bit)', 168);
-
 
 INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("VmWare", 'Microsoft Windows 7(32-bit)', 48);
 INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("VmWare", 'Microsoft Windows 7(64-bit)', 49);
@@ -406,7 +403,6 @@ INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest
 INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES  ("VmWare", 'Windows 8 (32-bit)', 165);
 INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES  ("VmWare", 'Windows 8 (64-bit)', 166);
 INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES  ("VmWare", 'Windows Server 2012 (64-bit)', 167);
-INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES  ("VmWare", 'Windows Server 8 (64-bit)', 168);
 
 INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("VmWare", 'Red Hat Enterprise Linux 5.0(32-bit)', 30);
 INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("VmWare", 'Red Hat Enterprise Linux 5.1(32-bit)', 32);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b05f19eb/vmware-base/src/com/cloud/hypervisor/vmware/util/VmwareGuestOsMapper.java
----------------------------------------------------------------------
diff --git a/vmware-base/src/com/cloud/hypervisor/vmware/util/VmwareGuestOsMapper.java b/vmware-base/src/com/cloud/hypervisor/vmware/util/VmwareGuestOsMapper.java
index eb16141..6ee0f75 100755
--- a/vmware-base/src/com/cloud/hypervisor/vmware/util/VmwareGuestOsMapper.java
+++ b/vmware-base/src/com/cloud/hypervisor/vmware/util/VmwareGuestOsMapper.java
@@ -60,7 +60,7 @@ public class VmwareGuestOsMapper {
 
         s_mapper.put("Windows 8 (32-bit)", VirtualMachineGuestOsIdentifier.WINDOWS_8_GUEST);
         s_mapper.put("Windows 8 (64-bit)", VirtualMachineGuestOsIdentifier.WINDOWS_8_64_GUEST);
-        s_mapper.put("Windows Server 8 (64-bit)", VirtualMachineGuestOsIdentifier.WINDOWS_8_SERVER_64_GUEST);
+        s_mapper.put("Windows Server 2012 (64-bit)", VirtualMachineGuestOsIdentifier.WINDOWS_8_SERVER_64_GUEST);
 
                 s_mapper.put("Apple Mac OS X 10.6 (32-bit)", VirtualMachineGuestOsIdentifier.DARWIN_10_GUEST);
                 s_mapper.put("Apple Mac OS X 10.6 (64-bit)", VirtualMachineGuestOsIdentifier.DARWIN_10_64_GUEST);


[8/8] git commit: updated refs/heads/ui-restyle to 116e06e

Posted by bf...@apache.org.
Merge branch 'master' into ui-restyle


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/116e06e3
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/116e06e3
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/116e06e3

Branch: refs/heads/ui-restyle
Commit: 116e06e3ba99fff0cbced84a8097ed5b383e720a
Parents: 2edd97e 81d078f
Author: Brian Federle <br...@citrix.com>
Authored: Wed Oct 16 14:45:13 2013 -0700
Committer: Brian Federle <br...@citrix.com>
Committed: Wed Oct 16 14:45:13 2013 -0700

----------------------------------------------------------------------
 api/src/com/cloud/server/ResourceTag.java       |  3 +-
 .../org/apache/cloudstack/api/ApiConstants.java |  1 +
 .../user/offering/ListServiceOfferingsCmd.java  | 31 +++++++++++++++-
 .../api/response/ServiceOfferingResponse.java   | 21 ++++++++---
 .../com/cloud/upgrade/dao/Upgrade307to410.java  | 30 ++++++++++++++-
 .../com/cloud/upgrade/dao/Upgrade40to41.java    | 30 ++++++++++++++-
 .../apache/cloudstack/region/dao/RegionDao.java |  2 +-
 .../cloudstack/region/dao/RegionDaoImpl.java    |  5 +++
 .../db/src/com/cloud/utils/db/GenericDao.java   |  2 -
 .../src/com/cloud/utils/db/GenericDaoBase.java  |  5 ---
 .../db/src/com/cloud/utils/db/Transaction.java  |  7 ----
 .../kvm/resource/LibvirtComputingResource.java  |  2 +-
 server/src/com/cloud/api/ApiDBUtils.java        |  4 ++
 .../com/cloud/api/query/QueryManagerImpl.java   | 39 ++++++++++++++++++--
 .../cloud/api/query/dao/ResourceTagJoinDao.java |  3 ++
 .../api/query/dao/ResourceTagJoinDaoImpl.java   | 25 ++++++++++---
 .../query/dao/ServiceOfferingJoinDaoImpl.java   | 18 ++++++---
 .../com/cloud/network/IpAddressManagerImpl.java | 23 +++++++++---
 .../cloud/tags/TaggedResourceManagerImpl.java   | 14 ++++---
 .../cloud/uuididentity/dao/IdentityDaoImpl.java |  8 +++-
 .../cloudstack/region/RegionManagerImpl.java    | 31 +++++++++++++++-
 setup/db/db/schema-420to421.sql                 |  3 ++
 setup/db/templates.sql                          |  4 --
 ui/css/cloudstack3.css                          |  2 +-
 ui/scripts/instances.js                         |  2 +-
 .../vmware/util/VmwareGuestOsMapper.java        |  2 +-
 26 files changed, 255 insertions(+), 62 deletions(-)
----------------------------------------------------------------------



[3/8] git commit: updated refs/heads/ui-restyle to 116e06e

Posted by bf...@apache.org.
CLOUDSTACK-2823: This affects Ubuntu as well, since qemu version is 1.0.0
I don't think host kernel version has any bearing on it. Original code
was tested with CentOS 6.3 and 6.4, but it seems to succeed or fail per-host,
e.g. a fast host might work and a slow host might not. I was getting intermittent
failures with ubuntu 12.04.3 prior to this patch.


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/3467c99e
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/3467c99e
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/3467c99e

Branch: refs/heads/ui-restyle
Commit: 3467c99e730af2949d4b6db3c3b953c9216f7a14
Parents: 818e6f9
Author: Marcus Sorensen <ma...@betterservers.com>
Authored: Wed Oct 16 00:25:04 2013 -0600
Committer: Marcus Sorensen <ma...@betterservers.com>
Committed: Wed Oct 16 00:27:22 2013 -0600

----------------------------------------------------------------------
 .../cloud/hypervisor/kvm/resource/LibvirtComputingResource.java    | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3467c99e/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java
index af31d48..cddfac9 100755
--- a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java
+++ b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java
@@ -3549,7 +3549,7 @@ ServerResource {
 
             // pass cmdline info to system vms
             if (vmSpec.getType() != VirtualMachine.Type.User) {
-                if ((_kernelVersion < 2006034) && (conn.getVersion() < 1001000)) { // CLOUDSTACK-2823: try passCmdLine some times if kernel < 2.6.34 and qemu < 1.1.0 on hypervisor (for instance, CentOS 6.4)
+                if ((conn.getVersion() < 1001000)) { // CLOUDSTACK-2823: try passCmdLine some times if kernel < 2.6.34 and qemu < 1.1.0 on hypervisor (for instance, CentOS 6.4)
                     //wait for 5 minutes at most
                     String controlIp = null;
                     for (NicTO nic : nics) {


[4/8] git commit: updated refs/heads/ui-restyle to 116e06e

Posted by bf...@apache.org.
Regression from Commit: f766a9e58dddfd70c2edc25e018b679a101a1eec Re-commit CLOUDSTACK-2413 - Display the Name of compute offering in dialog box Change Service Offering (was Description field before)

Signed-off-by: Milamber <mi...@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/08440668
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/08440668
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/08440668

Branch: refs/heads/ui-restyle
Commit: 08440668ebbbe282291a6e505b96030191deed4b
Parents: 3467c99
Author: Milamber <mi...@apache.org>
Authored: Wed Oct 16 11:37:06 2013 +0000
Committer: Milamber <mi...@apache.org>
Committed: Wed Oct 16 11:38:36 2013 +0000

----------------------------------------------------------------------
 ui/scripts/instances.js | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/08440668/ui/scripts/instances.js
----------------------------------------------------------------------
diff --git a/ui/scripts/instances.js b/ui/scripts/instances.js
index ba463e7..41d1772 100644
--- a/ui/scripts/instances.js
+++ b/ui/scripts/instances.js
@@ -1314,7 +1314,7 @@
                                                 $(serviceofferings).each(function() {
                                                     items.push({
                                                         id: this.id,
-                                                        description: this.displaytext
+                                                        description: this.name
                                                     });
                                                 });
                                                 args.response.success({


[2/8] git commit: updated refs/heads/ui-restyle to 116e06e

Posted by bf...@apache.org.
CLOUDSTACK-4874: added resource tags to the Service offering object. Tags can be created by using createTag API command; you can list service offerings by tags when pass "resourceTag" parameter to the listServiceOfferings call


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/818e6f98
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/818e6f98
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/818e6f98

Branch: refs/heads/ui-restyle
Commit: 818e6f98fd6bd3732c5867d8b2ae85365f374b95
Parents: b05f19e
Author: Alena Prokharchyk <al...@citrix.com>
Authored: Tue Oct 15 16:57:53 2013 -0700
Committer: Alena Prokharchyk <al...@citrix.com>
Committed: Tue Oct 15 17:08:55 2013 -0700

----------------------------------------------------------------------
 api/src/com/cloud/server/ResourceTag.java       |  3 +-
 .../org/apache/cloudstack/api/ApiConstants.java |  1 +
 .../user/offering/ListServiceOfferingsCmd.java  | 31 +++++++++++++++-
 .../api/response/ServiceOfferingResponse.java   | 21 ++++++++---
 server/src/com/cloud/api/ApiDBUtils.java        |  4 ++
 .../com/cloud/api/query/QueryManagerImpl.java   | 39 ++++++++++++++++++--
 .../cloud/api/query/dao/ResourceTagJoinDao.java |  3 ++
 .../api/query/dao/ResourceTagJoinDaoImpl.java   | 25 ++++++++++---
 .../query/dao/ServiceOfferingJoinDaoImpl.java   | 18 ++++++---
 .../cloud/tags/TaggedResourceManagerImpl.java   | 14 ++++---
 .../cloud/uuididentity/dao/IdentityDaoImpl.java |  8 +++-
 11 files changed, 137 insertions(+), 30 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/818e6f98/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 1c16f25..9e166ab 100644
--- a/api/src/com/cloud/server/ResourceTag.java
+++ b/api/src/com/cloud/server/ResourceTag.java
@@ -41,7 +41,8 @@ public interface ResourceTag extends ControlledEntity, Identity, InternalIdentit
         StaticRoute,
         VMSnapshot,
         RemoteAccessVpn,
-        Zone
+        Zone,
+        ServiceOffering
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/818e6f98/api/src/org/apache/cloudstack/api/ApiConstants.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/ApiConstants.java b/api/src/org/apache/cloudstack/api/ApiConstants.java
index f85784b..62eed09 100755
--- a/api/src/org/apache/cloudstack/api/ApiConstants.java
+++ b/api/src/org/apache/cloudstack/api/ApiConstants.java
@@ -518,6 +518,7 @@ public class ApiConstants {
     public static final String ROUTING = "isrouting";
     public static final String MAX_CONNECTIONS = "maxconnections";
     public static final String SERVICE_STATE = "servicestate";
+    public static final String RESOURCE_TAG = "resourcetag";
     public enum HostDetails {
         all, capacity, events, stats, min;
     }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/818e6f98/api/src/org/apache/cloudstack/api/command/user/offering/ListServiceOfferingsCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/user/offering/ListServiceOfferingsCmd.java b/api/src/org/apache/cloudstack/api/command/user/offering/ListServiceOfferingsCmd.java
index ca16cdc..06aad9d 100644
--- a/api/src/org/apache/cloudstack/api/command/user/offering/ListServiceOfferingsCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/offering/ListServiceOfferingsCmd.java
@@ -16,10 +16,16 @@
 // under the License.
 package org.apache.cloudstack.api.command.user.offering;
 
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
 import org.apache.cloudstack.api.APICommand;
 import org.apache.cloudstack.api.ApiConstants;
 import org.apache.cloudstack.api.BaseListCmd;
 import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.BaseCmd.CommandType;
 import org.apache.cloudstack.api.response.DomainResponse;
 import org.apache.cloudstack.api.response.ListResponse;
 import org.apache.cloudstack.api.response.ServiceOfferingResponse;
@@ -27,6 +33,8 @@ import org.apache.cloudstack.api.response.UserVmResponse;
 
 import org.apache.log4j.Logger;
 
+import com.cloud.exception.InvalidParameterValueException;
+
 @APICommand(name = "listServiceOfferings", description="Lists all available service offerings.", responseObject=ServiceOfferingResponse.class)
 public class ListServiceOfferingsCmd extends BaseListCmd {
     public static final Logger s_logger = Logger.getLogger(ListServiceOfferingsCmd.class.getName());
@@ -57,6 +65,9 @@ public class ListServiceOfferingsCmd extends BaseListCmd {
 
     @Parameter(name=ApiConstants.SYSTEM_VM_TYPE, type=CommandType.STRING, description="the system VM type. Possible types are \"consoleproxy\", \"secondarystoragevm\" or \"domainrouter\".")
     private String systemVmType;
+    
+    @Parameter(name = ApiConstants.RESOURCE_TAG, type = CommandType.MAP, description = "List service offerings by resource tags (key/value pairs)", since="4.3")
+    private Map resourceTag;
 
 
     /////////////////////////////////////////////////////
@@ -86,6 +97,25 @@ public class ListServiceOfferingsCmd extends BaseListCmd {
     public String getSystemVmType(){
         return systemVmType;
     }
+    
+    public Map<String, String> getResourceTags() {
+        Map<String, String> tagsMap = null;
+        if (resourceTag != null && !resourceTag.isEmpty()) {
+            tagsMap = new HashMap<String, String>();
+            Collection<?> servicesCollection = resourceTag.values();
+            Iterator<?> iter = servicesCollection.iterator();
+            while (iter.hasNext()) {
+                HashMap<String, String> services = (HashMap<String, String>) iter.next();
+                String key = services.get("key");
+                String value = services.get("value");
+                if (value == null) {
+                    throw new InvalidParameterValueException("No value is passed in for key " + key);
+                }
+                tagsMap.put(key, value);
+            }
+        }
+        return tagsMap;
+    }
 
     /////////////////////////////////////////////////////
     /////////////// API Implementation///////////////////
@@ -98,7 +128,6 @@ public class ListServiceOfferingsCmd extends BaseListCmd {
 
     @Override
     public void execute(){
-
         ListResponse<ServiceOfferingResponse> response = _queryService.searchForServiceOfferings(this);
         response.setResponseName(getCommandName());
         this.setResponseObject(response);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/818e6f98/api/src/org/apache/cloudstack/api/response/ServiceOfferingResponse.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/response/ServiceOfferingResponse.java b/api/src/org/apache/cloudstack/api/response/ServiceOfferingResponse.java
index 5c5b369..d683840 100644
--- a/api/src/org/apache/cloudstack/api/response/ServiceOfferingResponse.java
+++ b/api/src/org/apache/cloudstack/api/response/ServiceOfferingResponse.java
@@ -17,12 +17,9 @@
 package org.apache.cloudstack.api.response;
 
 import java.util.Date;
-
-
-import com.google.gson.annotations.SerializedName;
-
+import java.util.LinkedHashSet;
 import java.util.Map;
-
+import java.util.Set;
 
 import org.apache.cloudstack.api.ApiConstants;
 import org.apache.cloudstack.api.BaseResponse;
@@ -30,6 +27,7 @@ import org.apache.cloudstack.api.EntityReference;
 
 import com.cloud.offering.ServiceOffering;
 import com.cloud.serializer.Param;
+import com.google.gson.annotations.SerializedName;
 
 @EntityReference(value = ServiceOffering.class)
 public class ServiceOfferingResponse extends BaseResponse {
@@ -108,6 +106,15 @@ public class ServiceOfferingResponse extends BaseResponse {
     @SerializedName(ApiConstants.SERVICE_OFFERING_DETAILS)
     @Param(description = "additional key/value details tied with this service offering", since = "4.2.0")
     private Map<String, String> details;
+    
+    @SerializedName(ApiConstants.RESOURCE_TAG)  @Param(description="the list of resource tags associated with service offering." +
+    		" The resource tags are not used for Volume/VM placement on the specific host.",
+            responseObject = ResourceTagResponse.class, since="4.3")
+    private Set<ResourceTagResponse> resourceTags;
+    
+    public ServiceOfferingResponse(){
+        resourceTags = new LinkedHashSet<ResourceTagResponse>();
+    }
 
     public String getId() {
         return id;
@@ -287,4 +294,8 @@ public class ServiceOfferingResponse extends BaseResponse {
     public void setDetails(Map<String, String> details) {
         this.details = details;
     }
+
+    public void addTag(ResourceTagResponse tag){
+        this.resourceTags.add(tag);
+    }
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/818e6f98/server/src/com/cloud/api/ApiDBUtils.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/api/ApiDBUtils.java b/server/src/com/cloud/api/ApiDBUtils.java
index 6539289..fa397ed 100755
--- a/server/src/com/cloud/api/ApiDBUtils.java
+++ b/server/src/com/cloud/api/ApiDBUtils.java
@@ -1688,4 +1688,8 @@ public class ApiDBUtils {
     public static boolean isAdmin(Account account) {
         return _accountService.isAdmin(account.getType());
     }
+    
+    public static List<ResourceTagJoinVO> listResourceTagViewByResourceUUID(String resourceUUID, TaggedResourceType resourceType){
+        return  _tagJoinDao.listBy(resourceUUID, resourceType);
+    }
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/818e6f98/server/src/com/cloud/api/query/QueryManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/api/query/QueryManagerImpl.java b/server/src/com/cloud/api/query/QueryManagerImpl.java
index e65a8b8..b464e9e 100644
--- a/server/src/com/cloud/api/query/QueryManagerImpl.java
+++ b/server/src/com/cloud/api/query/QueryManagerImpl.java
@@ -26,7 +26,6 @@ import java.util.Set;
 import javax.ejb.Local;
 import javax.inject.Inject;
 
-import com.cloud.network.dao.NetworkDetailsDao;
 import org.apache.cloudstack.acl.ControlledEntity.ACLType;
 import org.apache.cloudstack.affinity.AffinityGroupDomainMapVO;
 import org.apache.cloudstack.affinity.AffinityGroupResponse;
@@ -142,6 +141,7 @@ import com.cloud.exception.PermissionDeniedException;
 import com.cloud.exception.UnsupportedServiceException;
 import com.cloud.ha.HighAvailabilityManager;
 import com.cloud.hypervisor.Hypervisor.HypervisorType;
+import com.cloud.network.dao.NetworkDetailsDao;
 import com.cloud.network.security.SecurityGroupVMMapVO;
 import com.cloud.network.security.dao.SecurityGroupVMMapDao;
 import com.cloud.org.Grouping;
@@ -168,6 +168,8 @@ import com.cloud.storage.VMTemplateVO;
 import com.cloud.storage.Volume;
 import com.cloud.storage.dao.VMTemplateDao;
 import com.cloud.storage.dao.VolumeDetailsDao;
+import com.cloud.tags.ResourceTagVO;
+import com.cloud.tags.dao.ResourceTagDao;
 import com.cloud.template.VirtualMachineTemplate.TemplateFilter;
 import com.cloud.user.Account;
 import com.cloud.user.AccountManager;
@@ -179,6 +181,7 @@ import com.cloud.utils.Pair;
 import com.cloud.utils.Ternary;
 import com.cloud.utils.component.ManagerBase;
 import com.cloud.utils.db.Filter;
+import com.cloud.utils.db.JoinBuilder;
 import com.cloud.utils.db.SearchBuilder;
 import com.cloud.utils.db.SearchCriteria;
 import com.cloud.utils.db.SearchCriteria.Func;
@@ -335,6 +338,9 @@ public class QueryManagerImpl extends ManagerBase implements QueryService {
 
     @Inject
     NetworkDetailsDao _networkDetailsDao;
+    
+    @Inject
+    ResourceTagDao _resourceTagDao;
 
     /*
      * (non-Javadoc)
@@ -2375,8 +2381,7 @@ public class QueryManagerImpl extends ManagerBase implements QueryService {
         isAscending = (isAscending == null ? true : isAscending);
         Filter searchFilter = new Filter(ServiceOfferingJoinVO.class, "sortKey", isAscending, cmd.getStartIndex(),
                 cmd.getPageSizeVal());
-        SearchCriteria<ServiceOfferingJoinVO> sc = _srvOfferingJoinDao.createSearchCriteria();
-
+        
         Account caller = CallContext.current().getCallingAccount();
         Object name = cmd.getServiceOfferingName();
         Object id = cmd.getId();
@@ -2385,6 +2390,22 @@ public class QueryManagerImpl extends ManagerBase implements QueryService {
         Long domainId = cmd.getDomainId();
         Boolean isSystem = cmd.getIsSystem();
         String vmTypeStr = cmd.getSystemVmType();
+        Map<String, String> resourceTags = cmd.getResourceTags();
+        
+        SearchBuilder<ServiceOfferingJoinVO> sb = _srvOfferingJoinDao.createSearchBuilder();
+        if (resourceTags != null && !resourceTags.isEmpty()) {
+            SearchBuilder<ResourceTagVO> tagSearch = _resourceTagDao.createSearchBuilder();
+            for (int count=0; count < resourceTags.size(); count++) {
+                tagSearch.or().op("key" + String.valueOf(count), tagSearch.entity().getKey(), SearchCriteria.Op.EQ);
+                tagSearch.and("value" + String.valueOf(count), tagSearch.entity().getValue(), SearchCriteria.Op.EQ);
+                tagSearch.cp();
+            }
+            tagSearch.and("resourceType", tagSearch.entity().getResourceType(), SearchCriteria.Op.EQ);
+            sb.groupBy(sb.entity().getId());
+            sb.join("tagSearch", tagSearch, sb.entity().getId(), tagSearch.entity().getResourceId(), JoinBuilder.JoinType.INNER);
+        }
+        
+        SearchCriteria<ServiceOfferingJoinVO> sc = sb.create();
 
         if (caller.getType() != Account.ACCOUNT_TYPE_ADMIN && isSystem) {
             throw new InvalidParameterValueException("Only ROOT admins can access system's offering");
@@ -2483,9 +2504,19 @@ public class QueryManagerImpl extends ManagerBase implements QueryService {
         if (vmTypeStr != null) {
             sc.addAnd("vm_type", SearchCriteria.Op.EQ, vmTypeStr);
         }
+        
+        
+        if (resourceTags != null && !resourceTags.isEmpty()) {
+            int count = 0;
+            sc.setJoinParameters("tagSearch", "resourceType", TaggedResourceType.ServiceOffering.toString());
+            for (String key : resourceTags.keySet()) {
+                sc.setJoinParameters("tagSearch", "key" + String.valueOf(count), key);
+                sc.setJoinParameters("tagSearch", "value" + String.valueOf(count), resourceTags.get(key));
+                count++;
+            }
+        }
 
         return _srvOfferingJoinDao.searchAndCount(sc, searchFilter);
-
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/818e6f98/server/src/com/cloud/api/query/dao/ResourceTagJoinDao.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/api/query/dao/ResourceTagJoinDao.java b/server/src/com/cloud/api/query/dao/ResourceTagJoinDao.java
index 57fc130..627033c 100644
--- a/server/src/com/cloud/api/query/dao/ResourceTagJoinDao.java
+++ b/server/src/com/cloud/api/query/dao/ResourceTagJoinDao.java
@@ -22,6 +22,7 @@ import org.apache.cloudstack.api.response.ResourceTagResponse;
 
 import com.cloud.api.query.vo.ResourceTagJoinVO;
 import com.cloud.server.ResourceTag;
+import com.cloud.server.ResourceTag.TaggedResourceType;
 import com.cloud.utils.db.GenericDao;
 
 public interface ResourceTagJoinDao extends GenericDao<ResourceTagJoinVO, Long> {
@@ -31,4 +32,6 @@ public interface ResourceTagJoinDao extends GenericDao<ResourceTagJoinVO, Long>
     ResourceTagJoinVO newResourceTagView(ResourceTag vr);
 
     List<ResourceTagJoinVO> searchByIds(Long... ids);
+    
+    List<ResourceTagJoinVO> listBy(String resourceUUID, TaggedResourceType resourceType);
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/818e6f98/server/src/com/cloud/api/query/dao/ResourceTagJoinDaoImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/api/query/dao/ResourceTagJoinDaoImpl.java b/server/src/com/cloud/api/query/dao/ResourceTagJoinDaoImpl.java
index 06821db..f0ddaa6 100644
--- a/server/src/com/cloud/api/query/dao/ResourceTagJoinDaoImpl.java
+++ b/server/src/com/cloud/api/query/dao/ResourceTagJoinDaoImpl.java
@@ -24,16 +24,17 @@ import javax.inject.Inject;
 
 import org.apache.cloudstack.api.response.ResourceTagResponse;
 import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
-
 import org.apache.log4j.Logger;
 import org.springframework.stereotype.Component;
 
 import com.cloud.api.ApiResponseHelper;
 import com.cloud.api.query.vo.ResourceTagJoinVO;
 import com.cloud.server.ResourceTag;
+import com.cloud.server.ResourceTag.TaggedResourceType;
 import com.cloud.utils.db.GenericDaoBase;
 import com.cloud.utils.db.SearchBuilder;
 import com.cloud.utils.db.SearchCriteria;
+import com.cloud.utils.db.SearchCriteria.Op;
 
 @Component
 @Local(value={ResourceTagJoinDao.class})
@@ -46,6 +47,9 @@ public class ResourceTagJoinDaoImpl extends GenericDaoBase<ResourceTagJoinVO, Lo
     private final SearchBuilder<ResourceTagJoinVO> tagSearch;
 
     private final SearchBuilder<ResourceTagJoinVO> tagIdSearch;
+    
+    private final SearchBuilder<ResourceTagJoinVO> AllFieldsSearch;
+
 
     protected ResourceTagJoinDaoImpl() {
 
@@ -58,12 +62,14 @@ public class ResourceTagJoinDaoImpl extends GenericDaoBase<ResourceTagJoinVO, Lo
         tagIdSearch.done();
 
         this._count = "select count(distinct id) from resource_tag_view WHERE ";
+        
+        AllFieldsSearch = createSearchBuilder();
+        AllFieldsSearch.and("resourceId", AllFieldsSearch.entity().getResourceId(), Op.EQ);
+        AllFieldsSearch.and("uuid", AllFieldsSearch.entity().getResourceUuid(), Op.EQ);
+        AllFieldsSearch.and("resourceType", AllFieldsSearch.entity().getResourceType(), Op.EQ);
+        AllFieldsSearch.done();
     }
 
-
-
-
-
     @Override
     public ResourceTagResponse newResourceTagResponse(ResourceTagJoinVO resourceTag, boolean keyValueOnly) {
         ResourceTagResponse response = new ResourceTagResponse();
@@ -86,6 +92,15 @@ public class ResourceTagJoinDaoImpl extends GenericDaoBase<ResourceTagJoinVO, Lo
 
         return response;
     }
+    
+    
+    @Override
+    public List<ResourceTagJoinVO> listBy(String resourceUUID, TaggedResourceType resourceType) {
+        SearchCriteria<ResourceTagJoinVO> sc = AllFieldsSearch.create();
+        sc.setParameters("uuid", resourceUUID);
+        sc.setParameters("resourceType", resourceType);
+        return listBy(sc);
+    }
 
 
     @Override

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/818e6f98/server/src/com/cloud/api/query/dao/ServiceOfferingJoinDaoImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/api/query/dao/ServiceOfferingJoinDaoImpl.java b/server/src/com/cloud/api/query/dao/ServiceOfferingJoinDaoImpl.java
index 945e67b..8c32be3 100644
--- a/server/src/com/cloud/api/query/dao/ServiceOfferingJoinDaoImpl.java
+++ b/server/src/com/cloud/api/query/dao/ServiceOfferingJoinDaoImpl.java
@@ -17,22 +17,22 @@
 package com.cloud.api.query.dao;
 
 import java.util.List;
-import java.util.Map;
 
 import javax.ejb.Local;
 
+import org.apache.cloudstack.api.response.ResourceTagResponse;
+import org.apache.cloudstack.api.response.ServiceOfferingResponse;
 import org.apache.log4j.Logger;
+import org.springframework.stereotype.Component;
 
 import com.cloud.api.ApiDBUtils;
+import com.cloud.api.query.vo.ResourceTagJoinVO;
 import com.cloud.api.query.vo.ServiceOfferingJoinVO;
-import org.apache.cloudstack.api.response.ServiceOfferingResponse;
-
 import com.cloud.offering.ServiceOffering;
-import com.cloud.offering.NetworkOffering.Detail;
+import com.cloud.server.ResourceTag.TaggedResourceType;
 import com.cloud.utils.db.GenericDaoBase;
 import com.cloud.utils.db.SearchBuilder;
 import com.cloud.utils.db.SearchCriteria;
-import org.springframework.stereotype.Component;
 
 @Component
 @Local(value={ServiceOfferingJoinDao.class})
@@ -48,7 +48,7 @@ public class ServiceOfferingJoinDaoImpl extends GenericDaoBase<ServiceOfferingJo
         sofIdSearch.and("id", sofIdSearch.entity().getId(), SearchCriteria.Op.EQ);
         sofIdSearch.done();
 
-        this._count = "select count(distinct id) from service_offering_view WHERE ";
+        this._count = "select count(distinct service_offering_view.id) from service_offering_view WHERE ";
     }
 
 
@@ -84,6 +84,12 @@ public class ServiceOfferingJoinDaoImpl extends GenericDaoBase<ServiceOfferingJo
         offeringResponse.setIopsWriteRate(offering.getIopsWriteRate());
         offeringResponse.setDetails(ApiDBUtils.getServiceOfferingDetails(offering.getId()));
         offeringResponse.setObjectName("serviceoffering");
+        
+        // update tag information
+        List<ResourceTagJoinVO> resourceTags = ApiDBUtils.listResourceTagViewByResourceUUID(offering.getUuid(), TaggedResourceType.ServiceOffering);
+        for (ResourceTagJoinVO resourceTag : resourceTags) {            
+            ResourceTagResponse tagResponse = ApiDBUtils.newResourceTagResponse(resourceTag, false);
+            offeringResponse.addTag(tagResponse);        }
 
         return offeringResponse;
     }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/818e6f98/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 795a970..79aba63 100644
--- a/server/src/com/cloud/tags/TaggedResourceManagerImpl.java
+++ b/server/src/com/cloud/tags/TaggedResourceManagerImpl.java
@@ -25,16 +25,12 @@ import javax.ejb.Local;
 import javax.inject.Inject;
 import javax.naming.ConfigurationException;
 
-import com.cloud.dc.dao.DataCenterDao;
-import com.cloud.vm.dao.NicDao;
-import com.cloud.network.vpc.NetworkACLItemDao;
-
+import org.apache.cloudstack.context.CallContext;
 import org.apache.log4j.Logger;
 import org.springframework.stereotype.Component;
 
-import org.apache.cloudstack.context.CallContext;
-
 import com.cloud.api.query.dao.ResourceTagJoinDao;
+import com.cloud.dc.dao.DataCenterDao;
 import com.cloud.domain.Domain;
 import com.cloud.event.ActionEvent;
 import com.cloud.event.EventTypes;
@@ -47,12 +43,14 @@ import com.cloud.network.dao.NetworkDao;
 import com.cloud.network.dao.RemoteAccessVpnDao;
 import com.cloud.network.rules.dao.PortForwardingRulesDao;
 import com.cloud.network.security.dao.SecurityGroupDao;
+import com.cloud.network.vpc.NetworkACLItemDao;
 import com.cloud.network.vpc.dao.StaticRouteDao;
 import com.cloud.network.vpc.dao.VpcDao;
 import com.cloud.projects.dao.ProjectDao;
 import com.cloud.server.ResourceTag;
 import com.cloud.server.ResourceTag.TaggedResourceType;
 import com.cloud.server.TaggedResourceService;
+import com.cloud.service.dao.ServiceOfferingDao;
 import com.cloud.storage.dao.SnapshotDao;
 import com.cloud.storage.dao.VMTemplateDao;
 import com.cloud.storage.dao.VolumeDao;
@@ -70,6 +68,7 @@ import com.cloud.utils.db.SearchCriteria;
 import com.cloud.utils.db.Transaction;
 import com.cloud.utils.exception.CloudRuntimeException;
 import com.cloud.uuididentity.dao.IdentityDao;
+import com.cloud.vm.dao.NicDao;
 import com.cloud.vm.dao.UserVmDao;
 import com.cloud.vm.snapshot.dao.VMSnapshotDao;
 
@@ -128,6 +127,8 @@ public class TaggedResourceManagerImpl extends ManagerBase implements TaggedReso
     NetworkACLItemDao _networkACLItemDao;
     @Inject
     DataCenterDao _dataCenterDao;
+    @Inject
+    ServiceOfferingDao _serviceOffDao;
 
 
     @Override
@@ -151,6 +152,7 @@ public class TaggedResourceManagerImpl extends ManagerBase implements TaggedReso
         _daoMap.put(TaggedResourceType.VMSnapshot, _vmSnapshotDao);
         _daoMap.put(TaggedResourceType.RemoteAccessVpn, _vpnDao);
         _daoMap.put(TaggedResourceType.Zone, _dataCenterDao);
+        _daoMap.put(TaggedResourceType.ServiceOffering, _serviceOffDao);
 
         return true;
     }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/818e6f98/server/src/com/cloud/uuididentity/dao/IdentityDaoImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/uuididentity/dao/IdentityDaoImpl.java b/server/src/com/cloud/uuididentity/dao/IdentityDaoImpl.java
index c6fd8c1..18b7d8b 100644
--- a/server/src/com/cloud/uuididentity/dao/IdentityDaoImpl.java
+++ b/server/src/com/cloud/uuididentity/dao/IdentityDaoImpl.java
@@ -110,7 +110,9 @@ public class IdentityDaoImpl extends GenericDaoBase<IdentityVO, Long> implements
                 pstmt.setLong(1, identityId);
                 ResultSet rs = pstmt.executeQuery();
                 if (rs.next()) {
-                    domainId = rs.getLong(1);
+                    if (rs.getLong(1) != 0) {
+                        domainId = rs.getLong(1);
+                    }
                 }
             } catch (SQLException e) {
             }
@@ -125,7 +127,9 @@ public class IdentityDaoImpl extends GenericDaoBase<IdentityVO, Long> implements
                 pstmt.setLong(1, identityId);
                 ResultSet rs = pstmt.executeQuery();
                 if (rs.next()) {
-                    accountId = rs.getLong(1);
+                    if (rs.getLong(1) != 0) {
+                        accountId = rs.getLong(1);
+                    }
                 }
             } catch (SQLException e) {
             }


[6/8] git commit: updated refs/heads/ui-restyle to 116e06e

Posted by bf...@apache.org.
CLOUDSTACK-4095 : Remove region_id from Transaction. Read from db.properties whenever required

Conflicts:
	framework/db/src/com/cloud/utils/db/GenericDaoBase.java


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/81f1a0b8
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/81f1a0b8
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/81f1a0b8

Branch: refs/heads/ui-restyle
Commit: 81f1a0b831f40564ef2ceee225ccd86e7447e030
Parents: df3b099
Author: Kishan Kavala <ki...@cloud.com>
Authored: Wed Oct 16 19:22:33 2013 +0530
Committer: Kishan Kavala <ki...@cloud.com>
Committed: Wed Oct 16 19:28:42 2013 +0530

----------------------------------------------------------------------
 .../com/cloud/upgrade/dao/Upgrade307to410.java  | 30 ++++++++++++++++++-
 .../com/cloud/upgrade/dao/Upgrade40to41.java    | 30 ++++++++++++++++++-
 .../apache/cloudstack/region/dao/RegionDao.java |  2 +-
 .../cloudstack/region/dao/RegionDaoImpl.java    |  5 ++++
 .../db/src/com/cloud/utils/db/GenericDao.java   |  2 --
 .../src/com/cloud/utils/db/GenericDaoBase.java  |  5 ----
 .../db/src/com/cloud/utils/db/Transaction.java  |  7 -----
 .../cloudstack/region/RegionManagerImpl.java    | 31 +++++++++++++++++++-
 8 files changed, 94 insertions(+), 18 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/81f1a0b8/engine/schema/src/com/cloud/upgrade/dao/Upgrade307to410.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/upgrade/dao/Upgrade307to410.java b/engine/schema/src/com/cloud/upgrade/dao/Upgrade307to410.java
index 5c7717f..6631050 100644
--- a/engine/schema/src/com/cloud/upgrade/dao/Upgrade307to410.java
+++ b/engine/schema/src/com/cloud/upgrade/dao/Upgrade307to410.java
@@ -18,15 +18,22 @@
 package com.cloud.upgrade.dao;
 
 import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
 import java.sql.Connection;
 import java.sql.PreparedStatement;
 import java.sql.SQLException;
+import java.util.Properties;
 
+import com.cloud.utils.PropertiesUtil;
+import com.cloud.utils.crypt.EncryptionSecretKeyChecker;
 import org.apache.log4j.Logger;
 
 import com.cloud.utils.db.Transaction;
 import com.cloud.utils.exception.CloudRuntimeException;
 import com.cloud.utils.script.Script;
+import org.jasypt.encryption.pbe.StandardPBEStringEncryptor;
+import org.jasypt.properties.EncryptableProperties;
 
 public class Upgrade307to410 implements DbUpgrade {
     final static Logger s_logger = Logger.getLogger(Upgrade307to410.class);
@@ -62,7 +69,28 @@ public class Upgrade307to410 implements DbUpgrade {
     }
     
     private void updateRegionEntries(Connection conn) {
-        int region_id = Transaction.s_region_id;
+        File dbPropsFile = PropertiesUtil.findConfigFile("db.properties");
+        final Properties dbProps;
+        if (EncryptionSecretKeyChecker.useEncryption()) {
+            StandardPBEStringEncryptor encryptor = EncryptionSecretKeyChecker.getEncryptor();
+            dbProps = new EncryptableProperties(encryptor);
+        } else {
+            dbProps = new Properties();
+        }
+        try {
+            dbProps.load(new FileInputStream(dbPropsFile));
+        } catch (IOException e) {
+            s_logger.fatal("Unable to load db properties file, pl. check the classpath and file path configuration", e);
+            return;
+        } catch (NullPointerException e) {
+            s_logger.fatal("Unable to locate db properties file within classpath or absolute path: db.properties");
+            return;
+        }
+        int region_id = 1;
+        String regionId = dbProps.getProperty("region.id");
+        if(regionId != null){
+            region_id = Integer.parseInt(regionId);
+        }
         PreparedStatement pstmt = null;
         try {
             //Update regionId in region table

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/81f1a0b8/engine/schema/src/com/cloud/upgrade/dao/Upgrade40to41.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/upgrade/dao/Upgrade40to41.java b/engine/schema/src/com/cloud/upgrade/dao/Upgrade40to41.java
index 9e386b9..79ca5e1 100644
--- a/engine/schema/src/com/cloud/upgrade/dao/Upgrade40to41.java
+++ b/engine/schema/src/com/cloud/upgrade/dao/Upgrade40to41.java
@@ -17,16 +17,23 @@
 
 package com.cloud.upgrade.dao;
 
+import com.cloud.utils.PropertiesUtil;
+import com.cloud.utils.crypt.EncryptionSecretKeyChecker;
 import com.cloud.utils.db.Transaction;
 import com.cloud.utils.exception.CloudRuntimeException;
 import com.cloud.utils.script.Script;
 import org.apache.log4j.Logger;
+import org.jasypt.encryption.pbe.StandardPBEStringEncryptor;
+import org.jasypt.properties.EncryptableProperties;
 
 import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
 import java.sql.Connection;
 import java.sql.PreparedStatement;
 import java.sql.ResultSet;
 import java.sql.SQLException;
+import java.util.Properties;
 import java.util.UUID;
 
 public class Upgrade40to41 implements DbUpgrade {
@@ -74,7 +81,28 @@ public class Upgrade40to41 implements DbUpgrade {
     }
 
     private void updateRegionEntries(Connection conn) {
-        int region_id = Transaction.s_region_id;
+        File dbPropsFile = PropertiesUtil.findConfigFile("db.properties");
+        final Properties dbProps;
+        if (EncryptionSecretKeyChecker.useEncryption()) {
+            StandardPBEStringEncryptor encryptor = EncryptionSecretKeyChecker.getEncryptor();
+            dbProps = new EncryptableProperties(encryptor);
+        } else {
+            dbProps = new Properties();
+        }
+        try {
+            dbProps.load(new FileInputStream(dbPropsFile));
+        } catch (IOException e) {
+            s_logger.fatal("Unable to load db properties file, pl. check the classpath and file path configuration", e);
+            return;
+        } catch (NullPointerException e) {
+            s_logger.fatal("Unable to locate db properties file within classpath or absolute path: db.properties");
+            return;
+        }
+        int region_id = 1;
+        String regionId = dbProps.getProperty("region.id");
+        if(regionId != null){
+            region_id = Integer.parseInt(regionId);
+        }
         PreparedStatement pstmt = null;
         try {
             //Update regionId in region table

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/81f1a0b8/engine/schema/src/org/apache/cloudstack/region/dao/RegionDao.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/org/apache/cloudstack/region/dao/RegionDao.java b/engine/schema/src/org/apache/cloudstack/region/dao/RegionDao.java
index 91b51d3..c20735e 100644
--- a/engine/schema/src/org/apache/cloudstack/region/dao/RegionDao.java
+++ b/engine/schema/src/org/apache/cloudstack/region/dao/RegionDao.java
@@ -23,5 +23,5 @@ import com.cloud.utils.db.GenericDao;
 public interface RegionDao extends GenericDao<RegionVO, Integer> {
 
 	RegionVO findByName(String name);
-
+    int getRegionId();
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/81f1a0b8/engine/schema/src/org/apache/cloudstack/region/dao/RegionDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/org/apache/cloudstack/region/dao/RegionDaoImpl.java b/engine/schema/src/org/apache/cloudstack/region/dao/RegionDaoImpl.java
index 8f50f93..4a636a6 100644
--- a/engine/schema/src/org/apache/cloudstack/region/dao/RegionDaoImpl.java
+++ b/engine/schema/src/org/apache/cloudstack/region/dao/RegionDaoImpl.java
@@ -45,4 +45,9 @@ public class RegionDaoImpl extends GenericDaoBase<RegionVO, Integer> implements
         sc.setParameters("name", name);
         return findOneBy(sc);
 	}
+
+    @Override
+    public int getRegionId(){
+        return 1;
+    }
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/81f1a0b8/framework/db/src/com/cloud/utils/db/GenericDao.java
----------------------------------------------------------------------
diff --git a/framework/db/src/com/cloud/utils/db/GenericDao.java b/framework/db/src/com/cloud/utils/db/GenericDao.java
index 6c7e928..ef25d7f 100755
--- a/framework/db/src/com/cloud/utils/db/GenericDao.java
+++ b/framework/db/src/com/cloud/utils/db/GenericDao.java
@@ -265,8 +265,6 @@ public interface GenericDao<T, ID extends Serializable> {
      */
     Class<T> getEntityBeanType();
     
-    public int getRegionId();
-
     /**
      * @param sc
      * @param filter

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/81f1a0b8/framework/db/src/com/cloud/utils/db/GenericDaoBase.java
----------------------------------------------------------------------
diff --git a/framework/db/src/com/cloud/utils/db/GenericDaoBase.java b/framework/db/src/com/cloud/utils/db/GenericDaoBase.java
index b4c02cf..574974e 100755
--- a/framework/db/src/com/cloud/utils/db/GenericDaoBase.java
+++ b/framework/db/src/com/cloud/utils/db/GenericDaoBase.java
@@ -1796,11 +1796,6 @@ public abstract class GenericDaoBase<T, ID extends Serializable> extends Compone
         return builder.create();
     }
 
-    @Override
-    public int getRegionId(){
-    	return Transaction.s_region_id;
-    }
-
     public Integer getCount(SearchCriteria<T> sc) {
         String clause = sc != null ? sc.getWhereClause() : null;
         if (clause != null && clause.length() == 0) {

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/81f1a0b8/framework/db/src/com/cloud/utils/db/Transaction.java
----------------------------------------------------------------------
diff --git a/framework/db/src/com/cloud/utils/db/Transaction.java b/framework/db/src/com/cloud/utils/db/Transaction.java
index a5da4b3..8c2f199 100755
--- a/framework/db/src/com/cloud/utils/db/Transaction.java
+++ b/framework/db/src/com/cloud/utils/db/Transaction.java
@@ -83,7 +83,6 @@ public class Transaction {
     public static final short AWSAPI_DB = 2;
     public static final short SIMULATOR_DB = 3;
     public static final short CONNECTED_DB = -1;
-    public static int s_region_id;
 
     private static AtomicLong s_id = new AtomicLong();
     private static final TransactionMBeanImpl s_mbean = new TransactionMBeanImpl();
@@ -1079,12 +1078,6 @@ public class Transaction {
                 System.setProperty("javax.net.ssl.trustStorePassword", dbProps.getProperty("db.cloud.trustStorePassword"));
             }
 
-            String regionId = dbProps.getProperty("region.id");
-            if(regionId == null){
-            	s_region_id = 1;
-            } else {
-            	s_region_id = Integer.parseInt(regionId);
-            }
             final GenericObjectPool cloudConnectionPool = new GenericObjectPool(null, cloudMaxActive, GenericObjectPool.DEFAULT_WHEN_EXHAUSTED_ACTION,
                     cloudMaxWait, cloudMaxIdle, cloudTestOnBorrow, false, cloudTimeBtwEvictionRunsMillis, 1, cloudMinEvcitableIdleTimeMillis, cloudTestWhileIdle);
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/81f1a0b8/server/src/org/apache/cloudstack/region/RegionManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/org/apache/cloudstack/region/RegionManagerImpl.java b/server/src/org/apache/cloudstack/region/RegionManagerImpl.java
index 9bcf4be..046779f 100755
--- a/server/src/org/apache/cloudstack/region/RegionManagerImpl.java
+++ b/server/src/org/apache/cloudstack/region/RegionManagerImpl.java
@@ -26,22 +26,30 @@ import com.cloud.user.DomainManager;
 import com.cloud.user.UserAccount;
 import com.cloud.user.dao.AccountDao;
 import com.cloud.user.dao.UserAccountDao;
+import com.cloud.utils.PropertiesUtil;
 import com.cloud.utils.component.Manager;
 import com.cloud.utils.component.ManagerBase;
+import com.cloud.utils.crypt.EncryptionSecretKeyChecker;
 import org.apache.cloudstack.api.command.admin.account.UpdateAccountCmd;
 import org.apache.cloudstack.api.command.admin.domain.UpdateDomainCmd;
 import org.apache.cloudstack.api.command.admin.user.DeleteUserCmd;
 import org.apache.cloudstack.api.command.admin.user.UpdateUserCmd;
 import org.apache.cloudstack.region.dao.RegionDao;
 import org.apache.log4j.Logger;
+import org.jasypt.encryption.pbe.StandardPBEStringEncryptor;
+import org.jasypt.properties.EncryptableProperties;
 import org.springframework.stereotype.Component;
 
 import javax.ejb.Local;
 import javax.inject.Inject;
 import javax.naming.ConfigurationException;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Map;
+import java.util.Properties;
 
 @Component
 @Local(value = { RegionManager.class })
@@ -63,7 +71,28 @@ public class RegionManagerImpl extends ManagerBase implements RegionManager, Man
     @Override
     public boolean configure(final String name, final Map<String, Object> params) throws ConfigurationException {
         _name = name;
-        _id = _regionDao.getRegionId();
+        File dbPropsFile = PropertiesUtil.findConfigFile("db.properties");
+        final Properties dbProps;
+        if (EncryptionSecretKeyChecker.useEncryption()) {
+            StandardPBEStringEncryptor encryptor = EncryptionSecretKeyChecker.getEncryptor();
+            dbProps = new EncryptableProperties(encryptor);
+        } else {
+            dbProps = new Properties();
+        }
+        try {
+            dbProps.load(new FileInputStream(dbPropsFile));
+        } catch (IOException e) {
+            s_logger.fatal("Unable to load db properties file, pl. check the classpath and file path configuration", e);
+            return false;
+        } catch (NullPointerException e) {
+            s_logger.fatal("Unable to locate db properties file within classpath or absolute path: db.properties");
+            return false;
+        }
+        String regionId = dbProps.getProperty("region.id");
+        _id = 1;
+        if(regionId != null){
+            _id = Integer.parseInt(regionId);
+        }
         return true;
     }
 


[7/8] git commit: updated refs/heads/ui-restyle to 116e06e

Posted by bf...@apache.org.
Dashboard: Fix wrapping in IE9


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/81d078fb
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/81d078fb
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/81d078fb

Branch: refs/heads/ui-restyle
Commit: 81d078fb7910276f53dbf4facee0639e8f84d2ff
Parents: 81f1a0b
Author: Brian Federle <br...@citrix.com>
Authored: Wed Oct 16 14:44:43 2013 -0700
Committer: Brian Federle <br...@citrix.com>
Committed: Wed Oct 16 14:44:43 2013 -0700

----------------------------------------------------------------------
 ui/css/cloudstack3.css | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/81d078fb/ui/css/cloudstack3.css
----------------------------------------------------------------------
diff --git a/ui/css/cloudstack3.css b/ui/css/cloudstack3.css
index d124d1e..b5222cb 100644
--- a/ui/css/cloudstack3.css
+++ b/ui/css/cloudstack3.css
@@ -4446,7 +4446,7 @@ Dialogs*/
 /**** Alerts*/
 .dashboard.admin .dashboard-container.sub.alerts {
   float: left;
-  margin: 0 17px 0 0;
+  margin: 0 12px 0 0;
   height: 313px;
   overflow: hidden;
   position: relative;


[5/8] git commit: updated refs/heads/ui-restyle to 116e06e

Posted by bf...@apache.org.
CLOUDSTACK-4717: associate IP does not work on shared networks with out
source nat service

relax the restriction that the source nat service should be avaiable in
the network inorder to associate a public ip to the network


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/df3b0994
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/df3b0994
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/df3b0994

Branch: refs/heads/ui-restyle
Commit: df3b09944968718111d9b6b29d4c7f5a5cfaf630
Parents: 0844066
Author: Murali Reddy <mu...@gmail.com>
Authored: Wed Oct 16 18:46:37 2013 +0530
Committer: Murali Reddy <mu...@gmail.com>
Committed: Wed Oct 16 18:46:37 2013 +0530

----------------------------------------------------------------------
 .../com/cloud/network/IpAddressManagerImpl.java | 23 +++++++++++++++-----
 1 file changed, 17 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/df3b0994/server/src/com/cloud/network/IpAddressManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/IpAddressManagerImpl.java b/server/src/com/cloud/network/IpAddressManagerImpl.java
index 9cc5e5d..74f316b 100644
--- a/server/src/com/cloud/network/IpAddressManagerImpl.java
+++ b/server/src/com/cloud/network/IpAddressManagerImpl.java
@@ -1198,12 +1198,23 @@ public class IpAddressManagerImpl extends ManagerBase implements IpAddressManage
             }
         }
 
-        // In Advance zone only allow to do IP assoc
-        //      - for Isolated networks with source nat service enabled
-        //      - for shared networks with source nat service enabled
-        if (zone.getNetworkType() == NetworkType.Advanced && !(_networkModel.areServicesSupportedInNetwork(network.getId(), Service.SourceNat))) {
-            throw new InvalidParameterValueException("In zone of type " + NetworkType.Advanced + " ip address can be associated only to the network of guest type " +
-                                                     GuestType.Isolated + " with the " + Service.SourceNat.getName() + " enabled");
+        if (zone.getNetworkType() == NetworkType.Advanced) {
+            // In Advance zone allow to do IP assoc only for Isolated networks with source nat service enabled
+            if (network.getGuestType() == GuestType.Isolated &&
+                    !(_networkModel.areServicesSupportedInNetwork(network.getId(), Service.SourceNat))) {
+                throw new InvalidParameterValueException("In zone of type " + NetworkType.Advanced +
+                        " ip address can be associated only to the network of guest type " + GuestType.Isolated +
+                        " with the " + Service.SourceNat.getName() + " enabled");
+            }
+
+            // In Advance zone allow to do IP assoc only for shared networks with source nat/static nat/lb/pf services enabled
+            if (network.getGuestType() == GuestType.Shared &&
+                    !isSharedNetworkOfferingWithServices(network.getNetworkOfferingId())) {
+                throw new InvalidParameterValueException("In zone of type " + NetworkType.Advanced +
+                        " ip address can be associated with network of guest type " + GuestType.Shared + "only if at " +
+                        "least one of the services "  + Service.SourceNat.getName() + "/" + Service.StaticNat.getName() + "/" +
+                        Service.Lb.getName() + "/" + Service.PortForwarding.getName() + " is enabled");
+            }
         }
 
         NetworkOffering offering = _networkOfferingDao.findById(network.getNetworkOfferingId());