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

Add check for HostGAPlugin version #2413

Merged
merged 3 commits into from
Nov 17, 2021
Merged

Conversation

narrieta
Copy link
Member

Some of the older versions of the HostGAPlugin do not include the status blob; added check to skip it when comparing against ExtensionsConfig.

Also added telemetry for the HostGAPlugin version.

@codecov
Copy link

codecov bot commented Nov 16, 2021

Codecov Report

Merging #2413 (fc9d50e) into develop (3b1449f) will increase coverage by 0.02%.
The diff coverage is 83.33%.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop    #2413      +/-   ##
===========================================
+ Coverage    71.61%   71.63%   +0.02%     
===========================================
  Files          100      100              
  Lines        14610    14633      +23     
  Branches      2087     2090       +3     
===========================================
+ Hits         10463    10483      +20     
- Misses        3683     3687       +4     
+ Partials       464      463       -1     
Impacted Files Coverage Δ
azurelinuxagent/common/protocol/wire.py 80.23% <63.63%> (-0.24%) ⬇️
...protocol/extensions_goal_state_from_vm_settings.py 85.81% <93.33%> (+0.43%) ⬆️
...inuxagent/common/protocol/extensions_goal_state.py 87.85% <100.00%> (+0.23%) ⬆️
azurelinuxagent/ga/collect_telemetry_events.py 90.41% <0.00%> (+0.68%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 3b1449f...fc9d50e. Read the comment docs.

self._text = json_text
self._host_ga_plugin_version = FlexibleVersion()
self._schema_version = FlexibleVersion()
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you please help me understand what FlexibleVersion() without any parameter passed returns and what will be the default value of _host_ga_plugin_version?
Had a quick read about FlexibleVersion(version.Version) and looks like it expects a version.

Copy link
Member Author

Choose a reason for hiding this comment

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

self.version is intialized to empty and each property defaults to 0, as in

def major(self):
    return self.version[0] if len(self.version) > 0 else 0

dhivyaganesan
dhivyaganesan previously approved these changes Nov 17, 2021
Copy link
Contributor

@dhivyaganesan dhivyaganesan left a comment

Choose a reason for hiding this comment

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

Appreciate if you could help me understand FlexibleVersion() , otherwise looks good to me.

@@ -108,8 +109,10 @@ def compare_attribute(attribute):
compare_attribute("activity_id")
compare_attribute("correlation_id")
compare_attribute("created_on_timestamp")
compare_attribute("status_upload_blob")
compare_attribute("status_upload_blob_type")
# The status blob was added after version 112
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm guessing this check is temporary until this feature is stabilized? If so, could you please add a comment about it too. Thanks!

Copy link
Contributor

Choose a reason for hiding this comment

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

On that note, do the latest version of HostGA contain all the attributes that we're parsing? Or will we have to have a similar check like this for other versions too in the future?

Copy link
Contributor

Choose a reason for hiding this comment

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

1 more question, what's the min version where the HostGA version is available? Is it .112 or greater than that?

Copy link
Member Author

Choose a reason for hiding this comment

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

  • I'm guessing this check is temporary until this feature is stabilized? If so, could you please add a comment about it too. Thanks!
    It will stay there for a while, probably it can be removed once we get telemetry indicating that there are no old HostGAPlugins in the wild. For the moment this check is there just to avoid generating noise. No harm if this is not removed so I'll leave it as is

  • On that note, do the latest version of HostGA contain all the attributes that we're parsing? Or will we have to have a similar check like this for other versions too in the future?

We will have additional checks on the version. The purpose of this PR is mainly to set the infrastructure needed to perform those checks.

  • 1 more question, what's the min version where the HostGA version is available? Is it .112 or greater than that?

Not sure of the exact version, but Flexible version defaults to 0.0.0.0 so version 0 indicates the version field is not there

Copy link
Contributor

Choose a reason for hiding this comment

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

We will have additional checks on the version. The purpose of this PR is mainly to set the infrastructure needed to perform those checks.

I am personally not a big fan of putting checks on versions because they can be never ending. But at the same time I'm not sure of a better way to do it either so approved the PR

azurelinuxagent/common/protocol/wire.py Outdated Show resolved Hide resolved
#
# 112 and below should not check the status blob
#
from_vm_settings._host_ga_plugin_version = FlexibleVersion("1.0.8.112")
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe worth adding a check where we dont get any HostGA version at all too?

Copy link
Member Author

Choose a reason for hiding this comment

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

didn't consider it interesting, since flexible version inits to 0

@@ -1,4 +1,6 @@
{
"hostGAPluginVersion":"1.0.8.115",
"vmSettingsSchemaVersion":"0.0",
Copy link
Contributor

@kevinclark19a kevinclark19a Nov 17, 2021

Choose a reason for hiding this comment

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

Just to verify, these fields have always been present in real VmSettings objects, right?

Edit: Or, at least, since host ga plugin v112?

Copy link
Member Author

Choose a reason for hiding this comment

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

They were added post 112, not sure when. We default to 0.0.0.0 if not present

kevinclark19a
kevinclark19a previously approved these changes Nov 17, 2021
@narrieta narrieta merged commit 31fd9a2 into Azure:develop Nov 17, 2021
@narrieta narrieta deleted the plugin-version branch November 17, 2021 18:53
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