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

Support base snapshot for EBS cloud volume provisioning #1324

Merged
merged 1 commit into from
Jun 1, 2017

Conversation

sasoc
Copy link
Contributor

@sasoc sasoc commented May 10, 2017

Add option to create new cloud volume from snapshot for AWS EBS Storage Maneger.
new_cloud_volume_form_with_snapshot_option

@miq-bot miq-bot added the wip label May 10, 2017
Copy link
Contributor

@gberginc gberginc left a comment

Choose a reason for hiding this comment

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

@sasoc thanks!

Please, review the comments. Also attach a screenshot showing creation of Amazon cloud volume (attach it into the PR body).

@@ -113,7 +113,7 @@ ManageIQ.angular.app.controller('cloudVolumeFormController', ['miqService', 'API

vm.storageManagerChanged = function(id) {
miqService.sparkleOn();
API.get('/api/providers/' + id + '?attributes=type,parent_manager.availability_zones,parent_manager.cloud_tenants')
API.get('/api/providers/' + id + '?attributes=type,parent_manager.availability_zones,parent_manager.cloud_volume_snapshots,parent_manager.cloud_tenants')
Copy link
Contributor

Choose a reason for hiding this comment

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

Add the change to the end of the API call.

@@ -213,6 +213,7 @@ ManageIQ.angular.app.controller('cloudVolumeFormController', ['miqService', 'API
// model attribute with AWS.
vm.cloudVolumeModel.aws_volume_type = data.volume_type;
vm.cloudVolumeModel.aws_availability_zone_id = data.availability_zone.ems_ref;
//vm.cloudVolumeModel.aws_cloud_volume_snapshot_id = data.cloud_volume_snapshot_id;
Copy link
Contributor

Choose a reason for hiding this comment

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

The snapshot id should be set here so that, when editing the volume, the snapshot will be displayed. The ID should be returned by the current API call.

"data-live-search" => "true",
"pf-select" => true}
%option{"value" => "", "enabled" => ""}
= "#{_('No snapshot')}"
Copy link
Contributor

Choose a reason for hiding this comment

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

You can change this to = _('No snapshot') since you are not rendering any other chars, like < and > in other cases.

"ng-options" => "vs.ems_ref as vs.name for vs in vm.cloudVolumeSnapshotChoices",
"ng-disabled" => "!vm.newRecord",
:checkchange => true,
"data-live-search" => "true",
Copy link
Contributor

Choose a reason for hiding this comment

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

Align all => to the widest key name.

@@ -49,6 +49,20 @@
%span.help-block{"ng-show" => "angularForm.aws_availability_zone_id.$error.required"}
= _("Required")

.form-group{"ng-if" => "vm.cloudVolumeModel.emstype == 'ManageIQ::Providers::Amazon::StorageManager::Ebs'"}
Copy link
Contributor

Choose a reason for hiding this comment

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

Move this just in front of "Encryption" at the bottom.

@gberginc
Copy link
Contributor

@miq-bot add_label storage,enhancement

@@ -693,6 +693,7 @@ def form_params_create
# Only set IOPS if io1 (provisioned IOPS) and IOPS available
options[:iops] = params[:aws_iops] if options[:volume_type] == 'io1' && params[:aws_iops]
options[:availability_zone] = params[:aws_availability_zone_id] if params[:aws_availability_zone_id]
options[:snapshot_id] = params[:aws_cloud_volume_snapshot_id] if params[:aws_cloud_volume_snapshot_id]
Copy link
Contributor

Choose a reason for hiding this comment

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

Now that we are using base_snapshot properly from the API, I suggest you rename this to aws_base_snapshot

@sasoc sasoc force-pushed the add_snapshot_to_new_cloud_volume branch from 88f1dd3 to 18face2 Compare May 17, 2017 09:32
@sasoc sasoc force-pushed the add_snapshot_to_new_cloud_volume branch from 18face2 to 2b1d1e0 Compare May 22, 2017 09:22
@@ -110,6 +110,20 @@
%span.help-block{"ng-show" => "vm.cloudVolumeModel.aws_volume_type == 'io1' && angularForm.aws_iops.$error.required"}
= _("Required")

.form-group{"ng-if" => "vm.cloudVolumeModel.emstype == 'ManageIQ::Providers::Amazon::StorageManager::Ebs'"}
Copy link
Contributor

Choose a reason for hiding this comment

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

Remove unnecessary spaces between "ng-if" and =>.

"ng-options" => "vs.ems_ref as vs.name for vs in vm.baseSnapshotChoices",
"ng-disabled" => "!vm.newRecord",
:checkchange => true,
"data-live-search" => "true",
Copy link
Contributor

Choose a reason for hiding this comment

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

Does it work with true (instead of "true")?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It doesn't work with true instead of "true".

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks

@sasoc sasoc force-pushed the add_snapshot_to_new_cloud_volume branch from 2b1d1e0 to fe5aa2b Compare May 22, 2017 09:50
@@ -112,6 +112,20 @@

.form-group{"ng-if" => "vm.cloudVolumeModel.emstype == 'ManageIQ::Providers::Amazon::StorageManager::Ebs'"}
%label.col-md-2.control-label
= _('Cloud Snapshot')
Copy link
Contributor

Choose a reason for hiding this comment

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

Sorry, but I've missed this one before: please replace this with Base Snapshot.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No problem

@sasoc sasoc force-pushed the add_snapshot_to_new_cloud_volume branch from fe5aa2b to 48f5015 Compare May 22, 2017 10:07
@gberginc
Copy link
Contributor

Thanks @sasoc!

@bronaghs LGTM, but a review from you or the UI team (Aparna?) would be appreciated.

@miq-bot remove_label wip

@miq-bot miq-bot changed the title [WIP] Support base snapshot for EBS cloud volume provisioning Support base snapshot for EBS cloud volume provisioning May 22, 2017
@miq-bot miq-bot removed the wip label May 22, 2017
@bronaghs
Copy link

@sasoc -
I see this screen prompts the user for an IOPs and an Encrypted value. There are currently no columns for these values in the DB, that depends on ManageIQ/manageiq#14704 being merged. Am I missing something?

@bronaghs
Copy link

@miq-bot assign @AparnaKarve

@miq-bot miq-bot assigned AparnaKarve and unassigned bronaghs May 25, 2017
@gberginc
Copy link
Contributor

@bronaghs the UI shows these two properties because it allows users to specify them when creating new volumes. The referenced PR from the core will allow us to show these properties while editing cloud volume.

Both IOPS and Encrypted fields are already merged in the UI repo. @sasoc just added the base snapshot field.

@AparnaKarve
Copy link
Contributor

I got this error because I selected Yes for Encryption.

screen shot 2017-05-25 at 11 47 13 am

Just wanted to know if it is possible to determine beforehand if Encryption=true is not supported for a given snapshot?

@gberginc
Copy link
Contributor

No, unfortunatelly not until we update the models :(. I wanted to make this change already, but since the PR on the master has not been accepted, I waited as I wasn't sure if I am doing it correctly.

@AparnaKarve
Copy link
Contributor

@gberginc Regarding the CC error Cyclomatic complexity for form_params_create is too high. [12/11] , I was wondering if we could break down the form_params_create method into smaller sections? Something to this effect?

when "ManageIQ::Providers::StorageManager::CinderManager"
  options = cinder_manager_options
when "ManageIQ::Providers::Amazon::StorageManager::Ebs"
  options = aws_ebs_options

@gberginc
Copy link
Contributor

@AparnaKarve this would make sense. We'll check what would be the best way because some options are common. Prehaps we extend the options with provider specific ones not to duplicate the common logic.

@sasoc sasoc force-pushed the add_snapshot_to_new_cloud_volume branch 3 times, most recently from f09b950 to 7d576c0 Compare May 31, 2017 12:00
@sasoc
Copy link
Contributor Author

sasoc commented May 31, 2017

@AparnaKarve I've broken form_params_create into smaller sections as you suggested. Can you please look into it?

Add option to create new cloud volume from snapshot for AWS EBS Storage Maneger.
@sasoc sasoc force-pushed the add_snapshot_to_new_cloud_volume branch from 7d576c0 to 07e3b5e Compare May 31, 2017 15:19
@miq-bot
Copy link
Member

miq-bot commented May 31, 2017

Checked commit sasoc@07e3b5e with ruby 2.2.6, rubocop 0.47.1, and haml-lint 0.20.0
1 file checked, 0 offenses detected
Everything looks fine. 🍰

@AparnaKarve
Copy link
Contributor

@sasoc That looks good, and it has also addressed the cyclomatic complexity CC error. Thanks.

@gberginc About the error in #1324 (comment), do you think we can address it once the model changes are in?

@gberginc
Copy link
Contributor

@AparnaKarve that error message will require model changes. We still have just two PRs for the changes in the cloud volume. @sasoc fixed the tests, but unfortunately, they still haven't been merged.

Would you propose that we simply add the PRs for the snapshots as well?

@AparnaKarve
Copy link
Contributor

@gberginc Can you post the PR links here, the one with the model changes?

@gberginc
Copy link
Contributor

@AparnaKarve

PR in core: ManageIQ/manageiq#14704
PR in Amazon provider: ManageIQ/manageiq-providers-amazon#211

Both are just for the cloud volumes, but the idea for snapshots will be the same: update the model and extend the inventory.

@AparnaKarve
Copy link
Contributor

@gberginc I think we should get this in since the Cloud Volume creation from a snapshot does work.

Let's revisit #1324 (comment) once the necessary model PRs are merged in.

@AparnaKarve
Copy link
Contributor

@dclarizio I think we can go ahead and merge this.

If we address the issue described in #1324 (comment), it will improve the user experience, and is not a bug as such.
Also, it would require some model changes before we can consider a fix for it.

@dclarizio dclarizio merged commit 4f15973 into ManageIQ:master Jun 1, 2017
@dclarizio dclarizio added this to the Sprint 62 Ending Jun 5, 2017 milestone Jun 1, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants