Skip to content

Commit 33cd1ab

Browse files
committed
Merge branch 'master' into rbac
2 parents 82bdde7 + b5b4607 commit 33cd1ab

270 files changed

Lines changed: 5000 additions & 3455 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

LICENSE.header

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
Licensed to the Apache Software Foundation (ASF) under one
2-
or more contributor license agreements. See the NOTICE file
2+
or more contributor license agreements. See the NOTICE file
33
distributed with this work for additional information
4-
regarding copyright ownership. The ASF licenses this file
4+
regarding copyright ownership. The ASF licenses this file
55
to you under the Apache License, Version 2.0 (the
66
"License"); you may not use this file except in compliance
7-
with the License. You may obtain a copy of the License at
7+
with the License. You may obtain a copy of the License at
88

9-
http://www.apache.org/licenses/LICENSE-2.0
9+
http://www.apache.org/licenses/LICENSE-2.0
1010

1111
Unless required by applicable law or agreed to in writing,
1212
software distributed under the License is distributed on an
1313
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14-
KIND, either express or implied. See the License for the
14+
KIND, either express or implied. See the License for the
1515
specific language governing permissions and limitations
1616
under the License.

scripts/network/domr/s2s_vpn.sh renamed to api/resources/META-INF/cloudstack/api-config/module.properties

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#!/bin/bash
21
# Licensed to the Apache Software Foundation (ASF) under one
32
# or more contributor license agreements. See the NOTICE file
43
# distributed with this work for additional information
@@ -15,15 +14,5 @@
1514
# KIND, either express or implied. See the License for the
1615
# specific language governing permissions and limitations
1716
# under the License.
18-
19-
20-
21-
22-
# @VERSION@
23-
24-
cert="/root/.ssh/id_rsa.cloud"
25-
domr=$1
26-
shift
27-
ssh -p 3922 -o StrictHostKeyChecking=no -i $cert root@$domr "/opt/cloud/bin/ipsectunnel.sh $*" >/dev/null
28-
29-
exit $?
17+
name=api-config
18+
parent=core
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<!--
2+
Licensed to the Apache Software Foundation (ASF) under one
3+
or more contributor license agreements. See the NOTICE file
4+
distributed with this work for additional information
5+
regarding copyright ownership. The ASF licenses this file
6+
to you under the Apache License, Version 2.0 (the
7+
"License"); you may not use this file except in compliance
8+
with the License. You may obtain a copy of the License at
9+
10+
http://www.apache.org/licenses/LICENSE-2.0
11+
12+
Unless required by applicable law or agreed to in writing,
13+
software distributed under the License is distributed on an
14+
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
KIND, either express or implied. See the License for the
16+
specific language governing permissions and limitations
17+
under the License.
18+
-->
19+
<beans xmlns="http://www.springframework.org/schema/beans"
20+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
21+
xmlns:context="http://www.springframework.org/schema/context"
22+
xmlns:aop="http://www.springframework.org/schema/aop"
23+
xsi:schemaLocation="http://www.springframework.org/schema/beans
24+
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
25+
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
26+
http://www.springframework.org/schema/context
27+
http://www.springframework.org/schema/context/spring-context-3.0.xsd"
28+
>
29+
30+
<bean id="apiServiceConfiguration" class="org.apache.cloudstack.config.ApiServiceConfiguration" />
31+
32+
</beans>

api/src/com/cloud/network/VirtualNetworkApplianceService.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,5 +69,5 @@ public interface VirtualNetworkApplianceService {
6969

7070
List<Long> upgradeRouterTemplate(UpgradeRouterTemplateCmd cmd);
7171

72-
public static final String MinVRVersion = "4.2.0";
72+
public static final String MinVRVersion = "4.3.0";
7373
}

api/src/com/cloud/vm/UserVmService.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -461,4 +461,12 @@ UserVm upgradeVirtualMachine(ScaleVMCmd cmd) throws ResourceUnavailableException
461461

462462
UserVm expungeVm(long vmId) throws ResourceUnavailableException, ConcurrentOperationException;
463463

