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

Introduce Amazon Block Storage Manager (EBS) #101

Merged
merged 2 commits into from
Jan 17, 2017

Conversation

gberginc
Copy link
Contributor

This commit sets up the core structure of the new AWS EC2 block storage
manager. It provides just the basic stubs and tests that are to be
extended to allow for complete management of Amazon block storage

The refresher collects data about existing volumes and private
snapshots. Volumes are not yet linked to disks of virtual machines
collected by the cloud manager.

Depends on Add storage manager mixins PR from core repo.

@miq-bot add_label enhancement

@gberginc
Copy link
Contributor Author

@aiperon please review

@gberginc
Copy link
Contributor Author

gberginc commented Jan 12, 2017

@agrare @Ladas could ManageIQ/manageiq@d557f19 be affecting travis tests?

     Failure/Error:
       def initialize(inventory)
         @inventory             = inventory
         @inventory_collections = inventory.inventory_collections
       end
     
     ArgumentError:
       wrong number of arguments (given 2, expected 1)

Is there any doc on how to approach the refresh parsers now?

@agrare
Copy link
Member

agrare commented Jan 12, 2017

@gberginc yeah it is failing for one of my branches using InventoryObjectRefresh refresh also.
@Ladas can you change RefreshParserInventoryObject so it doesn't have to use the experimental inventory abstraction?

@gberginc
Copy link
Contributor Author

Now that you mentioned another branch, I checked also other PRs in Amazon repo and noticed the one from @Ladas #102.

I guess it's best to wait until #102 is passing and then ensure storage manager is using the same approach.

@Ladas Ladas self-assigned this Jan 13, 2017
@miq-bot
Copy link
Member

miq-bot commented Jan 13, 2017

This pull request is not mergeable. Please rebase and repush.

This commit sets up the core structure of the new AWS EC2 block storage
manager. It provides just the basic stubs and tests that are to be
extended to allow for complete management of Amazon block storage

The refresher collects data about existing volumes and private
snapshots. Volumes are not yet linked to disks of virtual machines
collected by the cloud manager.

Signed-off-by: Gregor Berginc <gregor.berginc@xlab.si>
@Ladas
Copy link
Contributor

Ladas commented Jan 13, 2017

@gberginc the CI should be fixed, but I've caused a conflict in the specs, you'll need to rebase

@gberginc
Copy link
Contributor Author

@Ladas thanks. The conflict is simple to resolve as just the number of ext_management_systems is different. However I guess it would be better to use the same approach for storage manager as it is for cloud/network. I'll try to update the PR.

Another thing I wanted to ask: I currently only use stubbed specs, but there are also those that are using actual AWS account - how should I approach this as using our account will change the VCR as well as all the existing spec data.

@Ladas
Copy link
Contributor

Ladas commented Jan 13, 2017

@gberginc cool

So the VCR kinda sucks there, because we have a VCR env, that we use for that. So option would be that I would record it for you, once you are ready, or we would share some readonly creds for the VCR env. So for now, I think easiest will be that I will record and send the VCRs, once you have all the API calls in place.

We were thinking about getting away from the VCRs and just use stubbed specs, but then it's nice to have a spec that is using real env. data.

@gberginc
Copy link
Contributor Author

@Ladas I've just added additional commit for the inventory object support. I am not sure if you are the one to review this PR (if not, please let me know so that I can ask someone else).

Regarding VCR recording: do I understand correctly, I should now add EmsRefresh.refresh(@ems.block_storage_manager) everywhere VCR cassettes are used, for example:

https://github.com/ManageIQ/manageiq-providers-amazon/blob/master/spec/models/manageiq/providers/amazon/cloud_manager/refresher_inventory_object_spec.rb#L38

Then you run the spec and share the VCR with me so that I can update the actual tests?

@Ladas
Copy link
Contributor

Ladas commented Jan 13, 2017

@gberginc I'll do the review

Regarding the VCR, yes, lets do the VCR specs as a next PR

@chargio
Copy link

chargio commented Jan 16, 2017

Hey @Ladas, did you review it?

@gberginc
Copy link
Contributor Author

I think this is partly dependent on the current changes to the refresh parsers, #105.

I would nevertheless appreciate feedback to continue working on storage managers.

end

private
def get_volumes
Copy link
Contributor

Choose a reason for hiding this comment

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

We're using the same parsing code for RefreshParser and RefreshParserInventoryObject.
Wouldn't it be better if we move it into ManageIQ::Providers::Amazon::RefreshHelperMethods ?

Copy link
Contributor

Choose a reason for hiding this comment

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

there is a slight difference in the parsing code. But yeah, we can abstract the parsing part. But that can be done in another PR.

But my goal is to deprecate/delete the old parsing code and use the new one, so maybe it won't be needed. :-)

end
end


Copy link
Contributor

Choose a reason for hiding this comment

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

extra blank lines

inventory_collections
end

private
Copy link
Contributor

Choose a reason for hiding this comment

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

blank line before and after private

