Skip to content

Commit b3ebbcf

Browse files
committed
Merge remote-tracking branch 'origin/master' into allow-ui-template-sharing
2 parents 7b98317 + e4ddee6 commit b3ebbcf

File tree

40 files changed

+510
-182
lines changed

40 files changed

+510
-182
lines changed

.travis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@
1515
# specific language governing permissions and limitations
1616
# under the License.
1717
sudo: required
18-
dist: trusty
18+
dist: xenial
1919
group: edge
2020

2121
language: java
2222
jdk:
23-
- oraclejdk8
23+
- openjdk8
2424
python:
2525
- "2.7"
2626

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ public class ApiConstants {
5050
public static final String CERTIFICATE_CHAIN = "certchain";
5151
public static final String CERTIFICATE_FINGERPRINT = "fingerprint";
5252
public static final String CERTIFICATE_ID = "certid";
53+
public static final String COPY_IMAGE_TAGS = "copyimagetags";
5354
public static final String CSR = "csr";
5455
public static final String PRIVATE_KEY = "privatekey";
5556
public static final String DOMAIN_SUFFIX = "domainsuffix";

api/src/main/java/org/apache/cloudstack/api/command/user/account/ListAccountsCmd.java

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,22 @@
1616
// under the License.
1717
package org.apache.cloudstack.api.command.user.account;
1818

19+
import java.util.ArrayList;
20+
import java.util.EnumSet;
21+
import java.util.List;
22+
1923
import org.apache.log4j.Logger;
2024

2125
import org.apache.cloudstack.api.APICommand;
2226
import org.apache.cloudstack.api.ApiConstants;
27+
import org.apache.cloudstack.api.ApiConstants.DomainDetails;
2328
import org.apache.cloudstack.api.BaseListDomainResourcesCmd;
2429
import org.apache.cloudstack.api.Parameter;
2530
import org.apache.cloudstack.api.ResponseObject.ResponseView;
2631
import org.apache.cloudstack.api.response.AccountResponse;
2732
import org.apache.cloudstack.api.response.ListResponse;
2833

34+
import com.cloud.exception.InvalidParameterValueException;
2935
import com.cloud.user.Account;
3036

3137
@APICommand(name = "listAccounts", description = "Lists accounts and provides detailed account information for listed accounts", responseObject = AccountResponse.class, responseView = ResponseView.Restricted, entityType = {Account.class},
@@ -55,6 +61,12 @@ public class ListAccountsCmd extends BaseListDomainResourcesCmd {
5561
@Parameter(name = ApiConstants.STATE, type = CommandType.STRING, description = "list accounts by state. Valid states are enabled, disabled, and locked.")
5662
private String state;
5763

64+
@Parameter(name = ApiConstants.DETAILS,
65+
type = CommandType.LIST,
66+
collectionType = CommandType.STRING,
67+
description = "comma separated list of account details requested, value can be a list of [ all, resource, min]")
68+
private List<String> viewDetails;
69+
5870
/////////////////////////////////////////////////////
5971
/////////////////// Accessors ///////////////////////
6072
/////////////////////////////////////////////////////
@@ -79,6 +91,25 @@ public String getState() {
7991
return state;
8092
}
8193

94+
public EnumSet<DomainDetails> getDetails() throws InvalidParameterValueException {
95+
EnumSet<DomainDetails> dv;
96+
if (viewDetails == null || viewDetails.size() <= 0) {
97+
dv = EnumSet.of(DomainDetails.all);
98+
} else {
99+
try {
100+
ArrayList<DomainDetails> dc = new ArrayList<DomainDetails>();
101+
for (String detail : viewDetails) {
102+
dc.add(DomainDetails.valueOf(detail));
103+
}
104+
dv = EnumSet.copyOf(dc);
105+
} catch (IllegalArgumentException e) {
106+
throw new InvalidParameterValueException("The details parameter contains a non permitted value. The allowed values are " +
107+
EnumSet.allOf(DomainDetails.class));
108+
}
109+
}
110+
return dv;
111+
}
112+
82113
/////////////////////////////////////////////////////
83114
/////////////// API Implementation///////////////////
84115
/////////////////////////////////////////////////////

api/src/main/java/org/apache/cloudstack/api/command/user/project/ListProjectsCmd.java

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,19 @@
1616
// under the License.
1717
package org.apache.cloudstack.api.command.user.project;
1818

19+
import java.util.ArrayList;
1920
import java.util.Collection;
21+
import java.util.EnumSet;
2022
import java.util.HashMap;
2123
import java.util.Iterator;
24+
import java.util.List;
2225
import java.util.Map;
2326

2427
import org.apache.log4j.Logger;
2528

2629
import org.apache.cloudstack.api.APICommand;
2730
import org.apache.cloudstack.api.ApiConstants;
31+
import org.apache.cloudstack.api.ApiConstants.DomainDetails;
2832
import org.apache.cloudstack.api.BaseListAccountResourcesCmd;
2933
import org.apache.cloudstack.api.Parameter;
3034
import org.apache.cloudstack.api.response.ListResponse;
@@ -61,6 +65,12 @@ public class ListProjectsCmd extends BaseListAccountResourcesCmd {
6165
@Parameter(name = ApiConstants.TAGS, type = CommandType.MAP, description = "List projects by tags (key/value pairs)")
6266
private Map tags;
6367

68+
@Parameter(name = ApiConstants.DETAILS,
69+
type = CommandType.LIST,
70+
collectionType = CommandType.STRING,
71+
description = "comma separated list of project details requested, value can be a list of [ all, resource, min]")
72+
private List<String> viewDetails;
73+
6474
/////////////////////////////////////////////////////
6575
/////////////////// Accessors ///////////////////////
6676
/////////////////////////////////////////////////////
@@ -105,6 +115,25 @@ public Map<String, String> getTags() {
105115
return tagsMap;
106116
}
107117

118+
public EnumSet<DomainDetails> getDetails() throws InvalidParameterValueException {
119+
EnumSet<DomainDetails> dv;
120+
if (viewDetails == null || viewDetails.size() <= 0) {
121+
dv = EnumSet.of(DomainDetails.all);
122+
} else {
123+
try {
124+
ArrayList<DomainDetails> dc = new ArrayList<DomainDetails>();
125+
for (String detail : viewDetails) {
126+
dc.add(DomainDetails.valueOf(detail));
127+
}
128+
dv = EnumSet.copyOf(dc);
129+
} catch (IllegalArgumentException e) {
130+
throw new InvalidParameterValueException("The details parameter contains a non permitted value. The allowed values are " +
131+
EnumSet.allOf(DomainDetails.class));
132+
}
133+
}
134+
return dv;
135+
}
136+
108137
/////////////////////////////////////////////////////
109138
/////////////// API Implementation///////////////////
110139
/////////////////////////////////////////////////////

api/src/main/java/org/apache/cloudstack/api/command/user/vm/DeployVMCmd.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,9 @@ public class DeployVMCmd extends BaseAsyncCreateCustomIdCmd implements SecurityG
203203
@Parameter(name = ApiConstants.EXTRA_CONFIG, type = CommandType.STRING, since = "4.12", description = "an optional URL encoded string that can be passed to the virtual machine upon successful deployment", length = 5120)
204204
private String extraConfig;
205205

206+
@Parameter(name = ApiConstants.COPY_IMAGE_TAGS, type = CommandType.BOOLEAN, since = "4.13", description = "if true the image tags (if any) will be copied to the VM, default value is false")
207+
private Boolean copyImageTags;
208+
206209
/////////////////////////////////////////////////////
207210
/////////////////// Accessors ///////////////////////
208211
/////////////////////////////////////////////////////
@@ -489,6 +492,10 @@ public String getExtraConfig() {
489492
return extraConfig;
490493
}
491494

495+
public boolean getCopyImageTags() {
496+
return copyImageTags == null ? false : copyImageTags;
497+
}
498+
492499
/////////////////////////////////////////////////////
493500
/////////////// API Implementation///////////////////
494501
/////////////////////////////////////////////////////

debian/control

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Description: A common package which contains files which are shared by several C
1515

1616
Package: cloudstack-management
1717
Architecture: all
18-
Depends: ${python:Depends}, openjdk-8-jre-headless | java8-runtime-headless | java8-runtime | openjdk-9-jre-headless, cloudstack-common (= ${source:Version}), sudo, python-mysql.connector, libmysql-java, augeas-tools, mysql-client, adduser, bzip2, ipmitool, lsb-release, init-system-helpers (>= 1.14~)
18+
Depends: ${python:Depends}, openjdk-8-jre-headless | java8-runtime-headless | java8-runtime | openjdk-9-jre-headless, cloudstack-common (= ${source:Version}), sudo, python-mysql.connector, libmysql-java, augeas-tools, mysql-client, adduser, bzip2, ipmitool, file, lsb-release, init-system-helpers (>= 1.14~)
1919
Conflicts: cloud-server, cloud-client, cloud-client-ui
2020
Description: CloudStack server library
2121
The CloudStack management server

engine/schema/src/main/java/com/cloud/vm/dao/VMInstanceDao.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ public interface VMInstanceDao extends GenericDao<VMInstanceVO, Long>, StateDao<
122122

123123
List<Long> listHostIdsByVmCount(long dcId, Long podId, Long clusterId, long accountId);
124124

125-
Long countRunningByAccount(long accountId);
125+
Long countRunningAndStartingByAccount(long accountId);
126126

127127
Long countByZoneAndState(long zoneId, State state);
128128

engine/schema/src/main/java/com/cloud/vm/dao/VMInstanceDaoImpl.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ public class VMInstanceDaoImpl extends GenericDaoBase<VMInstanceVO, Long> implem
8787
protected SearchBuilder<VMInstanceVO> HostNameAndZoneSearch;
8888
protected GenericSearchBuilder<VMInstanceVO, Long> FindIdsOfVirtualRoutersByAccount;
8989
protected GenericSearchBuilder<VMInstanceVO, Long> CountActiveByHost;
90-
protected GenericSearchBuilder<VMInstanceVO, Long> CountRunningByAccount;
90+
protected GenericSearchBuilder<VMInstanceVO, Long> CountRunningAndStartingByAccount;
9191
protected GenericSearchBuilder<VMInstanceVO, Long> CountByZoneAndState;
9292
protected SearchBuilder<VMInstanceVO> NetworkTypeSearch;
9393
protected GenericSearchBuilder<VMInstanceVO, String> DistinctHostNameSearch;
@@ -245,11 +245,11 @@ protected void init() {
245245
CountActiveByHost.and("state", CountActiveByHost.entity().getState(), SearchCriteria.Op.IN);
246246
CountActiveByHost.done();
247247

248-
CountRunningByAccount = createSearchBuilder(Long.class);
249-
CountRunningByAccount.select(null, Func.COUNT, null);
250-
CountRunningByAccount.and("account", CountRunningByAccount.entity().getAccountId(), SearchCriteria.Op.EQ);
251-
CountRunningByAccount.and("state", CountRunningByAccount.entity().getState(), SearchCriteria.Op.EQ);
252-
CountRunningByAccount.done();
248+
CountRunningAndStartingByAccount = createSearchBuilder(Long.class);
249+
CountRunningAndStartingByAccount.select(null, Func.COUNT, null);
250+
CountRunningAndStartingByAccount.and("account", CountRunningAndStartingByAccount.entity().getAccountId(), SearchCriteria.Op.EQ);
251+
CountRunningAndStartingByAccount.and("states", CountRunningAndStartingByAccount.entity().getState(), SearchCriteria.Op.IN);
252+
CountRunningAndStartingByAccount.done();
253253

254254
CountByZoneAndState = createSearchBuilder(Long.class);
255255
CountByZoneAndState.select(null, Func.COUNT, null);
@@ -749,10 +749,10 @@ public HashMap<String, Long> countVgpuVMs(Long dcId, Long podId, Long clusterId)
749749
}
750750

751751
@Override
752-
public Long countRunningByAccount(long accountId) {
753-
SearchCriteria<Long> sc = CountRunningByAccount.create();
752+
public Long countRunningAndStartingByAccount(long accountId) {
753+
SearchCriteria<Long> sc = CountRunningAndStartingByAccount.create();
754754
sc.setParameters("account", accountId);
755-
sc.setParameters("state", State.Running);
755+
sc.setParameters("states", new Object[] {State.Starting, State.Running});
756756
return customSearch(sc, null).get(0);
757757
}
758758

engine/schema/src/main/resources/META-INF/db/schema-41200to41300.sql

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@
2323
INSERT IGNORE INTO `cloud`.`hypervisor_capabilities` (uuid, hypervisor_type, hypervisor_version, max_guests_limit, security_group_enabled, max_data_volumes_limit, max_hosts_per_cluster, storage_motion_supported, vm_snapshot_enabled) values (UUID(), 'VMware', '6.7', 128, 0, 13, 32, 1, 1);
2424
INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) SELECT UUID(),'VMware', '6.7', guest_os_name, guest_os_id, utc_timestamp(), 0 FROM `cloud`.`guest_os_hypervisor` WHERE hypervisor_type='VMware' AND hypervisor_version='6.5';
2525

26+
-- XenServer 7.1.2
27+
INSERT IGNORE INTO `cloud`.`hypervisor_capabilities`(uuid, hypervisor_type, hypervisor_version, max_guests_limit, max_data_volumes_limit, storage_motion_supported) values (UUID(), 'XenServer', '7.1.2', 500, 13, 1);
28+
INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) SELECT UUID(),'Xenserver', '7.1.2', guest_os_name, guest_os_id, utc_timestamp(), 0 FROM `cloud`.`guest_os_hypervisor` WHERE hypervisor_type='Xenserver' AND hypervisor_version='7.1.0';
29+
2630
-- XenServer 7.6
2731
INSERT IGNORE INTO `cloud`.`hypervisor_capabilities`(uuid, hypervisor_type, hypervisor_version, max_guests_limit, max_data_volumes_limit, storage_motion_supported) values (UUID(), 'XenServer', '7.6.0', 500, 13, 1);
2832
INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) SELECT UUID(),'Xenserver', '7.6.0', guest_os_name, guest_os_id, utc_timestamp(), 0 FROM `cloud`.`guest_os_hypervisor` WHERE hypervisor_type='Xenserver' AND hypervisor_version='7.5.0';
@@ -73,4 +77,34 @@ CREATE VIEW `cloud`.`data_center_view` AS
7377
left join
7478
`cloud`.`dedicated_resources` ON data_center.id = dedicated_resources.data_center_id
7579
left join
76-
`cloud`.`affinity_group` ON dedicated_resources.affinity_group_id = affinity_group.id;
80+
`cloud`.`affinity_group` ON dedicated_resources.affinity_group_id = affinity_group.id;
81+
82+
-- Remove key/value tags from project_view
83+
DROP VIEW IF EXISTS `cloud`.`project_view`;
84+
CREATE VIEW `cloud`.`project_view` AS
85+
select
86+
projects.id,
87+
projects.uuid,
88+
projects.name,
89+
projects.display_text,
90+
projects.state,
91+
projects.removed,
92+
projects.created,
93+
projects.project_account_id,
94+
account.account_name owner,
95+
pacct.account_id,
96+
domain.id domain_id,
97+
domain.uuid domain_uuid,
98+
domain.name domain_name,
99+
domain.path domain_path
100+
from
101+
`cloud`.`projects`
102+
inner join
103+
`cloud`.`domain` ON projects.domain_id = domain.id
104+
inner join
105+
`cloud`.`project_account` ON projects.id = project_account.project_id
106+
and project_account.account_role = 'Admin'
107+
inner join
108+
`cloud`.`account` ON account.id = project_account.account_id
109+
left join
110+
`cloud`.`project_account` pacct ON projects.id = pacct.project_id;

framework/quota/src/main/java/org/apache/cloudstack/quota/constant/QuotaTypes.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public class QuotaTypes extends UsageTypes {
5353
quotaTypeList.put(VM_DISK_IO_READ, new QuotaTypes(VM_DISK_IO_READ, "VM_DISK_IO_READ", "GB", "VM Disk usage(I/O Read)"));
5454
quotaTypeList.put(VM_DISK_IO_WRITE, new QuotaTypes(VM_DISK_IO_WRITE, "VM_DISK_IO_WRITE", "GB", "VM Disk usage(I/O Write)"));
5555
quotaTypeList.put(VM_DISK_BYTES_READ, new QuotaTypes(VM_DISK_BYTES_READ, "VM_DISK_BYTES_READ", "GB", "VM Disk usage(Bytes Read)"));
56-
quotaTypeList.put(VM_DISK_BYTES_WRITE, new QuotaTypes(VM_DISK_BYTES_WRITE, "VPN_USERS", "GB", "VM Disk usage(Bytes Write)"));
56+
quotaTypeList.put(VM_DISK_BYTES_WRITE, new QuotaTypes(VM_DISK_BYTES_WRITE, "VM_DISK_BYTES_WRITE", "GB", "VM Disk usage(Bytes Write)"));
5757
quotaTypeList.put(VM_SNAPSHOT, new QuotaTypes(VM_SNAPSHOT, "VM_SNAPSHOT", "GB-Month", "VM Snapshot storage usage"));
5858
quotaTypeList.put(VOLUME_SECONDARY, new QuotaTypes(VOLUME_SECONDARY, "VOLUME_SECONDARY", "GB-Month", "Volume secondary storage usage"));
5959
quotaTypeList.put(VM_SNAPSHOT_ON_PRIMARY, new QuotaTypes(VM_SNAPSHOT_ON_PRIMARY, "VM_SNAPSHOT_ON_PRIMARY", "GB-Month", "VM Snapshot primary storage usage"));

0 commit comments

Comments
 (0)