464+
/**
465+
* Finds and returns an encrypted password for a VM.
466+
*
467+
* @param userVmId
468+
* @return Base64 encoded userdata
469+
*/
470+
String getVmUserData(long vmId);
471+
464472
}
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one or more
3+
* contributor license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright ownership.
5+
* The ASF licenses this file to You under the Apache License, Version 2.0
6+
* (the "License"); you may not use this file except in compliance with
7+
* the License. You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*
17+
*/
18+
19+
package org.apache.cloudstack.api.command.admin.vm;
20+
21+
import org.apache.cloudstack.api.APICommand;
22+
import org.apache.cloudstack.api.ApiConstants;
23+
import org.apache.cloudstack.api.BaseCmd;
24+
import org.apache.cloudstack.api.Parameter;
25+
import org.apache.cloudstack.api.response.UserVmResponse;
26+
import org.apache.cloudstack.api.response.VMUserDataResponse;
27+
import org.apache.log4j.Logger;
28+
29+
import com.cloud.user.Account;
30+
import com.cloud.uservm.UserVm;
31+
32+
@APICommand(name = "getVirtualMachineUserData", description = "Returns user data associated with the VM", responseObject = VMUserDataResponse.class, since = "4.4")
33+
public class GetVMUserDataCmd extends BaseCmd {
34+
public static final Logger s_logger = Logger.getLogger(GetVMUserDataCmd.class);
35+
private static final String s_name = "getvirtualmachineuserdataresponse";
36+
37+
/////////////////////////////////////////////////////
38+
//////////////// API parameters /////////////////////
39+
/////////////////////////////////////////////////////
40+
41+
@Parameter(name = ApiConstants.VIRTUAL_MACHINE_ID, type = CommandType.UUID, entityType = UserVmResponse.class, required = true, description = "The ID of the virtual machine")
42+
private Long vmId;
43+
44+
/////////////////////////////////////////////////////
45+
/////////////////// Accessors ///////////////////////
46+
/////////////////////////////////////////////////////
47+
48+
public long getId() {
49+
return vmId;
50+
}
51+
52+
/////////////////////////////////////////////////////
53+
/////////////// API Implementation///////////////////
54+
/////////////////////////////////////////////////////
55+
56+
@Override
57+
public void execute() {
58+
String userData = _userVmService.getVmUserData(getId());
59+
VMUserDataResponse resp = new VMUserDataResponse();
60+
resp.setVmId(_entityMgr.findById(UserVm.class, getId()).getUuid());
61+
resp.setUserData(userData);
62+
resp.setObjectName("virtualmachineuserdata");
63+
resp.setResponseName(getCommandName());
64+
this.setResponseObject(resp);
65+
}
66+
67+
@Override
68+
public long getEntityOwnerId() {
69+
UserVm userVm = _entityMgr.findById(UserVm.class, getId());
70+
if (userVm != null) {
71+
return userVm.getAccountId();
72+
}
73+
74+
return Account.ACCOUNT_ID_SYSTEM; // no account info given, parent this command to SYSTEM so ERROR events are tracked
75+
}
76+
77+
@Override
78+
public String getCommandName() {
79+
return s_name;
80+
}
81+
}
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one or more
3+
* contributor license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright ownership.
5+
* The ASF licenses this file to You under the Apache License, Version 2.0
6+
* (the "License"); you may not use this file except in compliance with
7+
* the License. You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*
17+
*/
18+
19+
package org.apache.cloudstack.api.response;
20+
21+
import org.apache.cloudstack.api.ApiConstants;
22+
import org.apache.cloudstack.api.BaseResponse;
23+
24+
import com.cloud.serializer.Param;
25+
import com.google.gson.annotations.SerializedName;
26+
27+
public class VMUserDataResponse extends BaseResponse {
28+
@SerializedName(ApiConstants.VIRTUAL_MACHINE_ID)
29+
@Param(description = "the ID of the virtual machine")
30+
private String vmId;
31+
32+
@SerializedName(ApiConstants.USER_DATA)
33+
@Param(description = "Base 64 encoded VM user data")
34+
private String userData;
35+
36+
public void setUserData(String userData) {
37+
this.userData = userData;
38+
}
39+
40+
public void setVmId(String vmId) {
41+
this.vmId = vmId;
42+
}
43+
44+
}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
// Licensed to the Apache Software Foundation (ASF) under one
2+
// or more contributor license agreements. See the NOTICE file
3+
// distributed with this work for additional information
4+
// regarding copyright ownership. The ASF licenses this file
5+
// to you under the Apache License, Version 2.0 (the
6+
// "License"); you may not use this file except in compliance
7+
// with the License. You may obtain a copy of the License at
8+
//
9+
// http://www.apache.org/licenses/LICENSE-2.0
10+
//
11+
// Unless required by applicable law or agreed to in writing,
12+
// software distributed under the License is distributed on an
13+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
// KIND, either express or implied. See the License for the
15+
// specific language governing permissions and limitations
16+
// under the License.
17+
package org.apache.cloudstack.config;
18+
19+
import javax.ejb.Local;
20+
21+
import org.apache.cloudstack.framework.config.ConfigKey;
22+
import org.apache.cloudstack.framework.config.Configurable;
23+
24+
@Local(value = {ApiServiceConfiguration.class})
25+
public class ApiServiceConfiguration implements Configurable {
26+
public static final ConfigKey<String> ManagementHostIPAdr = new ConfigKey<String>("Advanced", String.class, "host", "localhost", "The ip address of management server", true);
27+
public static final ConfigKey<String> ApiServletPath = new ConfigKey<String>("Advanced", String.class, "api.servlet.endpoint", "http://localhost:8080/client/api?",
28+
"API end point. Can be used by CS components/services deployed remotely, for sending CS API requests", true);
29+
30+
@Override
31+
public String getConfigComponentName() {
32+
return ApiServiceConfiguration.class.getSimpleName();
33+
}
34+
35+
@Override
36+
public ConfigKey<?>[] getConfigKeys() {
37+
return new ConfigKey<?>[] {ManagementHostIPAdr, ApiServletPath};
38+
}
39+
40+
}