block_storage_manager.name = "#{name} Block Storage Manager"
block_storage_manager.zone_id = zone_id
block_storage_manager.provider_region = provider_region
true
Copy link
Contributor

Choose a reason for hiding this comment

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

why we return true?

@@ -54,6 +72,14 @@ def ensure_managers
network_manager.provider_region = provider_region
end

def ensure_block_storage_managers
build_block_storage_manager unless block_storage_manager
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we can just put this body to ensure_managers. Or calling this from the body of ensure_managers, then we should extract the current into :ensure_network_manager, then add :ensure_block_storage_manager

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@Ladas I've merged the two into ensure_managers as there is currently no need to have them separated. I also fixed the other rubocop issues.

@Ladas
Copy link
Contributor

Ladas commented Jan 17, 2017

@gberginc just few nits, mostly rubocop that should be fixed. After that I am ready to merge, so we can move forward. :-)

Similarly to
ManageIQ#102 this
patch adds support for inventory collection using inventory abstraction.
Corresponding targets as well as the refresh parser inventory object. It
mimics existing cloud and network managers.

Signed-off-by: Gregor Berginc <gregor.berginc@xlab.si>
@miq-bot
Copy link
Member

miq-bot commented Jan 17, 2017

Checked commits gberginc/manageiq-providers-amazon@db2a32f~...66465a6 with ruby 2.2.6, rubocop 0.46.0, and haml-lint 0.19.0
18 files checked, 17 offenses detected

app/models/manageiq/providers/amazon/block_storage_manager/refresh_parser.rb

app/models/manageiq/providers/amazon/block_storage_manager/refresh_parser_inventory_object.rb

app/models/manageiq/providers/amazon/block_storage_manager/refresher.rb

app/models/manageiq/providers/amazon/inventory/targets/block_storage_manager.rb

spec/models/manageiq/providers/amazon/aws_stubs.rb

  • ❗ - Line 367, Col 36 - Rails/TimeZone - Do not use Time.now without zone. Use one of Time.zone.now, Time.current, Time.now.in_time_zone, Time.now.utc, Time.now.getlocal, Time.now.iso8601, Time.now.jisx0301, Time.now.rfc3339, Time.now.to_i, Time.now.to_f instead.
  • ❗ - Line 384, Col 30 - Rails/TimeZone - Do not use Time.now without zone. Use one of Time.zone.now, Time.current, Time.now.in_time_zone, Time.now.utc, Time.now.getlocal, Time.now.iso8601, Time.now.jisx0301, Time.now.rfc3339, Time.now.to_i, Time.now.to_f instead.

spec/models/manageiq/providers/amazon/block_storage_manager/stubbed_refresher_spec.rb

@gberginc
Copy link
Contributor Author

@Ladas I amended the commit, so the following comment is not visible. Just reposting to make sure it doesn't get lost.

I've merged the two into ensure_managers as there is currently no need to have them separated. I also fixed the other rubocop issues - I think the remaining issues can be left as they are following existing code.

@Ladas
Copy link
Contributor

Ladas commented Jan 17, 2017

@gberginc awesome :-) Thank you for a great contribution.

Yeah, the rest of the robocop warnings are on the edge of a correctness. :-)

@Ladas Ladas merged commit 599a744 into ManageIQ:master Jan 17, 2017
@Ladas Ladas added the euwe/no label Jan 17, 2017
@chargio
Copy link

chargio commented Jan 17, 2017

👍

@roliveri
Copy link
Member

@gberginc @Ladas @Fryguy Actually, this shouldn't have been merged yet. We've been naming managers based on concrete names instead of type. This enables providers to support different/multiple implementations of the same type of manager. So, I would suggest a name change.

From:

ManageIQ::Providers::Amazon::BlockStorageManager < ManageIQ::Providers::StorageManager

To:

ManageIQ::Providers::Amazon:: StorageManager::EBS < ManageIQ::Providers::StorageManager

@gberginc
Copy link
Contributor Author

@roliveri do you think we could proceed with the pending PRs on the manageiq repo and then introduce this change now that it's merged?

@roliveri
Copy link
Member

@gberginc Is there a benefit in doing that? It seems that 2 of the pending PRs rely on the same naming scheme:

ManageIQ/manageiq#13458
ManageIQ/manageiq#13457

So I would make the same comment on those. If I merge those, you'll only have to submit new PRs updating those as well.

@gberginc
Copy link
Contributor Author

@roliveri the only consideration was that ManageIQ/manageiq was failing tests because of this merge. I though it would be faster to make the existing PRs merged and then do a followup patch that would fix the names.

@roliveri
Copy link
Member

@gberginc Ah, i see. It looks like ManageIQ/manageiq#13458 has been merged, and doing so has fixed the test failures.

So, ManageIQ/manageiq#13457 remains. I can hold off merging that until the names are fixed, or I can merge it, but then I'd like for you to open a Github issue for the name change - just to make sure it doesn't get overlooked.

let me know which way you'd like to go.

@gberginc
Copy link
Contributor Author

@roliveri I already started on renaming the class. I therefore suggest you wait with the worker as it is not required for functional test.

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.

7 participants