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

VMSwitch: VM switch repeatedly created when BandwidthReservationMode set to 'NA' or 'Default' on an internal switch #132

Open
achern opened this issue Nov 29, 2017 · 0 comments
Labels
bug The issue is a bug. help wanted The issue is up for grabs for anyone in the community.

Comments

@achern
Copy link

achern commented Nov 29, 2017

Details of the scenario you tried and the problem that is occurring:

If BandwidthReservationMode is set to 'NA' or 'Default' in an xVMSwitch resource with Type 'Internal', the switch gets created repeatedly on each pass of DSC. After looking at the source, it seems that 'NA' is a value reserved for older OS versions that do not support this feature. If so, then there should be a check for this invalid condition instead of the current behavior. In the case of 'Default', Hyper-V will set the actual parameter value to something besides 'Default' using some logic, causing Test-TargetResource to fail when it checks BandwidthReservationMode again. Then, in Set-TargetResource, for some reason the code assumes that if the switch type is not 'External', Test-TargetResource failing means a new switch needs to be created.

The DSC configuration that is using the resource (as detailed as possible):

The following script will create each switch 3 times:

Configuration BandwidthReservationModeBug {

    Import-DscResource -ModuleName xHyper-V

    Node localhost {
        
        xVMSwitch NA {
            Name = 'BandwidthReservationModeBug NA'
            Type = 'Internal'
            BandwidthReservationMode = 'NA'
        }

        xVMSwitch Default {
            Name = 'BandwidthReservationModeBug Default'
            Type = 'Internal'
            BandwidthReservationMode = 'Default'
        }
    }
}

BandwidthReservationModeBug -OutputPath 'BandwidthReservationModeBug'
Start-DscConfiguration -Wait -Verbose -Force -Path 'BandwidthReservationModeBug'
Start-DscConfiguration -Wait -Verbose -Force -Path 'BandwidthReservationModeBug'
Start-DscConfiguration -Wait -Verbose -Force -Path 'BandwidthReservationModeBug'

Version of the Operating System and PowerShell the DSC Target Node is running:

Windows 10.0.15063

PSVersion 5.1.15063.726
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.15063.726
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1

Version of the DSC module you're using, or 'dev' if you're using current dev branch:

3.9.0.0

@johlju johlju added bug The issue is a bug. help wanted The issue is up for grabs for anyone in the community. labels May 16, 2018
@johlju johlju changed the title xVMSwitch - VM switch repeatedly created when BandwidthReservationMode set to 'NA' or 'Default' on an internal switch VMSwitch: VM switch repeatedly created when BandwidthReservationMode set to 'NA' or 'Default' on an internal switch Jun 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug The issue is a bug. help wanted The issue is up for grabs for anyone in the community.
Projects
None yet
Development

No branches or pull requests

2 participants