awsapi/src/com/cloud/bridge/service/core/ec2/EC2Engine.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@
6666
import com.cloud.stack.models.CloudStackResourceLimit;
6767
import com.cloud.stack.models.CloudStackResourceTag;
6868
import com.cloud.stack.models.CloudStackSecurityGroup;
69+
import com.cloud.stack.models.CloudStackServiceOffering;
6970
import com.cloud.stack.models.CloudStackSnapshot;
7071
import com.cloud.stack.models.CloudStackTemplate;
7172
import com.cloud.stack.models.CloudStackTemplatePermission;
@@ -1414,7 +1415,7 @@ public EC2RunInstancesResponse runInstances(EC2RunInstances request) {
14141415
if (request.getInstanceType() != null) {
14151416
instanceType = request.getInstanceType();
14161417
}
1417-
CloudStackServiceOfferingVO svcOffering = getCSServiceOfferingId(instanceType);
1418+
CloudStackServiceOffering svcOffering = getCSServiceOfferingId(instanceType);
14181419
if (svcOffering == null) {
14191420
logger.info("No ServiceOffering found to be defined by name, please contact the administrator " + instanceType);
14201421
throw new Exception("instanceType not found");
@@ -1609,7 +1610,7 @@ public boolean modifyInstanceAttribute(EC2ModifyInstanceAttribute request) {
16091610

16101611
if (request.getInstanceType() != null) {
16111612
String instanceType = request.getInstanceType();
1612-
CloudStackServiceOfferingVO svcOffering = getCSServiceOfferingId(instanceType);
1613+
CloudStackServiceOffering svcOffering = getCSServiceOfferingId(instanceType);
16131614
if (svcOffering == null)
16141615
throw new Exception("instanceType not found");
16151616
CloudStackUserVm userVm = getApi().changeServiceForVirtualMachine(instanceId, svcOffering.getId());
@@ -1783,11 +1784,12 @@ private String toZoneId(String zoneName, String domainId) throws Exception {
17831784
*
17841785
*/
17851786

1786-
private CloudStackServiceOfferingVO getCSServiceOfferingId(String instanceType) throws Exception {
1787+
private CloudStackServiceOffering getCSServiceOfferingId(String instanceType) throws Exception {
17871788
try {
17881789
if (instanceType == null)
17891790
instanceType = "m1.small"; // default value
1790-
return scvoDao.getSvcOfferingByName(instanceType);
1791+
List<CloudStackServiceOffering> serviceOfferings = getApi().listServiceOfferings(null, null, false, null, instanceType, null, null);
1792+
return serviceOfferings.get(0);
17911793
} catch (Exception e) {
17921794
logger.error("Error while retrieving ServiceOffering information by name - ", e);
17931795
throw new Exception("No ServiceOffering found to be defined by name");

client/WEB-INF/classes/resources/messages.properties

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ label.smb.password=SMB Password
3131
label.smb.domain=SMB Domain
3232
label.hypervisors=Hypervisors
3333
label.home=Home
34-
label.sockets=Sockets
34+
label.sockets=CPU Sockets
3535
label.root.disk.size=Root disk size
3636
label.s3.nfs.server=S3 NFS Server
3737
label.s3.nfs.path=S3 NFS Path
@@ -706,13 +706,15 @@ label.lang.arabic=Arabic
706706
label.lang.brportugese=Brazilian Portugese
707707
label.lang.catalan=Catalan
708708
label.lang.chinese=Chinese (Simplified)
709+
label.lang.dutch=Dutch (Netherlands)
709710
label.lang.english=English
710711
label.lang.french=French
711712
label.lang.german=German
712713
label.lang.italian=Italian
713714
label.lang.japanese=Japanese
714715
label.lang.korean=Korean
715716
label.lang.norwegian=Norwegian
717+
label.lang.polish=Polish
716718
label.lang.russian=Russian
717719
label.lang.spanish=Spanish
718720
label.last.disconnected=Last Disconnected

0 commit comments

Comments
 (0)