cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From t..@apache.org
Subject [31/41] git commit: updated refs/heads/marvin_refactor to 94b18c6
Date Thu, 18 Apr 2013 02:26:19 GMT
CLOUDSTACK-1941: added isDefault parameter to account/user response


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

Branch: refs/heads/marvin_refactor
Commit: 11480c3af8b7d55625e791f955d7d077ea7f488e
Parents: 8d0bea9
Author: Alena Prokharchyk <alena.prokharchyk@citrix.com>
Authored: Wed Apr 17 12:29:09 2013 -0700
Committer: Alena Prokharchyk <alena.prokharchyk@citrix.com>
Committed: Wed Apr 17 13:45:25 2013 -0700

----------------------------------------------------------------------
 .../cloudstack/api/response/AccountResponse.java   |    7 +
 .../cloudstack/api/response/UserResponse.java      |    8 +
 .../src/com/cloud/api/query/QueryManagerImpl.java  |   11 +-
 .../cloud/api/query/dao/AccountJoinDaoImpl.java    |    8 +-
 .../api/query/dao/UserAccountJoinDaoImpl.java      |    1 +
 .../src/com/cloud/api/query/vo/AccountJoinVO.java  |   10 +
 .../com/cloud/api/query/vo/UserAccountJoinVO.java  |   16 +-
 .../com/cloud/server/ConfigurationServerImpl.java  |    5 -
 setup/db/db/schema-410to420.sql                    |  330 ++++++++-------
 9 files changed, 234 insertions(+), 162 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/11480c3a/api/src/org/apache/cloudstack/api/response/AccountResponse.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/response/AccountResponse.java b/api/src/org/apache/cloudstack/api/response/AccountResponse.java
