Skip to content

Commit 93fb63d

Browse files
authored
Merge branch 'apache:main' into main
2 parents 3ebe4cc + e4beb1f commit 93fb63d

File tree

77 files changed

+2462
-651
lines changed

Some content is hidden

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

77 files changed

+2462
-651
lines changed

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ env:
8888
smoke/test_portable_publicip
8989
smoke/test_portforwardingrules
9090
smoke/test_privategw_acl
91+
smoke/test_privategw_acl_ovs_gre
9192
smoke/test_projects
9293
smoke/test_public_ip_range"
9394

api/src/main/java/com/cloud/event/EventTypes.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -521,6 +521,7 @@ public class EventTypes {
521521
public static final String EVENT_VM_BACKUP_SCHEDULE_CONFIGURE = "BACKUP.SCHEDULE.CONFIGURE";
522522
public static final String EVENT_VM_BACKUP_SCHEDULE_DELETE = "BACKUP.SCHEDULE.DELETE";
523523
public static final String EVENT_VM_BACKUP_USAGE_METRIC = "BACKUP.USAGE.METRIC";
524+
public static final String EVENT_VM_BACKUP_EDIT = "BACKUP.OFFERING.EDIT";
524525

525526
// external network device events
526527
public static final String EVENT_EXTERNAL_NVP_CONTROLLER_ADD = "PHYSICAL.NVPCONTROLLER.ADD";

api/src/main/java/com/cloud/offering/NetworkOffering.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public enum State {
4040
}
4141

4242
public enum Detail {
43-
InternalLbProvider, PublicLbProvider, servicepackageuuid, servicepackagedescription, PromiscuousMode, MacAddressChanges, ForgedTransmits, RelatedNetworkOffering, domainid, zoneid, pvlanType
43+
InternalLbProvider, PublicLbProvider, servicepackageuuid, servicepackagedescription, PromiscuousMode, MacAddressChanges, ForgedTransmits, MacLearning, RelatedNetworkOffering, domainid, zoneid, pvlanType
4444
}
4545

4646
public final static String SystemPublicNetwork = "System-Public-Network";

api/src/main/java/com/cloud/vm/VmDetailConstants.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@ public interface VmDetailConstants {
4040
String KVM_VNC_PORT = "kvm.vnc.port";
4141
String KVM_VNC_ADDRESS = "kvm.vnc.address";
4242

43+
// KVM specific, custom virtual GPU hardware
44+
String VIDEO_HARDWARE = "video.hardware";
45+
String VIDEO_RAM = "video.ram";
46+
4347
// Mac OSX guest specific (internal)
4448
String SMC_PRESENT = "smc.present";
4549
String FIRMWARE = "firmware";
Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
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.api.command.admin.backup;
18+
19+
import javax.inject.Inject;
20+
21+
import org.apache.cloudstack.api.APICommand;
22+
import org.apache.cloudstack.api.ApiConstants;
23+
import org.apache.cloudstack.api.ApiErrorCode;
24+
import org.apache.cloudstack.api.BaseCmd;
25+
import org.apache.cloudstack.api.Parameter;
26+
import org.apache.cloudstack.api.ServerApiException;
27+
import org.apache.cloudstack.api.response.BackupOfferingResponse;
28+
import org.apache.cloudstack.backup.BackupManager;
29+
import org.apache.cloudstack.backup.BackupOffering;
30+
import org.apache.commons.lang3.StringUtils;
31+
import org.apache.log4j.Logger;
32+
33+
import com.cloud.exception.InvalidParameterValueException;
34+
import com.cloud.user.Account;
35+
import com.cloud.utils.exception.CloudRuntimeException;
36+
37+
@APICommand(name = "updateBackupOffering", description = "Updates a backup offering.", responseObject = BackupOfferingResponse.class,
38+
requestHasSensitiveInfo = false, responseHasSensitiveInfo = false, since = "4.16.0")
39+
public class UpdateBackupOfferingCmd extends BaseCmd {
40+
private static final Logger LOGGER = Logger.getLogger(UpdateBackupOfferingCmd.class.getName());
41+
private static final String APINAME = "updateBackupOffering";
42+
43+
@Inject
44+
private BackupManager backupManager;
45+
46+
/////////////////////////////////////////////////////
47+
//////////////// API parameters /////////////////////
48+
/////////////////////////////////////////////////////
49+
@Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = BackupOfferingResponse.class, required = true, description = "The ID of the Backup Offering to be updated")
50+
private Long id;
51+
52+
@Parameter(name = ApiConstants.DESCRIPTION, type = CommandType.STRING, description = "The description of the Backup Offering to be updated")
53+
private String description;
54+
55+
@Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "The name of the Backup Offering to be updated")
56+
private String name;
57+
58+
/////////////////////////////////////////////////////
59+
/////////////////// Accessors ///////////////////////
60+
/////////////////////////////////////////////////////
61+
public Long getId() {
62+
return id;
63+
}
64+
65+
public String getName() {
66+
return name;
67+
}
68+
69+
public String getDescription() {
70+
return description;
71+
}
72+
73+
/////////////////////////////////////////////////////
74+
/////////////// API Implementation///////////////////
75+
/////////////////////////////////////////////////////
76+
@Override
77+
public void execute() {
78+
try {
79+
if (StringUtils.isAllEmpty(name, description)) {
80+
throw new InvalidParameterValueException(String.format("Can't update Backup Offering [id: %s] because there is no change in name or description.", id));
81+
}
82+
83+
BackupOffering result = backupManager.updateBackupOffering(this);
84+
85+
if (result == null) {
86+
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, String.format("Failed to update backup offering [id: %s, name: %s, description: %s].", id, name, description));
87+
}
88+
BackupOfferingResponse response = _responseGenerator.createBackupOfferingResponse(result);
89+
response.setResponseName(getCommandName());
90+
this.setResponseObject(response);
91+
} catch (CloudRuntimeException e) {
92+
ApiErrorCode paramError = e instanceof InvalidParameterValueException ? ApiErrorCode.PARAM_ERROR : ApiErrorCode.INTERNAL_ERROR;
93+
LOGGER.error(String.format("Failed to update Backup Offering [id: %s] due to: [%s].", id, e.getMessage()), e);
94+
throw new ServerApiException(paramError, e.getMessage());
95+
}
96+
}
97+
98+
@Override
99+
public String getCommandName() {
100+
return APINAME.toLowerCase() + BaseCmd.RESPONSE_SUFFIX;
101+
}
102+
103+
@Override
104+
public long getEntityOwnerId() {
105+
return Account.ACCOUNT_ID_SYSTEM;
106+
}
107+
}

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
import java.util.List;
2121

