Repository: Azure/WALinuxAgent
Pull request #2324 (2021-08-11 19:36:47)

Rename Debug.FetchVmSettings to Debug.EnableFastTrack
FetchVmSettings was supposed to be a temporary flag, but there is an actual need for an EnableFastTrack flag so I am renaming it.

Currently EnableFastTrack is in the Debug section, but when Fast Track is released to production it will be moved to the Extensions section. 

codecov[bot]: # [Codecov](https://codecov.io/gh/Azure/WALinuxAgent/pull/2324?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Azure) Report
> Merging [#2324](https://codecov.io/gh/Azure/WALinuxAgent/pull/2324?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Azure) (eb2e5d1) into [develop](https://codecov.io/gh/Azure/WALinuxAgent/commit/582d89aaaffb4f413796ead89cc0b44832e9ac05?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Azure) (582d89a) will **increase** coverage by `0.02%`.
> The diff coverage is `100.00%`.

[![Impacted file tree graph](https://codecov.io/gh/Azure/WALinuxAgent/pull/2324/graphs/tree.svg?width=650&height=150&src=pr&token=ae90E2KYCw&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Azure)](https://codecov.io/gh/Azure/WALinuxAgent/pull/2324?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Azure)

```diff
@@             Coverage Diff             @@
##           develop    #2324      +/-   ##
===========================================
+ Coverage    70.74%   70.76%   +0.02%     
===========================================
  Files           97       97              
  Lines        14035    14035              
  Branches      2012     2012              
===========================================
+ Hits          9929     9932       +3     
+ Misses        3660     3659       -1     
+ Partials       446      444       -2     
```


| [Impacted Files](https://codecov.io/gh/Azure/WALinuxAgent/pull/2324?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Azure) | Coverage Δ | |
|---|---|---|
| [azurelinuxagent/common/conf.py](https://codecov.io/gh/Azure/WALinuxAgent/pull/2324/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Azure#diff-YXp1cmVsaW51eGFnZW50L2NvbW1vbi9jb25mLnB5) | `77.72% <100.00%> (ø)` | |
| [azurelinuxagent/common/protocol/wire.py](https://codecov.io/gh/Azure/WALinuxAgent/pull/2324/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Azure#diff-YXp1cmVsaW51eGFnZW50L2NvbW1vbi9wcm90b2NvbC93aXJlLnB5) | `77.79% <100.00%> (ø)` | |
| [azurelinuxagent/ga/collect\_telemetry\_events.py](https://codecov.io/gh/Azure/WALinuxAgent/pull/2324/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Azure#diff-YXp1cmVsaW51eGFnZW50L2dhL2NvbGxlY3RfdGVsZW1ldHJ5X2V2ZW50cy5weQ==) | `90.75% <0.00%> (+1.02%)` | :arrow_up: |

------

[Continue to review full report at Codecov](https://codecov.io/gh/Azure/WALinuxAgent/pull/2324?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Azure).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Azure)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/Azure/WALinuxAgent/pull/2324?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Azure). Last update [582d89a...eb2e5d1](https://codecov.io/gh/Azure/WALinuxAgent/pull/2324?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Azure). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Azure).


Patch:
diff --git a/azurelinuxagent/common/conf.py b/azurelinuxagent/common/conf.py
index f79a80b2..848c175d 100644
--- a/azurelinuxagent/common/conf.py
+++ b/azurelinuxagent/common/conf.py
@@ -118,7 +118,7 @@ __SWITCH_OPTIONS__ = {
     "Debug.CgroupLogMetrics": False,
     "Debug.CgroupDisableOnProcessCheckFailure": True,
     "Debug.CgroupDisableOnQuotaCheckFailure": True,
-    "Debug.FetchVmSettings": False,
+    "Debug.EnableFastTrack": False,
 }
 
 
@@ -509,10 +509,10 @@ def get_cgroup_disable_on_quota_check_failure(conf=__conf__):
     """
     return conf.get_switch("Debug.CgroupDisableOnQuotaCheckFailure", True)
 
-def get_fetch_vm_settings(conf=__conf__):
+def get_enable_fast_track(conf=__conf__):
     """
-    If True, the agent will query the extensions goal state (via the vmSettings API)
+    If True, the agent use FastTrack when retrieving goal states
 
     NOTE: This option is experimental and may be removed in later versions of the Agent.
     """
-    return conf.get_switch("Debug.FetchVmSettings", False)
+    return conf.get_switch("Debug.EnableFastTrack", False)
diff --git a/azurelinuxagent/common/protocol/wire.py b/azurelinuxagent/common/protocol/wire.py
index d1be676e..3f2e0605 100644
--- a/azurelinuxagent/common/protocol/wire.py
+++ b/azurelinuxagent/common/protocol/wire.py
@@ -789,7 +789,7 @@ class WireClient(object):
 
             if new_goal_state is not None:
                 self._goal_state = new_goal_state
-                if conf.get_fetch_vm_settings():
+                if conf.get_enable_fast_track():
                     self.update_extensions_goal_state()
                 self._save_goal_state()
                 self._update_host_plugin(new_goal_state.container_id, new_goal_state.role_config_name)


Test patch:
diff --git a/tests/protocol/test_goal_state.py b/tests/protocol/test_goal_state.py
index 47b42fa9..be7ad37c 100644
--- a/tests/protocol/test_goal_state.py
+++ b/tests/protocol/test_goal_state.py
@@ -17,7 +17,7 @@ from tests.tools import AgentTestCase, patch
 
 _original_http_request = restutil.http_request
 
-@patch("azurelinuxagent.common.protocol.wire.conf.get_fetch_vm_settings", return_value=True)
+@patch("azurelinuxagent.common.protocol.wire.conf.get_enable_fast_track", return_value=True)
 class GoalStateTestCase(HttpRequestPredicates, AgentTestCase):
     def test_fetch_goal_state_should_raise_on_incomplete_goal_state(self, _):
         with mock_wire_protocol(mockwiredata.DATA_FILE) as protocol:
@@ -32,10 +32,9 @@ class GoalStateTestCase(HttpRequestPredicates, AgentTestCase):
 
     def test_update_goal_state_should_save_goal_state(self, _):
         with mock_wire_protocol(mockwiredata.DATA_FILE_VM_SETTINGS) as protocol:
-            with patch("azurelinuxagent.common.protocol.wire.conf.get_fetch_vm_settings", return_value=True):
-                protocol.mock_wire_data.set_incarnation(999)
-                protocol.mock_wire_data.set_etag(888)
-                protocol.update_goal_state()
+            protocol.mock_wire_data.set_incarnation(999)
+            protocol.mock_wire_data.set_etag(888)
+            protocol.update_goal_state()
 
         extensions_config_file = os.path.join(conf.get_lib_dir(), "ExtensionsConfig.999.xml")
         vm_settings_file = os.path.join(conf.get_lib_dir(), "VmSettings.888.json")
diff --git a/tests/test_agent.py b/tests/test_agent.py
index 01e50a4c..58ed8bf1 100644
--- a/tests/test_agent.py
+++ b/tests/test_agent.py
@@ -33,7 +33,7 @@ Debug.CgroupCheckPeriod = 300
 Debug.CgroupDisableOnProcessCheckFailure = True
 Debug.CgroupDisableOnQuotaCheckFailure = True
 Debug.CgroupLogMetrics = False
-Debug.FetchVmSettings = False
+Debug.EnableFastTrack = False
 DetectScvmmEnv = False
 EnableOverProvisioning = True
 Extension.LogDir = /var/log/azure