Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: Allow adding delete protection for VMs & volumes #9633

Merged
merged 7 commits into from
Sep 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions api/src/main/java/com/cloud/storage/Volume.java
Original file line number Diff line number Diff line change
Expand Up @@ -271,11 +271,13 @@ enum Event {

void setExternalUuid(String externalUuid);

public Long getPassphraseId();
Long getPassphraseId();

public void setPassphraseId(Long id);
void setPassphraseId(Long id);

public String getEncryptFormat();
String getEncryptFormat();

public void setEncryptFormat(String encryptFormat);
void setEncryptFormat(String encryptFormat);

boolean isDeleteProtection();
}
4 changes: 3 additions & 1 deletion api/src/main/java/com/cloud/storage/VolumeApiService.java
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,9 @@ Snapshot takeSnapshot(Long volumeId, Long policyId, Long snapshotId, Account acc

Snapshot allocSnapshot(Long volumeId, Long policyId, String snapshotName, Snapshot.LocationType locationType, List<Long> zoneIds) throws ResourceAllocationException;

Volume updateVolume(long volumeId, String path, String state, Long storageId, Boolean displayVolume, String customId, long owner, String chainInfo, String name);
Volume updateVolume(long volumeId, String path, String state, Long storageId,
Boolean displayVolume, Boolean deleteProtection,
String customId, long owner, String chainInfo, String name);

/**
* Extracts the volume to a particular location.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ public class ApiConstants {
public static final String DATACENTER_NAME = "datacentername";
public static final String DATADISK_OFFERING_LIST = "datadiskofferinglist";
public static final String DEFAULT_VALUE = "defaultvalue";
public static final String DELETE_PROTECTION = "deleteprotection";
public static final String DESCRIPTION = "description";
public static final String DESTINATION = "destination";
public static final String DESTINATION_ZONE_ID = "destzoneid";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,14 @@
@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)
private String extraConfig;

@Parameter(name = ApiConstants.DELETE_PROTECTION,
type = CommandType.BOOLEAN, since = "4.20.0",
description = "Set delete protection for the virtual machine. If " +
"true, the instance will be protected from deletion. " +
"Note: If the instance is managed by another service like" +
" autoscaling groups or CKS, delete protection will be ignored.")
private Boolean deleteProtection;

/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
Expand Down Expand Up @@ -215,6 +223,10 @@
return cleanupDetails == null ? false : cleanupDetails.booleanValue();
}

public Boolean getDeleteProtection() {
return deleteProtection;
}

Check warning on line 228 in api/src/main/java/org/apache/cloudstack/api/command/user/vm/UpdateVMCmd.java

View check run for this annotation

Codecov / codecov/patch

api/src/main/java/org/apache/cloudstack/api/command/user/vm/UpdateVMCmd.java#L226-L228

Added lines #L226 - L228 were not covered by tests

public Map<String, Map<Integer, String>> getDhcpOptionsMap() {
Map<String, Map<Integer, String>> dhcpOptionsMap = new HashMap<>();
if (dhcpOptionsNetworkList != null && !dhcpOptionsNetworkList.isEmpty()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,14 @@
@Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "new name of the volume", since = "4.16")
private String name;

@Parameter(name = ApiConstants.DELETE_PROTECTION,
type = CommandType.BOOLEAN, since = "4.20.0",
description = "Set delete protection for the volume. If true, The volume " +
"will be protected from deletion. Note: If the volume is managed by " +
"another service like autoscaling groups or CKS, delete protection will be " +
"ignored.")
private Boolean deleteProtection;

/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
Expand Down Expand Up @@ -109,6 +117,10 @@
return name;
}

public Boolean getDeleteProtection() {
return deleteProtection;
}

Check warning on line 122 in api/src/main/java/org/apache/cloudstack/api/command/user/volume/UpdateVolumeCmd.java

View check run for this annotation

Codecov / codecov/patch

api/src/main/java/org/apache/cloudstack/api/command/user/volume/UpdateVolumeCmd.java#L120-L122

Added lines #L120 - L122 were not covered by tests

/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////
Expand Down Expand Up @@ -168,7 +180,7 @@
public void execute() {
CallContext.current().setEventDetails("Volume Id: " + this._uuidMgr.getUuid(Volume.class, getId()));
Volume result = _volumeService.updateVolume(getId(), getPath(), getState(), getStorageId(), getDisplayVolume(),
getCustomId(), getEntityOwnerId(), getChainInfo(), getName());
getDeleteProtection(), getCustomId(), getEntityOwnerId(), getChainInfo(), getName());

Check warning on line 183 in api/src/main/java/org/apache/cloudstack/api/command/user/volume/UpdateVolumeCmd.java

View check run for this annotation

Codecov / codecov/patch

api/src/main/java/org/apache/cloudstack/api/command/user/volume/UpdateVolumeCmd.java#L183

Added line #L183 was not covered by tests
if (result != null) {
VolumeResponse response = _responseGenerator.createVolumeResponse(getResponseView(), result);
response.setResponseName(getCommandName());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,10 @@
@Param(description = "true if vm contains XS/VMWare tools inorder to support dynamic scaling of VM cpu/memory.")
private Boolean isDynamicallyScalable;

@SerializedName(ApiConstants.DELETE_PROTECTION)
@Param(description = "true if vm has delete protection.", since = "4.20.0")
private boolean deleteProtection;

@SerializedName(ApiConstants.SERVICE_STATE)
@Param(description = "State of the Service from LB rule")
private String serviceState;
Expand Down Expand Up @@ -991,6 +995,14 @@
isDynamicallyScalable = dynamicallyScalable;
}

public boolean isDeleteProtection() {
return deleteProtection;
}

Check warning on line 1000 in api/src/main/java/org/apache/cloudstack/api/response/UserVmResponse.java

View check run for this annotation

Codecov / codecov/patch

api/src/main/java/org/apache/cloudstack/api/response/UserVmResponse.java#L998-L1000

Added lines #L998 - L1000 were not covered by tests

public void setDeleteProtection(boolean deleteProtection) {

Check warning on line 1002 in api/src/main/java/org/apache/cloudstack/api/response/UserVmResponse.java

View check run for this annotation

Codecov / codecov/patch

api/src/main/java/org/apache/cloudstack/api/response/UserVmResponse.java#L1002

Added line #L1002 was not covered by tests
this.deleteProtection = deleteProtection;
}

public String getOsTypeId() {
return osTypeId;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,10 @@
@Param(description = "true if storage snapshot is supported for the volume, false otherwise", since = "4.16")
private boolean supportsStorageSnapshot;

@SerializedName(ApiConstants.DELETE_PROTECTION)
@Param(description = "true if volume has delete protection.", since = "4.20.0")
private boolean deleteProtection;

@SerializedName(ApiConstants.PHYSICAL_SIZE)
@Param(description = "the bytes allocated")
private Long physicalsize;
Expand Down Expand Up @@ -584,6 +588,14 @@
return this.supportsStorageSnapshot;
}

public boolean isDeleteProtection() {
return deleteProtection;
}

Check warning on line 593 in api/src/main/java/org/apache/cloudstack/api/response/VolumeResponse.java

View check run for this annotation

Codecov / codecov/patch

api/src/main/java/org/apache/cloudstack/api/response/VolumeResponse.java#L591-L593

Added lines #L591 - L593 were not covered by tests

public void setDeleteProtection(boolean deleteProtection) {
this.deleteProtection = deleteProtection;
}

Check warning on line 597 in api/src/main/java/org/apache/cloudstack/api/response/VolumeResponse.java

View check run for this annotation

Codecov / codecov/patch

api/src/main/java/org/apache/cloudstack/api/response/VolumeResponse.java#L595-L597

Added lines #L595 - L597 were not covered by tests

public String getIsoId() {
return isoId;
}
Expand Down
12 changes: 12 additions & 0 deletions engine/schema/src/main/java/com/cloud/storage/VolumeVO.java
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,9 @@
@Column(name = "encrypt_format")
private String encryptFormat;

@Column(name = "delete_protection")
private boolean deleteProtection;


// Real Constructor
public VolumeVO(Type type, String name, long dcId, long domainId,
Expand Down Expand Up @@ -678,4 +681,13 @@
public String getEncryptFormat() { return encryptFormat; }

public void setEncryptFormat(String encryptFormat) { this.encryptFormat = encryptFormat; }

@Override
public boolean isDeleteProtection() {
return deleteProtection;
}

Check warning on line 688 in engine/schema/src/main/java/com/cloud/storage/VolumeVO.java

View check run for this annotation

Codecov / codecov/patch

engine/schema/src/main/java/com/cloud/storage/VolumeVO.java#L686-L688

Added lines #L686 - L688 were not covered by tests

public void setDeleteProtection(boolean deleteProtection) {
this.deleteProtection = deleteProtection;
}

Check warning on line 692 in engine/schema/src/main/java/com/cloud/storage/VolumeVO.java

View check run for this annotation

Codecov / codecov/patch

engine/schema/src/main/java/com/cloud/storage/VolumeVO.java#L690-L692

Added lines #L690 - L692 were not covered by tests
}
14 changes: 10 additions & 4 deletions engine/schema/src/main/java/com/cloud/vm/VMInstanceVO.java
Original file line number Diff line number Diff line change
Expand Up @@ -167,10 +167,8 @@
@Column(name = "dynamically_scalable")
protected boolean dynamicallyScalable;

/*
@Column(name="tags")
protected String tags;
*/
@Column(name = "delete_protection")
protected boolean deleteProtection;

@Transient
Map<String, String> details;
Expand Down Expand Up @@ -542,6 +540,14 @@
return dynamicallyScalable;
}

