Skip to content

Conversation

@houthuis
Copy link

Description

TBC

Types of changes

  • Breaking change (fix or feature that would cause existing functionality to change)
  • New feature (non-breaking change which adds functionality)
  • Bug fix (non-breaking change which fixes an issue)
  • Enhancement (improves an existing feature and functionality)
  • Cleanup (Code refactoring and cleanup, that may add test cases)

GitHub Issue/PRs

Screenshots (if appropriate):

How Has This Been Tested?

Checklist:

  • I have read the CONTRIBUTING document.
  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
    Testing
  • I have added tests to cover my changes.
  • All relevant new and existing integration tests have passed.
  • A full integration testsuite with all test that can run on my environment has passed.

@DaanHoogland
Copy link
Member

@houthuis seems ypiu have conflicts, can you resolve those , please?

henko holtzhausen added 5 commits July 31, 2018 15:10
… destroyvm-also-removes-volumes

# Conflicts:
#	api/src/main/java/org/apache/cloudstack/api/ApiConstants.java
#	server/src/main/java/com/cloud/storage/VolumeApiServiceImpl.java
Copy link
Member

@DaanHoogland DaanHoogland left a comment

Choose a reason for hiding this comment

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

looks good


import java.net.MalformedURLException;

import com.cloud.exception.ResourceAllocationException;
Copy link
Member

Choose a reason for hiding this comment

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

why do these imports need reordering?


import org.apache.log4j.Logger;

import com.cloud.event.EventTypes;
Copy link
Member

Choose a reason for hiding this comment

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

no reason to reorder these imports is there?

type = CommandType.LIST,
collectionType = CommandType.UUID,
entityType = VolumeResponse.class,
description = "Comma separated list of volume UUIDs",
Copy link
Member

Choose a reason for hiding this comment

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

I think you want to add to this description whether these are the volumes that will be preserved (or not)

Copy link
Author

Choose a reason for hiding this comment

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

done

import org.apache.cloudstack.api.BaseAsyncCmd;
import org.apache.log4j.Logger;

import com.cloud.event.EventTypes;
Copy link
Member

Choose a reason for hiding this comment

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

no change in imports....

// under the License.
package org.apache.cloudstack.api.command.user.volume;

import org.apache.cloudstack.api.BaseAsyncCmd;
Copy link
Member

Choose a reason for hiding this comment

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

actually this file is not changed safe the reordering of imports, please remove it from the PR

Copy link
Author

Choose a reason for hiding this comment

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

done

}
}

public Volume detachVolumesFromVM(long vmId, long volumeId) {
Copy link
Member

Choose a reason for hiding this comment

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

detachVolumesFromVM() takes only one volumeId so probably use singular in teh method name

Copy link
Author

Choose a reason for hiding this comment

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

refactored to detachVolumeViaDestroyVM(...) to avoid confusion

return expunge;
}

public List<Long> getVolumes() {
Copy link
Member

Choose a reason for hiding this comment

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

getVolume(UU)Ids() ?

Copy link
Author

Choose a reason for hiding this comment

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

done, renamed field + api parameter

}
s_logger.debug("Found no ongoing snapshots on volume of type ROOT, for the vm with id " + vmId);

List<VolumeVO> volumes = new ArrayList<>();
Copy link
Member

@DaanHoogland DaanHoogland Jul 31, 2018

Choose a reason for hiding this comment

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

It would seem that you would first want to destroy the VM and only after try the volumes

private void detachAndDeleteVolumes(List<VolumeVO> volumes) {

for (VolumeVO volume : volumes) {
_volumeService.detachVolumesFromVM(volume.getInstanceId(), volume.getId());
Copy link
Member

Choose a reason for hiding this comment

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

are we stopping if one fails?

}

for (VolumeVO volume : volumes) {
_volumeService.deleteVolume(volume.getId(), CallContext.current().getCallingAccount());
Copy link
Member

Choose a reason for hiding this comment

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

same here: are we stopping if one fails?

collectionType = CommandType.UUID,
entityType = VolumeResponse.class,
description = "Comma separated list of volume UUIDs",
description = "Comma separated list of volume UUIDs that will be deleted",
Copy link
Member

Choose a reason for hiding this comment

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

"Comma separated list of UUIDs for volumes that will be deleted" ?

}

public Volume detachVolumesFromVM(long vmId, long volumeId) {
public Volume detachVolumeViaDestroyVM(long vmId, long volumeId) {
Copy link
Member

Choose a reason for hiding this comment

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

Why would this be specific to destroy vm ? isn't it just a detach method and didn't it already exist?

}
}

public Volume detachVolumeViaDestroyVM(long vmId, long volumeId) {
Copy link
Member

Choose a reason for hiding this comment

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

couple of questions here:
Is this really public? it may a only be called as part of destroy volume!
How different is it really (even being consequential) from regular detachVolumeFromVM? it should at least also fire a detach event to keep usage data in check.


checkForUnattachedVolumes(vmId, volumes);
validateVolumes(volumes);

Copy link
Member

Choose a reason for hiding this comment

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

detach here

}
}

detachAndDeleteVolumes(volumes);
Copy link
Member

Choose a reason for hiding this comment

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

delete detached volumes here


List<VolumeVO> volumes = new ArrayList<>();

if (cmd.getVolumeIds() != null) {
Copy link
Member

Choose a reason for hiding this comment

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

can you extract this bit into a method as well?

}
return false;
}

Copy link
Member

Choose a reason for hiding this comment

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

the below methods can do with unit tests

Copy link
Member

@borisstoyanov borisstoyanov left a comment

Choose a reason for hiding this comment

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

Hi Henko, looking at the attached picture, this is a VM with no volumes attached. I think it'll make sense if the user select the checkbox, instead of display radio buttons of IDs, to display a simple text message 'No Volumes attached.'
screen shot 2018-08-02 at 10 16 20

Copy link
Member

@borisstoyanov borisstoyanov left a comment

Choose a reason for hiding this comment

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

LGTM, all remarks from my side has been addressed.

@borisstoyanov
Copy link
Member

@houthuis I think you're in position to submit this to community now

@houthuis houthuis closed this Aug 6, 2018
@rohityadavcloud
Copy link
Member

@dhlaluku can you pick this up, resubmit the changes?

@dhlaluku
Copy link

dhlaluku commented Jan 6, 2019

@rhtyd I am working on it, I will submit a new PR when it's complete since I can't reopen this one.

shwstppr pushed a commit that referenced this pull request Aug 24, 2020
* Explicitly controlling VMware VM hardware version

* Fix unit test
rohityadavcloud pushed a commit that referenced this pull request Jan 20, 2021
Fixes: #17
Fixes: #18

These dependencies are necessary or eslint will fail with the standard vue.js rule set.
The PR also includes fixes for all lint errors.

Signed-off-by: Rohit Yadav <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants