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

Handle Managed Disk Snapshots #23

Merged
merged 10 commits into from
Aug 30, 2017

Conversation

jerryk55
Copy link
Member

@jerryk55 jerryk55 commented Aug 21, 2017

If the Azure VM has a Managed Disk then use the new Managed Disk
disk module to read its snapshot.

On this go-round the snapshot will only be required for Managed Disks.

This is one of several PRs required to add support for SSA for Managed Disks,
that is is response to the following BZs:
https://bugzilla.redhat.com/show_bug.cgi?id=1475540
and
https://bugzilla.redhat.com/show_bug.cgi?id=1459612

A PR for the azure-armrest gem has already been merged in advance of this:
ManageIQ/azure-armrest#299

A PR for the ManageIQ repo has been added as well to work with this -
ManageIQ/manageiq#15865

A PR for the manageiq-providers-azure repo has also been added.
ManageIQ/manageiq-providers-azure#117

Links

Steps for Testing/QA

Add an Azure VM with a Managed Disk.
Run SmartState Analysis against the VM.

@roliveri @hsong-rh please review.

@roliveri roliveri self-requested a review August 21, 2017 16:03
@roliveri roliveri self-assigned this Aug 21, 2017
Copy link
Member

@roliveri roliveri left a comment

Choose a reason for hiding this comment

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

So the implementation of non-managed disk snapshot support will be delivered in a subsequent PR?

Copy link
Member

@roliveri roliveri left a comment

Choose a reason for hiding this comment

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

Is there anything you can do about the codeclimate issues?

@jerryk55
Copy link
Member Author

@roliveri Yes the non-managed disk snapshot support will be delivered in a subsequent PR after this batch is merged. And I will look at the codeclimate issues.

require_relative '../MiqDisk'
require 'ostruct'

module AzureCommon
Copy link
Member

Choose a reason for hiding this comment

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

@jerryk55 I think this name isn't specific enough. Would AzureDiskCommon be better?

Copy link
Member Author

Choose a reason for hiding this comment

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

@@roliveri good idea. BTW I still have some code climate issues to fix up, and for some reason the math in the spec tests is off. I will work with that in the morning.

If the Azure VM has a Managed Disk then use the new Managed Disk
disk module to read its snapshot.
CodeClimate called out the fact that there was a lot of
duplication between the AzureBlobDisk and AzureManagedDisk modules.
I have added the AzureCommon module to be used by each of the prior
modules to eliminate duplicated code.
Review suggested renaming AzureCommon to AzureDiskCommon.

CodeClimate complained about duplicated code so
AzureDiskCommon code was massaged and
MiqAzureVm had more changes added.
@jerryk55 jerryk55 closed this Aug 25, 2017
@jerryk55 jerryk55 reopened this Aug 25, 2017
@jerryk55 jerryk55 force-pushed the snapshot_azure_managed_disks branch from 7e96658 to 08ac751 Compare August 25, 2017 16:48
Final (hopefully) set of Rubocop complaints after the last set of changes.
@jerryk55
Copy link
Member Author

jerryk55 commented Aug 25, 2017

@roliveri the failure above is intermittent both in Travis and in my appliance when run from the command line. For instance I rebased earlier today and after that Travis passed, then after fixing a Rubcop complaint it failed again. Trying to discern the issue but it is perplexing. Originally CodeClimate complained about 9 issues - its down to 2 now with the issue being slightly duplicated code in the new methods of the two disk modules. I am currently at a loss for the spec test failures. Any suggestions? I will also need to add AzureManagedDisk tests before this should be merged.

@roliveri
Copy link
Member

@jerryk55 It's strange. The numbers being read from the recorded cassettes don't match the expected values. So, unless the cassettes were re-recorded, how could the numbers change? You have to check the code that reads the info from armrest and see if it manipulates the values before returning, (lba, etc).
Maybe that code changed, but then I would think the tests would have failed when the PR for that change was made.

AzureDiskCommon Module needed to be "included" in AzureBlobDisk and
AzureManagedDisk in order to allow methods to be instance-specific rather
than class specific.  This was causing memo-ized values to be set incorrectly
and failures in tests.
@jerryk55
Copy link
Member Author

Ok @roliveri problem with the tests resolved. Still need Managed Disk tests.

Add new Managed Disk Spec Tests and all VCR recordings for the tests.
One test checking the Managed Disk Size was commented out.
Uncommented the test and re-ran the full spec file to re-record
the VCR recordings
@jerryk55
Copy link
Member Author

@roliveri I believe this can be merged now. New tests added and passing.

@jerryk55 jerryk55 closed this Aug 30, 2017
@jerryk55
Copy link
Member Author

Attempting to restart CodeClimate checks.

@jerryk55 jerryk55 reopened this Aug 30, 2017
CodeClimate is complaining about new "new" methods in two Disk Modules
with Mass Thresholds of 24 so we are bumping the config for the
Duplication engine just above that level.
@miq-bot
Copy link
Member

miq-bot commented Aug 30, 2017

Checked commits jerryk55/manageiq-smartstate@5c0c5ad~...6e1c9aa with ruby 2.2.6, rubocop 0.47.1, and haml-lint 0.20.0
5 files checked, 8 offenses detected

lib/MiqVm/miq_azure_vm.rb

lib/disk/modules/AzureBlobDisk.rb

lib/disk/modules/AzureDiskCommon.rb

lib/disk/modules/AzureManagedDisk.rb

@roliveri roliveri merged commit ec8824a into ManageIQ:master Aug 30, 2017
@jerryk55
Copy link
Member Author

jerryk55 commented Sep 5, 2017

@miq-bot add_label fine/yes

@miq-bot
Copy link
Member

miq-bot commented Sep 5, 2017

@jerryk55 Cannot apply the following label because they are not recognized: fine/yes

jerryk55 added a commit to jerryk55/manageiq-gems-pending that referenced this pull request Sep 6, 2017
ManageIQ/manageiq-smartstate#23

and

ManageIQ/manageiq-smartstate#25

were added as part of the work required for blocker bug

https://bugzilla.redhat.com/show_bug.cgi?id=1475540.

This commit and subsequent PR track the backport of the changes into the Fine release.
@simaishi
Copy link
Contributor

simaishi commented Sep 6, 2017

Backported to Fine via ManageIQ/manageiq-gems-pending#267

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.

4 participants