index c109a63..1e59822 100644
--- a/api/src/org/apache/cloudstack/api/response/AccountResponse.java
+++ b/api/src/org/apache/cloudstack/api/response/AccountResponse.java
@@ -183,6 +183,9 @@ public class AccountResponse extends BaseResponse {
 
     @SerializedName(ApiConstants.ACCOUNT_DETAILS) @Param(description="details for the account")
     private Map<String, String> details;
+    
+    @SerializedName(ApiConstants.IS_DEFAULT) @Param(description="true if account is default,
false otherwise", since="4.2.0")
+    private Boolean isDefault;
 
 
     @Override
@@ -381,4 +384,8 @@ public class AccountResponse extends BaseResponse {
     public void setDefaultZone(String defaultZoneId) {
         this.defaultZoneId = defaultZoneId;
     }
+    
+    public void setIsDefault(Boolean isDefault) {
+        this.isDefault = isDefault;
+    }
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/11480c3a/api/src/org/apache/cloudstack/api/response/UserResponse.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/response/UserResponse.java b/api/src/org/apache/cloudstack/api/response/UserResponse.java
index 9cd25cb..e70a310 100644
--- a/api/src/org/apache/cloudstack/api/response/UserResponse.java
+++ b/api/src/org/apache/cloudstack/api/response/UserResponse.java
@@ -18,6 +18,7 @@ package org.apache.cloudstack.api.response;
 
 import java.util.Date;
 
+import org.apache.cloudstack.api.ApiConstants;
 import org.apache.cloudstack.api.BaseResponse;
 import org.apache.cloudstack.api.EntityReference;
 
@@ -74,6 +75,9 @@ public class UserResponse extends BaseResponse {
 
     @SerializedName("iscallerchilddomain") @Param(description="the boolean value representing
if the updating target is in caller's child domain")
     private boolean isCallerChildDomain;
+    
+    @SerializedName(ApiConstants.IS_DEFAULT) @Param(description="true if user is default,
false otherwise", since="4.2.0")
+    private Boolean isDefault;
 
     @Override
     public String getObjectId() {
@@ -206,4 +210,8 @@ public class UserResponse extends BaseResponse {
     public void setIsCallerChildDomain(boolean isCallerChildDomain) {
         this.isCallerChildDomain = isCallerChildDomain;
     }
+    
+    public void setIsDefault(Boolean isDefault) {
+        this.isDefault = isDefault;
+    }
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/11480c3a/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 5ffc2db..3114ea5 100644
--- a/server/src/com/cloud/api/query/QueryManagerImpl.java
+++ b/server/src/com/cloud/api/query/QueryManagerImpl.java
@@ -25,12 +25,9 @@ import java.util.Set;
 
 import javax.ejb.Local;
 import javax.inject.Inject;
-import javax.naming.ConfigurationException;
 
-import org.apache.cloudstack.affinity.AffinityGroup;
 import org.apache.cloudstack.affinity.AffinityGroupResponse;
 import org.apache.cloudstack.affinity.AffinityGroupVMMapVO;
-import org.apache.cloudstack.affinity.AffinityGroupVO;
 import org.apache.cloudstack.affinity.dao.AffinityGroupVMMapDao;
 import org.apache.cloudstack.api.command.admin.host.ListHostsCmd;
 import org.apache.cloudstack.api.command.admin.router.ListRoutersCmd;
@@ -111,7 +108,6 @@ import com.cloud.api.query.vo.UserAccountJoinVO;
 import com.cloud.api.query.vo.UserVmJoinVO;
 import com.cloud.api.query.vo.VolumeJoinVO;
 import com.cloud.configuration.dao.ConfigurationDao;
-import com.cloud.dc.DataCenterVO;
 import com.cloud.domain.Domain;
 import com.cloud.domain.DomainVO;
 import com.cloud.domain.dao.DomainDao;
@@ -124,9 +120,9 @@ import com.cloud.hypervisor.Hypervisor.HypervisorType;
 import com.cloud.network.security.SecurityGroupVMMapVO;
 import com.cloud.network.security.dao.SecurityGroupVMMapDao;
 import com.cloud.org.Grouping;
-import com.cloud.projects.ProjectInvitation;
-import com.cloud.projects.Project.ListProjectResourcesCriteria;
 import com.cloud.projects.Project;
+import com.cloud.projects.Project.ListProjectResourcesCriteria;
+import com.cloud.projects.ProjectInvitation;
 import com.cloud.projects.ProjectManager;
 import com.cloud.projects.dao.ProjectAccountDao;
 import com.cloud.projects.dao.ProjectDao;
@@ -142,10 +138,8 @@ import com.cloud.user.dao.AccountDao;
 import com.cloud.utils.DateUtil;
 import com.cloud.utils.Pair;
 import com.cloud.utils.Ternary;
-import com.cloud.utils.component.Manager;
 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;
@@ -1699,6 +1693,7 @@ public class QueryManagerImpl extends ManagerBase implements QueryService
{
         sb.and("typeNEQ", sb.entity().getType(), SearchCriteria.Op.NEQ);
         sb.and("idNEQ", sb.entity().getId(), SearchCriteria.Op.NEQ);
 
+
         if (listForDomain && isRecursive) {
             sb.and("path", sb.entity().getDomainPath(), SearchCriteria.Op.LIKE);
         }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/11480c3a/server/src/com/cloud/api/query/dao/AccountJoinDaoImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/api/query/dao/AccountJoinDaoImpl.java b/server/src/com/cloud/api/query/dao/AccountJoinDaoImpl.java
index 51ac5e6..796ae54 100644
--- a/server/src/com/cloud/api/query/dao/AccountJoinDaoImpl.java
+++ b/server/src/com/cloud/api/query/dao/AccountJoinDaoImpl.java
@@ -20,17 +20,16 @@ import java.util.List;
 
 import javax.ejb.Local;
 
+import org.apache.cloudstack.api.response.AccountResponse;
+import org.apache.cloudstack.api.response.UserResponse;
 import org.apache.log4j.Logger;
+import org.springframework.stereotype.Component;
 
 import com.cloud.api.ApiDBUtils;
 import com.cloud.api.query.ViewResponseHelper;
 import com.cloud.api.query.vo.AccountJoinVO;
 import com.cloud.api.query.vo.UserAccountJoinVO;
 import com.cloud.configuration.Resource.ResourceType;
-import org.apache.cloudstack.api.response.AccountResponse;
-import org.apache.cloudstack.api.response.UserResponse;
-import org.springframework.stereotype.Component;
-
 import com.cloud.user.Account;
 import com.cloud.utils.db.GenericDaoBase;
 import com.cloud.utils.db.SearchBuilder;
@@ -66,6 +65,7 @@ public class AccountJoinDaoImpl extends GenericDaoBase<AccountJoinVO,
Long> impl
         accountResponse.setState(account.getState().toString());
         accountResponse.setNetworkDomain(account.getNetworkDomain());
         accountResponse.setDefaultZone(account.getDataCenterUuid());
+        accountResponse.setIsDefault(account.isDefault());
 
         // get network stat
         accountResponse.setBytesReceived(account.getBytesReceived());

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/11480c3a/server/src/com/cloud/api/query/dao/UserAccountJoinDaoImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/api/query/dao/UserAccountJoinDaoImpl.java b/server/src/com/cloud/api/query/dao/UserAccountJoinDaoImpl.java
index 7072324..43b3a2d 100644
--- a/server/src/com/cloud/api/query/dao/UserAccountJoinDaoImpl.java
+++ b/server/src/com/cloud/api/query/dao/UserAccountJoinDaoImpl.java
@@ -80,6 +80,7 @@ public class UserAccountJoinDaoImpl extends GenericDaoBase<UserAccountJoinVO,
Lo
         userResponse.setUsername(usr.getUsername());
         userResponse.setApiKey(usr.getApiKey());
         userResponse.setSecretKey(usr.getSecretKey());
+        userResponse.setIsDefault(usr.isDefault());
 
         // set async job
         userResponse.setJobId(usr.getJobUuid());

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/11480c3a/server/src/com/cloud/api/query/vo/AccountJoinVO.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/api/query/vo/AccountJoinVO.java b/server/src/com/cloud/api/query/vo/AccountJoinVO.java
index 1cb17ef..800da78 100644
--- a/server/src/com/cloud/api/query/vo/AccountJoinVO.java
+++ b/server/src/com/cloud/api/query/vo/AccountJoinVO.java
@@ -184,6 +184,9 @@ public class AccountJoinVO extends BaseViewVO implements InternalIdentity,
Ident
 
     @Column(name="job_status")
     private int jobStatus;
+    
+    @Column(name = "default")
+    boolean isDefault;
 
     public AccountJoinVO() {
     }
@@ -672,6 +675,13 @@ public class AccountJoinVO extends BaseViewVO implements InternalIdentity,
Ident
     }
 
 
+    public boolean isDefault() {
+        return isDefault;
+    }
 
 
+    public void setDefault(boolean isDefault) {
+        this.isDefault = isDefault;
+    }
+ 
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/11480c3a/server/src/com/cloud/api/query/vo/UserAccountJoinVO.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/api/query/vo/UserAccountJoinVO.java b/server/src/com/cloud/api/query/vo/UserAccountJoinVO.java
index 44637db..d85392f 100644
--- a/server/src/com/cloud/api/query/vo/UserAccountJoinVO.java
+++ b/server/src/com/cloud/api/query/vo/UserAccountJoinVO.java
@@ -23,12 +23,12 @@ import javax.persistence.Entity;
 import javax.persistence.Id;
 import javax.persistence.Table;
 
-import com.cloud.utils.db.Encrypt;
-import com.cloud.utils.db.GenericDao;
-
 import org.apache.cloudstack.api.Identity;
 import org.apache.cloudstack.api.InternalIdentity;
 
+import com.cloud.utils.db.Encrypt;
+import com.cloud.utils.db.GenericDao;
+
 @Entity
 @Table(name="user_view")
 public class UserAccountJoinVO extends BaseViewVO implements InternalIdentity, Identity {
@@ -116,6 +116,9 @@ public class UserAccountJoinVO extends BaseViewVO implements InternalIdentity,
I
 
     @Column(name="job_status")
     private int jobStatus;
+    
+    @Column(name = "default")
+    boolean isDefault;
 
     public UserAccountJoinVO() {
     }
@@ -345,6 +348,13 @@ public class UserAccountJoinVO extends BaseViewVO implements InternalIdentity,
I
         this.jobStatus = jobStatus;
     }
 
+    public boolean isDefault() {
+        return isDefault;
+    }
 
+    public void setDefault(boolean isDefault) {
+        this.isDefault = isDefault;
+    }
 
+    
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/11480c3a/server/src/com/cloud/server/ConfigurationServerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/server/ConfigurationServerImpl.java b/server/src/com/cloud/server/ConfigurationServerImpl.java
index 06b7871..c4da1ab 100755
--- a/server/src/com/cloud/server/ConfigurationServerImpl.java
+++ b/server/src/com/cloud/server/ConfigurationServerImpl.java
@@ -339,8 +339,6 @@ public class ConfigurationServerImpl extends ManagerBase implements Configuratio
             PreparedStatement stmt = txn.prepareAutoCloseStatement(insertSql);
             stmt.executeUpdate();
         } catch (SQLException ex) {
-            s_logger.warn("Failed to system account due to ", ex);
-
         }
         // insert system user
         insertSql = "INSERT INTO `cloud`.`user` (id, uuid, username, password, account_id,
firstname, lastname, created, user.default)" +
@@ -350,7 +348,6 @@ public class ConfigurationServerImpl extends ManagerBase implements Configuratio
             PreparedStatement stmt = txn.prepareAutoCloseStatement(insertSql);
             stmt.executeUpdate();
         } catch (SQLException ex) {
-            s_logger.warn("Failed to create system user due to ", ex);
         }
 
         // insert admin user, but leave the account disabled until we set a
@@ -367,7 +364,6 @@ public class ConfigurationServerImpl extends ManagerBase implements Configuratio
             PreparedStatement stmt = txn.prepareAutoCloseStatement(insertSql);
             stmt.executeUpdate();
         } catch (SQLException ex) {
-            s_logger.warn("Failed to create admin account due to ", ex);
         }
 
         // now insert the user
@@ -379,7 +375,6 @@ public class ConfigurationServerImpl extends ManagerBase implements Configuratio
             PreparedStatement stmt = txn.prepareAutoCloseStatement(insertSql);
             stmt.executeUpdate();
         } catch (SQLException ex) {
-            s_logger.warn("Failed to create admin user due to ", ex);
         }
 
         try {

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/11480c3a/setup/db/db/schema-410to420.sql
----------------------------------------------------------------------
diff --git a/setup/db/db/schema-410to420.sql b/setup/db/db/schema-410to420.sql
index bd145cb..a36be0e 100644
--- a/setup/db/db/schema-410to420.sql
+++ b/setup/db/db/schema-410to420.sql
@@ -279,148 +279,7 @@ INSERT IGNORE INTO `cloud`.`configuration` VALUES ('Project Defaults',
'DEFAULT'
 INSERT IGNORE INTO `cloud`.`configuration` VALUES ('Project Defaults', 'DEFAULT', 'management-server',
'max.project.primary.storage', '200', 'The default maximum primary storage space (in GiB)
that can be used for a project');
 INSERT IGNORE INTO `cloud`.`configuration` VALUES ('Project Defaults', 'DEFAULT', 'management-server',
'max.project.secondary.storage', '400', 'The default maximum secondary storage space (in GiB)
that can be used for a project');
 
-DROP VIEW IF EXISTS `cloud`.`account_view`;
-CREATE VIEW `cloud`.`account_view` AS
-    select
-        account.id,
-        account.uuid,
-        account.account_name,
-        account.type,
-        account.state,
-        account.removed,
-        account.cleanup_needed,
-        account.network_domain,
-        domain.id domain_id,
-        domain.uuid domain_uuid,
-        domain.name domain_name,
-        domain.path domain_path,
-        data_center.id data_center_id,
-        data_center.uuid data_center_uuid,
-        data_center.name data_center_name,
-        account_netstats_view.bytesReceived,
-        account_netstats_view.bytesSent,
-        vmlimit.max vmLimit,
-        vmcount.count vmTotal,
-        runningvm.vmcount runningVms,
-        stoppedvm.vmcount stoppedVms,
-        iplimit.max ipLimit,
-        ipcount.count ipTotal,
-        free_ip_view.free_ip ipFree,
-        volumelimit.max volumeLimit,
-        volumecount.count volumeTotal,
-        snapshotlimit.max snapshotLimit,
-        snapshotcount.count snapshotTotal,
-        templatelimit.max templateLimit,
-        templatecount.count templateTotal,
-        vpclimit.max vpcLimit,
-        vpccount.count vpcTotal,
-        projectlimit.max projectLimit,
-        projectcount.count projectTotal,
-        networklimit.max networkLimit,
-        networkcount.count networkTotal,
-        cpulimit.max cpuLimit,
-        cpucount.count cpuTotal,
-        memorylimit.max memoryLimit,
-        memorycount.count memoryTotal,
-        primary_storage_limit.max primaryStorageLimit,
-        primary_storage_count.count primaryStorageTotal,
-        secondary_storage_limit.max secondaryStorageLimit,
-        secondary_storage_count.count secondaryStorageTotal,
-        async_job.id job_id,
-        async_job.uuid job_uuid,
-        async_job.job_status job_status,
-        async_job.account_id job_account_id
-    from
-        `cloud`.`free_ip_view`,
-        `cloud`.`account`
-            inner join
-        `cloud`.`domain` ON account.domain_id = domain.id
-            left join
-        `cloud`.`data_center` ON account.default_zone_id = data_center.id
-            left join
-        `cloud`.`account_netstats_view` ON account.id = account_netstats_view.account_id
-            left join
-        `cloud`.`resource_limit` vmlimit ON account.id = vmlimit.account_id
-            and vmlimit.type = 'user_vm'
-            left join
-        `cloud`.`resource_count` vmcount ON account.id = vmcount.account_id
-            and vmcount.type = 'user_vm'
-            left join
-        `cloud`.`account_vmstats_view` runningvm ON account.id = runningvm.account_id
-            and runningvm.state = 'Running'
-            left join
-        `cloud`.`account_vmstats_view` stoppedvm ON account.id = stoppedvm.account_id
-           and stoppedvm.state = 'Stopped'
-            left join
-        `cloud`.`resource_limit` iplimit ON account.id = iplimit.account_id
-            and iplimit.type = 'public_ip'
-            left join
-        `cloud`.`resource_count` ipcount ON account.id = ipcount.account_id
-            and ipcount.type = 'public_ip'
-            left join
-        `cloud`.`resource_limit` volumelimit ON account.id = volumelimit.account_id
-            and volumelimit.type = 'volume'
-            left join
-        `cloud`.`resource_count` volumecount ON account.id = volumecount.account_id
-            and volumecount.type = 'volume'
-            left join
-        `cloud`.`resource_limit` snapshotlimit ON account.id = snapshotlimit.account_id
-            and snapshotlimit.type = 'snapshot'
-            left join
-        `cloud`.`resource_count` snapshotcount ON account.id = snapshotcount.account_id
-            and snapshotcount.type = 'snapshot'
-            left join
-        `cloud`.`resource_limit` templatelimit ON account.id = templatelimit.account_id
-            and templatelimit.type = 'template'
-            left join
-        `cloud`.`resource_count` templatecount ON account.id = templatecount.account_id
-            and templatecount.type = 'template'
-            left join
-        `cloud`.`resource_limit` vpclimit ON account.id = vpclimit.account_id
-            and vpclimit.type = 'vpc'
-            left join
-        `cloud`.`resource_count` vpccount ON account.id = vpccount.account_id
-            and vpccount.type = 'vpc'
-            left join
-        `cloud`.`resource_limit` projectlimit ON account.id = projectlimit.account_id
-            and projectlimit.type = 'project'
-            left join
-        `cloud`.`resource_count` projectcount ON account.id = projectcount.account_id
-            and projectcount.type = 'project'
-            left join
-        `cloud`.`resource_limit` networklimit ON account.id = networklimit.account_id
-            and networklimit.type = 'network'
-            left join
-        `cloud`.`resource_count` networkcount ON account.id = networkcount.account_id
-            and networkcount.type = 'network'
-            left join
-        `cloud`.`resource_limit` cpulimit ON account.id = cpulimit.account_id
-            and cpulimit.type = 'cpu'
-            left join
-        `cloud`.`resource_count` cpucount ON account.id = cpucount.account_id
-            and cpucount.type = 'cpu'
-            left join
-        `cloud`.`resource_limit` memorylimit ON account.id = memorylimit.account_id
-            and memorylimit.type = 'memory'
-            left join
-        `cloud`.`resource_count` memorycount ON account.id = memorycount.account_id
-            and memorycount.type = 'memory'
-            left join
-        `cloud`.`resource_limit` primary_storage_limit ON account.id = primary_storage_limit.account_id
-            and primary_storage_limit.type = 'primary_storage'
-            left join
-        `cloud`.`resource_count` primary_storage_count ON account.id = primary_storage_count.account_id
-            and primary_storage_count.type = 'primary_storage'
-            left join
-        `cloud`.`resource_limit` secondary_storage_limit ON account.id = secondary_storage_limit.account_id
-            and secondary_storage_limit.type = 'secondary_storage'
-            left join
-        `cloud`.`resource_count` secondary_storage_count ON account.id = secondary_storage_count.account_id
-            and secondary_storage_count.type = 'secondary_storage'
-            left join
-        `cloud`.`async_job` ON async_job.instance_id = account.id
-            and async_job.instance_type = 'Account'
-            and async_job.job_status = 0;
+
 
 ALTER TABLE `cloud`.`remote_access_vpn` ADD COLUMN `id` bigint unsigned NOT NULL UNIQUE AUTO_INCREMENT
COMMENT 'id';
 ALTER TABLE `cloud`.`remote_access_vpn` ADD COLUMN `uuid` varchar(40) UNIQUE;
@@ -726,3 +585,190 @@ ALTER TABLE `cloud`.`account` ADD COLUMN `default` int(1) unsigned NOT
NULL DEFA
 ALTER TABLE `cloud`.`user` ADD COLUMN `default` int(1) unsigned NOT NULL DEFAULT '0' COMMENT
'1 if user is default';
 UPDATE `cloud`.`account` SET `cloud`.`account`.`default`=1 WHERE id IN (1,2);
 UPDATE `cloud`.`user` SET `cloud`.`user`.`default`=1 WHERE id IN (1,2);
+
+ALTER VIEW `cloud`.`user_view` AS
+    select 
+        user.id,
+        user.uuid,
+        user.username,
+        user.password,
+        user.firstname,
+        user.lastname,
+        user.email,
+        user.state,
+        user.api_key,
+        user.secret_key,
+        user.created,
+        user.removed,
+        user.timezone,
+        user.registration_token,
+        user.is_registered,
+        user.incorrect_login_attempts,
+        user.default,
+        account.id account_id,
+        account.uuid account_uuid,
+        account.account_name account_name,
+        account.type account_type,
+        domain.id domain_id,
+        domain.uuid domain_uuid,
+        domain.name domain_name,
+        domain.path domain_path,
+        async_job.id job_id,
+        async_job.uuid job_uuid,
+        async_job.job_status job_status,
+        async_job.account_id job_account_id
+    from
+        `cloud`.`user`
+            inner join
+        `cloud`.`account` ON user.account_id = account.id
+            inner join
+        `cloud`.`domain` ON account.domain_id = domain.id
+            left join
+        `cloud`.`async_job` ON async_job.instance_id = user.id
+            and async_job.instance_type = 'User'
+            and async_job.job_status = 0;
+       
+
+DROP VIEW IF EXISTS `cloud`.`account_view`;
+CREATE VIEW `cloud`.`account_view` AS
+    select
+        account.id,
+        account.uuid,
+        account.account_name,
+        account.type,
+        account.state,
+        account.removed,
+        account.cleanup_needed,
+        account.network_domain,
+        account.default,
+        domain.id domain_id,
+        domain.uuid domain_uuid,
+        domain.name domain_name,
+        domain.path domain_path,
+        data_center.id data_center_id,
+        data_center.uuid data_center_uuid,
+        data_center.name data_center_name,
+        account_netstats_view.bytesReceived,
+        account_netstats_view.bytesSent,
+        vmlimit.max vmLimit,
+        vmcount.count vmTotal,
+        runningvm.vmcount runningVms,
+        stoppedvm.vmcount stoppedVms,
+        iplimit.max ipLimit,
+        ipcount.count ipTotal,
+        free_ip_view.free_ip ipFree,
+        volumelimit.max volumeLimit,
+        volumecount.count volumeTotal,
+        snapshotlimit.max snapshotLimit,
+        snapshotcount.count snapshotTotal,
+        templatelimit.max templateLimit,
+        templatecount.count templateTotal,
+        vpclimit.max vpcLimit,
+        vpccount.count vpcTotal,
+        projectlimit.max projectLimit,
+        projectcount.count projectTotal,
+        networklimit.max networkLimit,
+        networkcount.count networkTotal,
+        cpulimit.max cpuLimit,
+        cpucount.count cpuTotal,
+        memorylimit.max memoryLimit,
+        memorycount.count memoryTotal,
+        primary_storage_limit.max primaryStorageLimit,
+        primary_storage_count.count primaryStorageTotal,
+        secondary_storage_limit.max secondaryStorageLimit,
+        secondary_storage_count.count secondaryStorageTotal,
+        async_job.id job_id,
+        async_job.uuid job_uuid,
+        async_job.job_status job_status,
+        async_job.account_id job_account_id
+    from
+        `cloud`.`free_ip_view`,
+        `cloud`.`account`
+            inner join
+        `cloud`.`domain` ON account.domain_id = domain.id
+            left join
+        `cloud`.`data_center` ON account.default_zone_id = data_center.id
+            left join
+        `cloud`.`account_netstats_view` ON account.id = account_netstats_view.account_id
+            left join
+        `cloud`.`resource_limit` vmlimit ON account.id = vmlimit.account_id
+            and vmlimit.type = 'user_vm'
+            left join
+        `cloud`.`resource_count` vmcount ON account.id = vmcount.account_id
+            and vmcount.type = 'user_vm'
+            left join
+        `cloud`.`account_vmstats_view` runningvm ON account.id = runningvm.account_id
+            and runningvm.state = 'Running'
+            left join
+        `cloud`.`account_vmstats_view` stoppedvm ON account.id = stoppedvm.account_id
+           and stoppedvm.state = 'Stopped'
+            left join
+        `cloud`.`resource_limit` iplimit ON account.id = iplimit.account_id
+            and iplimit.type = 'public_ip'
+            left join
+        `cloud`.`resource_count` ipcount ON account.id = ipcount.account_id
+            and ipcount.type = 'public_ip'
+            left join
+        `cloud`.`resource_limit` volumelimit ON account.id = volumelimit.account_id
+            and volumelimit.type = 'volume'
+            left join
+        `cloud`.`resource_count` volumecount ON account.id = volumecount.account_id
+            and volumecount.type = 'volume'
+            left join
+        `cloud`.`resource_limit` snapshotlimit ON account.id = snapshotlimit.account_id
+            and snapshotlimit.type = 'snapshot'
+            left join
+        `cloud`.`resource_count` snapshotcount ON account.id = snapshotcount.account_id
+            and snapshotcount.type = 'snapshot'
+            left join
+        `cloud`.`resource_limit` templatelimit ON account.id = templatelimit.account_id
+            and templatelimit.type = 'template'
+            left join
+        `cloud`.`resource_count` templatecount ON account.id = templatecount.account_id
+            and templatecount.type = 'template'
+            left join
+        `cloud`.`resource_limit` vpclimit ON account.id = vpclimit.account_id
+            and vpclimit.type = 'vpc'
+            left join
+        `cloud`.`resource_count` vpccount ON account.id = vpccount.account_id
+            and vpccount.type = 'vpc'
+            left join
+        `cloud`.`resource_limit` projectlimit ON account.id = projectlimit.account_id
+            and projectlimit.type = 'project'
+            left join
+        `cloud`.`resource_count` projectcount ON account.id = projectcount.account_id
+            and projectcount.type = 'project'
+            left join
+        `cloud`.`resource_limit` networklimit ON account.id = networklimit.account_id
+            and networklimit.type = 'network'
+            left join
+        `cloud`.`resource_count` networkcount ON account.id = networkcount.account_id
+            and networkcount.type = 'network'
+            left join
+        `cloud`.`resource_limit` cpulimit ON account.id = cpulimit.account_id
+            and cpulimit.type = 'cpu'
+            left join
+        `cloud`.`resource_count` cpucount ON account.id = cpucount.account_id
+            and cpucount.type = 'cpu'
+            left join
+        `cloud`.`resource_limit` memorylimit ON account.id = memorylimit.account_id
+            and memorylimit.type = 'memory'
+            left join
+        `cloud`.`resource_count` memorycount ON account.id = memorycount.account_id
+            and memorycount.type = 'memory'
+            left join
+        `cloud`.`resource_limit` primary_storage_limit ON account.id = primary_storage_limit.account_id
+            and primary_storage_limit.type = 'primary_storage'
+            left join
+        `cloud`.`resource_count` primary_storage_count ON account.id = primary_storage_count.account_id
+            and primary_storage_count.type = 'primary_storage'
+            left join
+        `cloud`.`resource_limit` secondary_storage_limit ON account.id = secondary_storage_limit.account_id
+            and secondary_storage_limit.type = 'secondary_storage'
+            left join
+        `cloud`.`resource_count` secondary_storage_count ON account.id = secondary_storage_count.account_id
+            and secondary_storage_count.type = 'secondary_storage'
+            left join
+        `cloud`.`async_job` ON async_job.instance_id = account.id
+            and async_job.instance_type = 'Account'
+            and async_job.job_status = 0;
\ No newline at end of file


Mime
View raw message