Skip to content

Commit 5e2afc3

Browse files
committed
Merge branch '4.20' of https://github.com/apache/cloudstack into support-xen84-py3
2 parents 9a99c43 + 6850147 commit 5e2afc3

File tree

96 files changed

+2484
-1051
lines changed

Some content is hidden

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

96 files changed

+2484
-1051
lines changed

agent/bindir/cloud-setup-agent.in

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,19 @@ import os
2020
import logging
2121
import sys
2222
import socket
23+
24+
# ---- This snippet of code adds the sources path and the waf configured PYTHONDIR to the Python path ----
25+
# ---- We do this so cloud_utils can be looked up in the following order:
26+
# ---- 1) Sources directory
27+
# ---- 2) waf configured PYTHONDIR
28+
# ---- 3) System Python path
29+
for pythonpath in (
30+
"@PYTHONDIR@",
31+
os.path.join(os.path.dirname(__file__),os.path.pardir,os.path.pardir,"python","lib"),
32+
):
33+
if os.path.isdir(pythonpath): sys.path.insert(0,pythonpath)
34+
# ---- End snippet of code ----
35+
2336
from cloudutils.cloudException import CloudRuntimeException, CloudInternalException
2437
from cloudutils.utilities import initLoging, bash
2538
from cloudutils.configFileOps import configFileOps

agent/bindir/libvirtqemuhook.in

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,19 @@ import sys
2020
import os
2121
import subprocess
2222
from threading import Timer
23+
24+
# ---- This snippet of code adds the sources path and the waf configured PYTHONDIR to the Python path ----
25+
# ---- We do this so cloud_utils can be looked up in the following order:
26+
# ---- 1) Sources directory
27+
# ---- 2) waf configured PYTHONDIR
28+
# ---- 3) System Python path
29+
for pythonpath in (
30+
"@PYTHONDIR@",
31+
os.path.join(os.path.dirname(__file__),os.path.pardir,os.path.pardir,"python","lib"),
32+
):
33+
if os.path.isdir(pythonpath): sys.path.insert(0,pythonpath)
34+
# ---- End snippet of code ----
35+
2336
from xml.dom.minidom import parse
2437
from cloudutils.configFileOps import configFileOps
2538
from cloudutils.networkConfig import networkConfig

