-
Notifications
You must be signed in to change notification settings - Fork 60
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
Correct and update disk information #158
Conversation
I'm not sure we should even fall back to the flavor disk size if that is the maximum size that can be allocated to the OS Disk, not the actual. |
@bronaghs ok, will just default to 0 if it doesn't have the expected property then. |
Looks like this need VCR updates (I saw WIP, but thought I'd be proactive 😸) |
end | ||
|
||
def add_azure_instance_disk(array, instance, os_disk = nil) | ||
os_disk ||= instance.properties.storage_profile.os_disk | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the right side will only parse for OS Disks, can you pass in the OS Disk like you pass in the data disk so this isn't needed?
storage_key = storage_keys['key1'] || storage_keys['key2'] | ||
blob_props = storage_acct.blob_properties(container_name, blob_name, storage_key) | ||
disk_size = blob_props.content_length.to_i | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why would disk size be nil? I would love to avoid the complexities around lines 389 - 392
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I haven't completely nailed down why some vm's include the disk size in their storage profile, and why some don't, but it must have something to do with the way they were provisioned, or possibly even when they were provisioned. Or it could have something to do with the OS. In any case, I cannot predict it at this time.
You can see the difference by running the following commands on the CLI:
az vm show -n miq-test-win12 -g miq-azure-test1 # This doesn't show a disk size.
az vm show -n dberger1 -g dberger1 # This does show a disk size
|
||
# No data availbale on swap disk? Called temp or resource disk. | ||
array << disk | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@djberg96
Until I dug deep, it looked like this method add_azure_instance_disk
accepts a data disk as the third parameter yet only parses OS disks. Upon closer review, it looks like data disks will be parsed correctly. Can you rename the osDisk
variable to disk
to avoid confusion?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure thing.
end | ||
|
||
def add_azure_instance_disk(array, instance, os_disk = nil) | ||
os_disk ||= instance.properties.storage_profile.os_disk |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why did you insert the string azure
into the method name? Its implied that this applies to Azure.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can rename it. I didn't want to use add_instance_disk
since it's inherited, but I guess there's no harm in just redefining it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yea you could override it.
filter = "resourceType eq '#{resource_type}'" | ||
@res.list_all(:filter => filter) | ||
end | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this method used?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, I thought I removed it. The original plan was to use the ResourceService since it has a smaller footprint, until I discovered that it did not include the information that I needed.
::Azure::Armrest::ResourceService.new(config).tap do |service| | ||
service.api_version = Settings.ems.ems_azure.api_versions.resource.to_s | ||
end | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this method used?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ditto as above, will remove.
@bronaghs Ok, I think I've made all the requested changes. |
# Redefine the inherited method for our purposes | ||
def add_instance_disk(array, instance, disk = nil) | ||
disk ||= instance.properties.storage_profile.os_disk | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you pass the OS Disk in as a parameter so its the same as you do for data disks? This line is OS disk specific yet the method is used for all disks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, done.
vhd_loc = os_disk.try(:vhd).try(:uri) || os_disk.try(:managed_disk).try(:id) | ||
add_instance_disk(hardware_hash[:disks], instance) | ||
|
||
# No data available on swap disk? Called temp or resource disk. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you delete this comment?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
@@ -350,13 +353,55 @@ def populate_hardware_hash_with_series_attributes(hardware_hash, instance, serie | |||
hardware_hash[:memory_mb] = series[:memory] / 1.megabyte | |||
hardware_hash[:disk_capacity] = series[:root_disk_size] + series[:swap_disk_size] | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the disk capacity correct? I do not think we should get this value from the series.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would have to know the difference between size and disk_capacity. And that's not part of the disks table. It may actually be correct.
I think, in a separate PR, a disk should be added for a resource disk. Thoughts?
|
@bronaghs I'd like to get a storage manager implemented, and we can take a more holistic view of what and how we would like stuff integrated. |
@djberg96 Spoke to PM (Brad Ascar). He recommends adding a setting to the settings.yml file that allows the user to enable or disable setting the tier on unmanaged disks. Similar to how we enable/disable the gathering of public images. The default would be true. A documentation BZ would have to be filed describing this. |
👍 |
Added api-version for ResourceService. Added a resource_service and resources_for method. Added add_azure_instance_disk, and modified hardware population methods to use it. Add an api-version for storage_disk. Added the storage_disk_service method. Collect managed disk information and use that to set managed disk size. Get information for unmanaged storage. Add storage type as mode. Remove unused methods. Redefine add_instance_disk instead of adding a new method. Update disk size specs and flavor count. Rebuilt cassette. Make disk argument to add_instance_disk mandatory, update method to pass it explicitly, and remove an old comment. Add the :get_unmanaged_disk_space: property. Only collect unmanaged disk details based on settings.
Checked commit https://github.com/djberg96/manageiq-providers-azure/commit/106ff47459aa1f2565b9a0dc7f0ac6ef97a92b56 with ruby 2.3.3, rubocop 0.47.1, and haml-lint 0.20.0 app/models/manageiq/providers/azure/cloud_manager/refresh_parser.rb
spec/models/manageiq/providers/azure/cloud_manager/refresher_spec.rb
|
@djberg96 Tried to backport to Fine branch, but |
@simaishi yes, just use the .yml file from this PR please. |
Correct and update disk information (cherry picked from commit f8d65fc) https://bugzilla.redhat.com/show_bug.cgi?id=1512728
Fine backport details:
|
Correct and update disk information (cherry picked from commit f8d65fc) https://bugzilla.redhat.com/show_bug.cgi?id=1512727
Gaprindashvili backport details:
|
We inadvertently used the host disk (flavor) size when we really wanted to use the OS/data disk size. This updates it so that it only falls back to flavor size if it can't find the OS/data disk size.
In addition, we need to include the
disk_type
(managed or unmanaged) and storage type (standard LRS, premium, etc) for themode
.https://bugzilla.redhat.com/show_bug.cgi?id=1503866New BZ: https://bugzilla.redhat.com/show_bug.cgi?id=1512569