[Hyper-V Extension] Change KVP names in Hyper-V Host-Guest communication. #2765
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary of the pull request
Previous implementation of communication between host and guest Hyper-V machine using Hyper-V KVP integration service was not deleting KVPs correctly. KVPs created on host side must be delete from host. When they are only deleted from guest side (as registry keys) they are re-created after Hyper-V VM reboot.
In addition, Hyper-V KVP integration service has a limit (undocumented) on number of KVP and after exceeding that limit no new keys can be created. KVP service API doesn't allow reading We used GUID in the key names.
This fix changes KVP name format: instead of using GUID ("DevSetup{}") it's now a sequential number ("DevSetup{}") to make KVP names more predictable. In case we run into a situation where we have stale KVPs, some of them can be re-used (and then deleted), reducing chances of reaching max number of KVPs limit.
Under normal operation these KVPs deleted after communication with guest machine is complete or KvpSession object is disposed.
Added a new GetState request to get DevSetupAgent service state. For now, it returns a list of requests in queue. Host side won't send new requests if queue is not empty (this flow will need improvements in the future. We don't have UX for it yet)
Added a test for GetState request.
Updated current tests to use new format of KVP names.
Fixed copying of Microsoft.Windows.DevHome.DevSetupEngine.winmd into test projects output.
References and relevant issues
Validation steps performed
Ran tests and Hyper-V configuration flow.
PR checklist