api/src/main/java/org/apache/cloudstack/api/command/user/backup/DeleteBackupScheduleCmd.java

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
import org.apache.cloudstack.api.BaseCmd;
2727
import org.apache.cloudstack.api.Parameter;
2828
import org.apache.cloudstack.api.ServerApiException;
29+
import org.apache.cloudstack.api.response.BackupScheduleResponse;
2930
import org.apache.cloudstack.api.response.SuccessResponse;
3031
import org.apache.cloudstack.api.response.UserVmResponse;
3132
import org.apache.cloudstack.backup.BackupManager;
@@ -54,10 +55,16 @@ public class DeleteBackupScheduleCmd extends BaseCmd {
5455
@Parameter(name = ApiConstants.VIRTUAL_MACHINE_ID,
5556
type = CommandType.UUID,
5657
entityType = UserVmResponse.class,
57-
required = true,
5858
description = "ID of the VM")
5959
private Long vmId;
6060

61+
@Parameter(name = ApiConstants.ID,
62+
type = CommandType.UUID,
63+
entityType = BackupScheduleResponse.class,
64+
description = "ID of the schedule",
65+
since = "4.20.1")
66+
private Long id;
67+
6168
/////////////////////////////////////////////////////
6269
/////////////////// Accessors ///////////////////////
6370
/////////////////////////////////////////////////////
@@ -66,14 +73,17 @@ public Long getVmId() {
6673
return vmId;
6774
}
6875

76+
public Long getId() { return id; }
77+
78+
6979
/////////////////////////////////////////////////////
7080
/////////////// API Implementation///////////////////
7181
/////////////////////////////////////////////////////
7282

7383
@Override
7484
public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException, NetworkRuleConflictException {
7585
try {
76-
boolean result = backupManager.deleteBackupSchedule(getVmId());
86+
boolean result = backupManager.deleteBackupSchedule(this);
7787
if (result) {
7888
SuccessResponse response = new SuccessResponse(getCommandName());
7989
response.setResponseName(getCommandName());

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
import org.apache.cloudstack.api.response.SecurityGroupResponse;
4242
import org.apache.cloudstack.api.response.ServiceOfferingResponse;
4343
import org.apache.cloudstack.api.response.TemplateResponse;
44+
import org.apache.cloudstack.api.response.UserDataResponse;
4445
import org.apache.cloudstack.api.response.UserResponse;
4546
import org.apache.cloudstack.api.response.UserVmResponse;
4647
import org.apache.cloudstack.api.response.VpcResponse;
@@ -149,6 +150,9 @@ public class ListVMsCmd extends BaseListRetrieveOnlyResourceCountCmd implements
149150
@Parameter(name = ApiConstants.USER_DATA, type = CommandType.BOOLEAN, description = "Whether to return the VMs' user data or not. By default, user data will not be returned.", since = "4.18.0.0")
150151
private Boolean showUserData;
151152

153+
@Parameter(name = ApiConstants.USER_DATA_ID, type = CommandType.UUID, entityType = UserDataResponse.class, required = false, description = "the instances by userdata", since = "4.20.1")
154+
private Long userdataId;
155+
152156
/////////////////////////////////////////////////////
153157
/////////////////// Accessors ///////////////////////
154158
/////////////////////////////////////////////////////
@@ -243,6 +247,10 @@ protected boolean isViewDetailsEmpty() {
243247
return CollectionUtils.isEmpty(viewDetails);
244248
}
245249

250+
public Long getUserdataId() {
251+
return userdataId;
252+
}
253+
246254
public EnumSet<VMDetails> getDetails() throws InvalidParameterValueException {
247255
if (isViewDetailsEmpty()) {
248256
if (_queryService.ReturnVmStatsOnVmList.value()) {

api/src/main/java/org/apache/cloudstack/api/response/BackupRepositoryResponse.java

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,6 @@ public class BackupRepositoryResponse extends BaseResponse {
5757
@Param(description = "backup type")
5858
private String type;
5959

60-
@SerializedName(ApiConstants.MOUNT_OPTIONS)
61-
@Param(description = "mount options for the backup repository")
62-
private String mountOptions;
63-
6460
@SerializedName(ApiConstants.CAPACITY_BYTES)
6561
@Param(description = "capacity of the backup repository")
6662
private Long capacityBytes;
@@ -112,14 +108,6 @@ public void setAddress(String address) {
112108
this.address = address;
113109
}
114110

115-
public String getMountOptions() {
116-
return mountOptions;
117-
}
118-
119-
public void setMountOptions(String mountOptions) {
120-
this.mountOptions = mountOptions;
121-
}
122-
123111
public String getProviderName() {
124112
return providerName;
125113
}

api/src/main/java/org/apache/cloudstack/api/response/NetworkResponse.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,11 @@
2828
import org.apache.cloudstack.api.EntityReference;
2929

3030
import com.cloud.network.Network;
31-
import com.cloud.projects.ProjectAccount;
3231
import com.cloud.serializer.Param;
3332
import com.google.gson.annotations.SerializedName;
3433

3534
@SuppressWarnings("unused")
36-
@EntityReference(value = {Network.class, ProjectAccount.class})
35+
@EntityReference(value = {Network.class})
3736
public class NetworkResponse extends BaseResponseWithAssociatedNetwork implements ControlledEntityResponse, SetResourceIconResponse {
3837

3938
@SerializedName(ApiConstants.ID)

api/src/main/java/org/apache/cloudstack/backup/BackupManager.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
import org.apache.cloudstack.api.command.admin.backup.ImportBackupOfferingCmd;
2323
import org.apache.cloudstack.api.command.admin.backup.UpdateBackupOfferingCmd;
2424
import org.apache.cloudstack.api.command.user.backup.CreateBackupScheduleCmd;
25+
import org.apache.cloudstack.api.command.user.backup.DeleteBackupScheduleCmd;
2526
import org.apache.cloudstack.api.command.user.backup.ListBackupOfferingsCmd;
2627
import org.apache.cloudstack.api.command.user.backup.ListBackupsCmd;
2728
import org.apache.cloudstack.framework.config.ConfigKey;
@@ -111,10 +112,10 @@ public interface BackupManager extends BackupService, Configurable, PluggableSer
111112

112113
/**
113114
* Deletes VM backup schedule for a VM
114-
* @param vmId
115+
* @param cmd
115116
* @return
116117
*/
117-
boolean deleteBackupSchedule(Long vmId);
118+
boolean deleteBackupSchedule(DeleteBackupScheduleCmd cmd);
118119

119120
/**
120121
* Creates backup of a VM

client/bindir/cloud-setup-management.in

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,27 @@
1616
# specific language governing permissions and limitations
1717
# under the License.
1818

19+
import os
1920
import sys
21+
# ---- This snippet of code adds the sources path and the waf configured PYTHONDIR to the Python path ----
22+
# ---- We do this so cloud_utils can be looked up in the following order:
23+
# ---- 1) Sources directory
24+
# ---- 2) waf configured PYTHONDIR
25+
# ---- 3) System Python path
26+
for pythonpath in (
27+
"@PYTHONDIR@",
28+
os.path.join(os.path.dirname(__file__),os.path.pardir,os.path.pardir,"python","lib"),
29+
):
30+
if os.path.isdir(pythonpath): sys.path.insert(0,pythonpath)
31+
# ---- End snippet of code ----
32+
2033
from cloudutils.syscfg import sysConfigFactory
2134
from cloudutils.utilities import initLoging, UnknownSystemException
2235
from cloudutils.cloudException import CloudRuntimeException, CloudInternalException
2336
from cloudutils.globalEnv import globalEnv
2437
from cloudutils.serviceConfigServer import cloudManagementConfig
2538
from optparse import OptionParser
39+
2640
if __name__ == '__main__':
2741
initLoging("@MSLOGDIR@/setupManagement.log")
2842
glbEnv = globalEnv()

engine/orchestration/src/main/java/com/cloud/agent/manager/AgentManagerImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1399,7 +1399,7 @@ private void processHostHealthCheckResult(Boolean hostHealthCheckResult, long ho
13991399
}
14001400
if (!BooleanUtils.toBoolean(EnableKVMAutoEnableDisable.valueIn(host.getClusterId()))) {
14011401
logger.debug("{} is disabled for the cluster {}, cannot process the health check result " +
1402-
"received for the host {}", EnableKVMAutoEnableDisable.key(), host.getClusterId(), host);
1402+
"received for {}", EnableKVMAutoEnableDisable.key(), host.getClusterId(), host);
14031403
return;
14041404
}
14051405

engine/orchestration/src/main/java/com/cloud/vm/VirtualMachineManagerImpl.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6071,6 +6071,9 @@ protected boolean isDiskOfferingSuitableForVm(VMInstanceVO vm, VirtualMachinePro
60716071
@Override
60726072
public Map<Long, Boolean> getDiskOfferingSuitabilityForVm(long vmId, List<Long> diskOfferingIds) {
60736073
VMInstanceVO vm = _vmDao.findById(vmId);
6074+
if (userVmDetailsDao.findDetail(vm.getId(), VmDetailConstants.DEPLOY_VM) != null) {
6075+
return new HashMap<>();
6076+
}
60746077
VirtualMachineProfile profile = new VirtualMachineProfileImpl(vm);
60756078
Pair<Long, Long> clusterAndHost = findClusterAndHostIdForVm(vm, false);
60766079
Long clusterId = clusterAndHost.first();

0 commit comments

Comments
 (0)