public boolean isDeleteProtection() {
return deleteProtection;
}

Check warning on line 545 in engine/schema/src/main/java/com/cloud/vm/VMInstanceVO.java

View check run for this annotation

Codecov / codecov/patch

engine/schema/src/main/java/com/cloud/vm/VMInstanceVO.java#L543-L545

Added lines #L543 - L545 were not covered by tests

public void setDeleteProtection(boolean deleteProtection) {
this.deleteProtection = deleteProtection;
}

Check warning on line 549 in engine/schema/src/main/java/com/cloud/vm/VMInstanceVO.java

View check run for this annotation

Codecov / codecov/patch

engine/schema/src/main/java/com/cloud/vm/VMInstanceVO.java#L547-L549

Added lines #L547 - L549 were not covered by tests

@Override
public Class<?> getEntityType() {
return VirtualMachine.class;
Expand Down
6 changes: 5 additions & 1 deletion engine/schema/src/main/java/com/cloud/vm/dao/UserVmDao.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,11 @@ public interface UserVmDao extends GenericDao<UserVmVO, Long> {
* @param hostName TODO
* @param instanceName
*/
void updateVM(long id, String displayName, boolean enable, Long osTypeId, String userData, Long userDataId, String userDataDetails, boolean displayVm, boolean isDynamicallyScalable, String customId, String hostName, String instanceName);
void updateVM(long id, String displayName, boolean enable, Long osTypeId,
String userData, Long userDataId, String userDataDetails,
boolean displayVm, boolean isDynamicallyScalable,
boolean deleteProtection, String customId, String hostName,
String instanceName);

List<UserVmVO> findDestroyedVms(Date date);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -274,8 +274,11 @@
}

@Override
public void updateVM(long id, String displayName, boolean enable, Long osTypeId, String userData, Long userDataId, String userDataDetails, boolean displayVm,
boolean isDynamicallyScalable, String customId, String hostName, String instanceName) {
public void updateVM(long id, String displayName, boolean enable, Long osTypeId,
String userData, Long userDataId, String userDataDetails,
boolean displayVm, boolean isDynamicallyScalable,
boolean deleteProtection, String customId, String hostName,
String instanceName) {

Check warning on line 281 in engine/schema/src/main/java/com/cloud/vm/dao/UserVmDaoImpl.java

View check run for this annotation

Codecov / codecov/patch

engine/schema/src/main/java/com/cloud/vm/dao/UserVmDaoImpl.java#L281

Added line #L281 was not covered by tests
UserVmVO vo = createForUpdate();
vo.setDisplayName(displayName);
vo.setHaEnabled(enable);
Expand All @@ -285,6 +288,7 @@
vo.setUserDataDetails(userDataDetails);
vo.setDisplayVm(displayVm);
vo.setDynamicallyScalable(isDynamicallyScalable);
vo.setDeleteProtection(deleteProtection);

Check warning on line 291 in engine/schema/src/main/java/com/cloud/vm/dao/UserVmDaoImpl.java

View check run for this annotation

Codecov / codecov/patch

engine/schema/src/main/java/com/cloud/vm/dao/UserVmDaoImpl.java#L291

Added line #L291 was not covered by tests
if (hostName != null) {
vo.setHostName(hostName);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -239,3 +239,6 @@ INSERT IGNORE INTO `cloud`.`hypervisor_capabilities` (uuid, hypervisor_type, hyp
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', '8.0.2', guest_os_name, guest_os_id, utc_timestamp(), 0 FROM `cloud`.`guest_os_hypervisor` WHERE hypervisor_type='VMware' AND hypervisor_version='8.0';
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', '8.0.3', 1024, 0, 59, 64, 1, 1);
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', '8.0.3', guest_os_name, guest_os_id, utc_timestamp(), 0 FROM `cloud`.`guest_os_hypervisor` WHERE hypervisor_type='VMware' AND hypervisor_version='8.0';

CALL `cloud`.`IDEMPOTENT_ADD_COLUMN`('cloud.vm_instance', 'delete_protection', 'boolean DEFAULT FALSE COMMENT "delete protection for vm" ');
CALL `cloud`.`IDEMPOTENT_ADD_COLUMN`('cloud.volumes', 'delete_protection', 'boolean DEFAULT FALSE COMMENT "delete protection for volumes" ');
Comment on lines +243 to +244
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question - will it make a lot of difference if these flags are stored as details in vm_details/volume_details tables?

Copy link
Member Author

@vishesh92 vishesh92 Sep 6, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think it will create a lot of impact. Just a few extra queries & joins to check the value from details table.

Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ SELECT
`vm_instance`.`instance_name` AS `instance_name`,
`vm_instance`.`guest_os_id` AS `guest_os_id`,
`vm_instance`.`display_vm` AS `display_vm`,
`vm_instance`.`delete_protection` AS `delete_protection`,
`guest_os`.`uuid` AS `guest_os_uuid`,
`vm_instance`.`pod_id` AS `pod_id`,
`host_pod_ref`.`uuid` AS `pod_uuid`,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ SELECT
`volumes`.`chain_info` AS `chain_info`,
`volumes`.`external_uuid` AS `external_uuid`,
`volumes`.`encrypt_format` AS `encrypt_format`,
`volumes`.`delete_protection` AS `delete_protection`,
`account`.`id` AS `account_id`,
`account`.`uuid` AS `account_uuid`,
`account`.`account_name` AS `account_name`,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -935,6 +935,11 @@
volumeVO.setEncryptFormat(encryptFormat);
}

@Override
public boolean isDeleteProtection() {
return volumeVO.isDeleteProtection();
}

Check warning on line 941 in engine/storage/volume/src/main/java/org/apache/cloudstack/storage/volume/VolumeObject.java

View check run for this annotation

Codecov / codecov/patch

engine/storage/volume/src/main/java/org/apache/cloudstack/storage/volume/VolumeObject.java#L939-L941

Added lines #L939 - L941 were not covered by tests

@Override
public boolean isFollowRedirects() {
return followRedirects;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -425,6 +425,12 @@
userVmResponse.setDynamicallyScalable(userVm.isDynamicallyScalable());
}

if (userVm.getDeleteProtection() == null) {
userVmResponse.setDeleteProtection(false);

Check warning on line 429 in server/src/main/java/com/cloud/api/query/dao/UserVmJoinDaoImpl.java

View check run for this annotation

Codecov / codecov/patch

server/src/main/java/com/cloud/api/query/dao/UserVmJoinDaoImpl.java#L429

Added line #L429 was not covered by tests
} else {
userVmResponse.setDeleteProtection(userVm.getDeleteProtection());
}

if (userVm.getAutoScaleVmGroupName() != null) {
userVmResponse.setAutoScaleVmGroupName(userVm.getAutoScaleVmGroupName());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,12 @@
volResponse.setMinIops(volume.getMinIops());
volResponse.setMaxIops(volume.getMaxIops());

if (volume.getDeleteProtection() == null) {
volResponse.setDeleteProtection(false);

Check warning on line 142 in server/src/main/java/com/cloud/api/query/dao/VolumeJoinDaoImpl.java

View check run for this annotation

Codecov / codecov/patch

server/src/main/java/com/cloud/api/query/dao/VolumeJoinDaoImpl.java#L142

Added line #L142 was not covered by tests
} else {
volResponse.setDeleteProtection(volume.getDeleteProtection());

Check warning on line 144 in server/src/main/java/com/cloud/api/query/dao/VolumeJoinDaoImpl.java

View check run for this annotation

Codecov / codecov/patch

server/src/main/java/com/cloud/api/query/dao/VolumeJoinDaoImpl.java#L144

Added line #L144 was not covered by tests
}

volResponse.setCreated(volume.getCreated());
if (volume.getState() != null) {
volResponse.setState(volume.getState().toString());
Expand Down
6 changes: 6 additions & 0 deletions server/src/main/java/com/cloud/api/query/vo/UserVmJoinVO.java
Original file line number Diff line number Diff line change
Expand Up @@ -433,6 +433,9 @@
@Column(name = "dynamically_scalable")
private boolean isDynamicallyScalable;

@Column(name = "delete_protection")
protected Boolean deleteProtection;


public UserVmJoinVO() {
// Empty constructor
Expand Down Expand Up @@ -939,6 +942,9 @@
return isDynamicallyScalable;
}

public Boolean getDeleteProtection() {
return deleteProtection;
}

Check warning on line 947 in server/src/main/java/com/cloud/api/query/vo/UserVmJoinVO.java

View check run for this annotation

Codecov / codecov/patch

server/src/main/java/com/cloud/api/query/vo/UserVmJoinVO.java#L945-L947

Added lines #L945 - L947 were not covered by tests

@Override
public Class<?> getEntityType() {
Expand Down
7 changes: 7 additions & 0 deletions server/src/main/java/com/cloud/api/query/vo/VolumeJoinVO.java
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,9 @@
@Column(name = "encrypt_format")
private String encryptionFormat = null;

@Column(name = "delete_protection")
protected Boolean deleteProtection;

public VolumeJoinVO() {
}

Expand Down Expand Up @@ -619,6 +622,10 @@
return encryptionFormat;
}

public Boolean getDeleteProtection() {
return deleteProtection;
}

Check warning on line 627 in server/src/main/java/com/cloud/api/query/vo/VolumeJoinVO.java

View check run for this annotation

Codecov / codecov/patch

server/src/main/java/com/cloud/api/query/vo/VolumeJoinVO.java#L625-L627

Added lines #L625 - L627 were not covered by tests

@Override
public Class<?> getEntityType() {
return Volume.class;
Expand Down
16 changes: 14 additions & 2 deletions server/src/main/java/com/cloud/storage/VolumeApiServiceImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -1696,6 +1696,12 @@
}

public void validateDestroyVolume(Volume volume, Account caller, boolean expunge, boolean forceExpunge) {
if (volume.isDeleteProtection()) {
throw new InvalidParameterValueException(String.format(

Check warning on line 1700 in server/src/main/java/com/cloud/storage/VolumeApiServiceImpl.java

View check run for this annotation

Codecov / codecov/patch

server/src/main/java/com/cloud/storage/VolumeApiServiceImpl.java#L1700

Added line #L1700 was not covered by tests
"Volume [id = %s, name = %s] has delete protection enabled and cannot be deleted.",
volume.getUuid(), volume.getName()));

Check warning on line 1702 in server/src/main/java/com/cloud/storage/VolumeApiServiceImpl.java

View check run for this annotation

Codecov / codecov/patch

server/src/main/java/com/cloud/storage/VolumeApiServiceImpl.java#L1702

Added line #L1702 was not covered by tests
}

if (expunge) {
// When trying to expunge, permission is denied when the caller is not an admin and the AllowUserExpungeRecoverVolume is false for the caller.
final Long userId = caller.getAccountId();
Expand Down Expand Up @@ -2737,13 +2743,15 @@

@Override
@ActionEvent(eventType = EventTypes.EVENT_VOLUME_UPDATE, eventDescription = "updating volume", async = true)
public Volume updateVolume(long volumeId, String path, String state, Long storageId, Boolean displayVolume,
public Volume updateVolume(long volumeId, String path, String state, Long storageId,
Boolean displayVolume, Boolean deleteProtection,
String customId, long entityOwnerId, String chainInfo, String name) {

Account caller = CallContext.current().getCallingAccount();
if (!_accountMgr.isRootAdmin(caller.getId())) {
if (path != null || state != null || storageId != null || displayVolume != null || customId != null || chainInfo != null) {
throw new InvalidParameterValueException("The domain admin and normal user are not allowed to update volume except volume name");
throw new InvalidParameterValueException("The domain admin and normal user are " +

Check warning on line 2753 in server/src/main/java/com/cloud/storage/VolumeApiServiceImpl.java

View check run for this annotation

Codecov / codecov/patch

server/src/main/java/com/cloud/storage/VolumeApiServiceImpl.java#L2753

Added line #L2753 was not covered by tests
"not allowed to update volume except volume name & delete protection");
}
}

Expand Down Expand Up @@ -2795,6 +2803,10 @@
volume.setName(name);
}

if (deleteProtection != null) {
volume.setDeleteProtection(deleteProtection);

Check warning on line 2807 in server/src/main/java/com/cloud/storage/VolumeApiServiceImpl.java

View check run for this annotation

Codecov / codecov/patch

server/src/main/java/com/cloud/storage/VolumeApiServiceImpl.java#L2807

Added line #L2807 was not covered by tests
}

updateDisplay(volume, displayVolume);

_volsDao.update(volumeId, volume);
Expand Down
10 changes: 8 additions & 2 deletions server/src/main/java/com/cloud/vm/UserVmManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,14 @@ boolean upgradeVirtualMachine(Long id, Long serviceOfferingId, Map<String, Strin

boolean setupVmForPvlan(boolean add, Long hostId, NicProfile nic);

UserVm updateVirtualMachine(long id, String displayName, String group, Boolean ha, Boolean isDisplayVmEnabled, Long osTypeId, String userData,
Long userDataId, String userDataDetails, Boolean isDynamicallyScalable, HTTPMethod httpMethod, String customId, String hostName, String instanceName, List<Long> securityGroupIdList, Map<String, Map<Integer, String>> extraDhcpOptionsMap) throws ResourceUnavailableException, InsufficientCapacityException;
UserVm updateVirtualMachine(long id, String displayName, String group, Boolean ha,
Boolean isDisplayVmEnabled, Boolean deleteProtection,
Long osTypeId, String userData, Long userDataId,
String userDataDetails, Boolean isDynamicallyScalable,
HTTPMethod httpMethod, String customId, String hostName,
String instanceName, List<Long> securityGroupIdList,
Map<String, Map<Integer, String>> extraDhcpOptionsMap
) throws ResourceUnavailableException, InsufficientCapacityException;

//the validateCustomParameters, save and remove CustomOfferingDetils functions can be removed from the interface once we can
//find a common place for all the scaling and upgrading code of both user and systemvms.
Expand Down
Loading
Loading