2222
import org.apache.cloudstack.api.command.admin.backup.ImportBackupOfferingCmd;
23+
import org.apache.cloudstack.api.command.admin.backup.UpdateBackupOfferingCmd;
2324
import org.apache.cloudstack.api.command.user.backup.CreateBackupScheduleCmd;
2425
import org.apache.cloudstack.api.command.user.backup.ListBackupOfferingsCmd;
2526
import org.apache.cloudstack.api.command.user.backup.ListBackupsCmd;
@@ -137,4 +138,6 @@ public interface BackupManager extends BackupService, Configurable, PluggableSer
137138
* @return returns operation success
138139
*/
139140
boolean deleteBackup(final Long backupId);
141+
142+
BackupOffering updateBackupOffering(UpdateBackupOfferingCmd updateBackupOfferingCmd);
140143
}

core/src/main/java/com/cloud/agent/api/storage/MigrateVolumeCommand.java

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
public class MigrateVolumeCommand extends Command {
3131
long volumeId;
3232
String volumePath;
33+
String chainInfo;
3334
StorageFilerTO pool;
3435
StorageFilerTO sourcePool;
3536
String attachedVmName;
@@ -49,14 +50,22 @@ public MigrateVolumeCommand(long volumeId, String volumePath, StoragePool pool,
4950
}
5051

5152
public MigrateVolumeCommand(long volumeId, String volumePath, StoragePool pool, String attachedVmName, Volume.Type volumeType, int timeout) {
52-
this(volumeId,volumePath,pool,timeout);
53+
this(volumeId, volumePath, pool, timeout);
5354
this.attachedVmName = attachedVmName;
5455
this.volumeType = volumeType;
5556
this.setWait(timeout);
5657
}
5758

58-
public MigrateVolumeCommand(long volumeId, String volumePath, String attachedVmName, StoragePool sourcePool, StoragePool targetPool, String hostGuidInTargetCluster) {
59-
this(volumeId,volumePath,targetPool, attachedVmName, Volume.Type.UNKNOWN, -1);
59+
public MigrateVolumeCommand(long volumeId, String volumePath, StoragePool pool, String attachedVmName, Volume.Type volumeType, int timeout, String chainInfo) {
60+
this(volumeId, volumePath, pool, timeout);
61+
this.attachedVmName = attachedVmName;
62+
this.volumeType = volumeType;
63+
this.chainInfo = chainInfo;
64+
this.setWait(timeout);
65+
}
66+
67+
public MigrateVolumeCommand(long volumeId, String volumePath, String attachedVmName, StoragePool sourcePool, StoragePool targetPool, String hostGuidInTargetCluster, String chainInfo) {
68+
this(volumeId,volumePath,targetPool, attachedVmName, Volume.Type.UNKNOWN, -1, chainInfo);
6069
this.sourcePool = new StorageFilerTO(sourcePool);
6170
this.hostGuidInTargetCluster = hostGuidInTargetCluster;
6271
}
@@ -134,4 +143,6 @@ public Map<String, String> getDestDetails() {
134143
public int getWaitInMillSeconds() {
135144
return getWait() * 1000;
136145
}
146+
147+
public String getChainInfo() { return chainInfo; }
137148
}

core/src/main/java/com/cloud/agent/api/storage/ResizeVolumeCommand.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ public class ResizeVolumeCommand extends Command {
2929
private Long newSize;
3030
private boolean shrinkOk;
3131
private String vmInstance;
32+
private String chainInfo;
3233

3334
/* For managed storage */
3435
private boolean managed;
@@ -47,6 +48,11 @@ public ResizeVolumeCommand(String path, StorageFilerTO pool, Long currentSize, L
4748
this.managed = false;
4849
}
4950

51+
public ResizeVolumeCommand(String path, StorageFilerTO pool, Long currentSize, Long newSize, boolean shrinkOk, String vmInstance, String chainInfo) {
52+
this(path, pool, currentSize, newSize, shrinkOk, vmInstance);
53+
this.chainInfo = chainInfo;
54+
}
55+
5056
public ResizeVolumeCommand(String path, StorageFilerTO pool, Long currentSize, Long newSize, boolean shrinkOk, String vmInstance,
5157
boolean isManaged, String iScsiName) {
5258
this(path, pool, currentSize, newSize, shrinkOk, vmInstance);
@@ -81,6 +87,8 @@ public String getInstanceName() {
8187

8288
public String get_iScsiName() {return iScsiName; }
8389

90+
public String getChainInfo() {return chainInfo; }
91+
8492
/**
8593
* {@inheritDoc}
8694
*/

engine/api/src/main/java/com/cloud/vm/VirtualMachineManager.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ NicProfile addVmToNetwork(VirtualMachine vm, Network network, NicProfile request
221221
*/
222222
VirtualMachineTO toVmTO(VirtualMachineProfile profile);
223223

224-
boolean replugNic(Network network, NicTO nic, VirtualMachineTO vm, ReservationContext context, DeployDestination dest) throws ConcurrentOperationException,
224+
boolean replugNic(Network network, NicTO nic, VirtualMachineTO vm, Host dest) throws ConcurrentOperationException,
225225
ResourceUnavailableException, InsufficientCapacityException;
226226

227227
VirtualMachine reConfigureVm(String vmUuid, ServiceOffering oldServiceOffering, ServiceOffering newServiceOffering, Map<String, String> customParameters, boolean sameHost) throws ResourceUnavailableException, ConcurrentOperationException,

engine/api/src/main/java/org/apache/cloudstack/engine/orchestration/service/NetworkOrchestrationService.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,9 @@ public interface NetworkOrchestrationService {
9494
ConfigKey<Boolean> ForgedTransmits = new ConfigKey<Boolean>("Advanced", Boolean.class, "network.forged.transmits", "true",
9595
"Whether to allow or deny forged transmits on nics for applicable network elements such as for vswitch/dvswitch portgroups.", true);
9696

97+
ConfigKey<Boolean> MacLearning = new ConfigKey<Boolean>("Advanced", Boolean.class, "network.mac.learning", "false",
98+
"Whether to allow or deny MAC learning on nics for applicable network elements such as for dvswitch portgroups.", true);
99+
97100
ConfigKey<Boolean> RollingRestartEnabled = new ConfigKey<Boolean>("Advanced", Boolean.class, "network.rolling.restart", "true",
98101
"Whether to allow or deny rolling restart of network routers.", true);
99102

0 commit comments

Comments
 (0)