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: No idempotence for switches with type of External #193

Open
ThePowershellNinja opened this issue Apr 4, 2022 · 0 comments
Open
Labels
bug The issue is a bug. help wanted The issue is up for grabs for anyone in the community.

Comments

@ThePowershellNinja
Copy link

ThePowershellNinja commented Apr 4, 2022

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

I am trying to ensure that a certain switch configuration is always present. The problem is that when you create a switch with a type of "External", it creates another network interface on the machine and uses that instead of the original network interface specified. So the first run creates the switch just fine. The subsequent runs will still work if no VMs are using the switch, as it seems to delete the switch and recreate it. Once a VM is using the switch, instead of the xVMSwitch resource determining that there is nothing to do, it throws this error: "Failed while removing virtual Ethernet switch.
The virtual switch 'DSC Test' cannot be deleted because it is being used by running virtual machines or assigned to child pools."

Verbose logs showing the problem

image

Suggested solution to the issue

During the test phase of the resource, identify the newly created nic for the switch instead of the original nic it was based off of when the switch type is "Physical".

The DSC configuration that is used to reproduce the issue (as detailed as possible)

configuration SetVMSwitch {

    Import-DscResource -Module 'xHyper-v'

    Node localhost {
        xVMSwitch TestSwitch {
            Name              = 'DSC Test'
            Type              = 'External'
            NetAdapterName    = 'DSC Test'
            AllowManagementOS = $true
            Ensure            = 'Present'
        }
    }
}

SetVMSwitch -OutputPath C:\Temp\
Start-DscConfiguration -Path C:\Temp\ -Wait -Verbose

The operating system the target node is running

WindowsBuildLabEx                                       : 17763.1.amd64fre.rs5_release.180914-1434
WindowsCurrentVersion                                   : 6.3
WindowsEditionId                                        : ServerDatacenter
WindowsInstallationType                                 : Server
WindowsInstallDateFromRegistry                          : 6/7/2020 6:01:40 PM
WindowsProductId                                        : 00430-00000-00000-AA777
WindowsProductName                                      : Windows Server 2019 Datacenter
WindowsRegisteredOrganization                           : 
WindowsRegisteredOwner                                  : Windows User
WindowsSystemRoot                                       : C:\Windows
WindowsVersion                                          : 1809
BiosCharacteristics                                     : {4, 7, 9, 11...}
BiosBIOSVersion                                         : {DELL   - 1, 6.6.0, Dell Inc. - 60601}
BiosBuildNumber                                         : 
BiosCaption                                             : 6.6.0
BiosCodeSet                                             : 
BiosCurrentLanguage                                     : en|US|iso8859-1
BiosDescription                                         : 6.6.0
BiosEmbeddedControllerMajorVersion                      : 255
BiosEmbeddedControllerMinorVersion                      : 255
BiosFirmwareType                                        : Uefi
BiosIdentificationCode                                  : 
BiosInstallableLanguages                                : 1
BiosInstallDate                                         : 
BiosLanguageEdition                                     : 
BiosListOfLanguages                                     : {en|US|iso8859-1}
BiosManufacturer                                        : Dell Inc.
BiosName                                                : 6.6.0
BiosOtherTargetOS                                       : 
BiosPrimaryBIOS                                         : True
BiosReleaseDate                                         : 5/21/2018 5:00:00 PM
BiosSeralNumber                                         : 9Q5H3M1
BiosSMBIOSBIOSVersion                                   : 6.6.0
BiosSMBIOSMajorVersion                                  : 2
BiosSMBIOSMinorVersion                                  : 6
BiosSMBIOSPresent                                       : True
BiosSoftwareElementState                                : Running
BiosStatus                                              : OK
BiosSystemBiosMajorVersion                              : 6
BiosSystemBiosMinorVersion                              : 6
BiosTargetOperatingSystem                               : 0
BiosVersion                                             : DELL   - 1
CsAdminPasswordStatus                                   : Unknown
CsAutomaticManagedPagefile                              : True
CsAutomaticResetBootOption                              : True
CsAutomaticResetCapability                              : True
CsBootOptionOnLimit                                     : 
CsBootOptionOnWatchDog                                  : 
CsBootROMSupported                                      : True
CsBootStatus                                            : {0, 0, 0, 38...}
CsBootupState                                           : Normal boot
CsCaption                                               : VMHOST2
CsChassisBootupState                                    : Safe
CsChassisSKUNumber                                      : 
CsCurrentTimeZone                                       : -420
CsDaylightInEffect                                      : True
CsDescription                                           : AT/AT COMPATIBLE
CsDNSHostName                                           : vmhost2
CsDomain                                                : justtoclayrify.net
CsDomainRole                                            : MemberServer
CsEnableDaylightSavingsTime                             : True
CsFrontPanelResetStatus                                 : Unknown
CsHypervisorPresent                                     : True
CsInfraredSupported                                     : False
CsInitialLoadInfo                                       : 
CsInstallDate                                           : 
CsKeyboardPasswordStatus                                : Unknown
CsLastLoadInfo                                          : 
CsManufacturer                                          : Dell Inc.
CsModel                                                 : PowerEdge R710
CsName                                                  : VMHOST2
CsNetworkAdapters                                       : {DSC Test, Internal, Lab, Ethernet 4...}
CsNetworkServerModeEnabled                              : True
CsNumberOfLogicalProcessors                             : 24
CsNumberOfProcessors                                    : 2
CsProcessors                                            : {Intel(R) Xeon(R) CPU           X5650  @ 2.67GHz, Intel(R) Xeon(R) CPU           X5650  @ 2.67GHz}
CsOEMStringArray                                        : {Dell System, 5[0000]}
CsPartOfDomain                                          : True
CsPauseAfterReset                                       : -1
CsPCSystemType                                          : EnterpriseServer
CsPCSystemTypeEx                                        : EnterpriseServer
CsPowerManagementCapabilities                           : 
CsPowerManagementSupported                              : 
CsPowerOnPasswordStatus                                 : Unknown
CsPowerState                                            : Unknown
CsPowerSupplyState                                      : Safe
CsPrimaryOwnerContact                                   : 
CsPrimaryOwnerName                                      : Windows User
CsResetCapability                                       : Other
CsResetCount                                            : -1
CsResetLimit                                            : -1
CsRoles                                                 : {LM_Workstation, LM_Server, NT, Server_NT}
CsStatus                                                : OK
CsSupportContactDescription                             : 
CsSystemFamily                                          : 
CsSystemSKUNumber                                       : 
CsSystemType                                            : x64-based PC
CsThermalState                                          : Safe
CsTotalPhysicalMemory                                   : 77288685568
CsPhyicallyInstalledMemory                              : 75497472
CsUserName                                              : 
CsWakeUpType                                            : PowerSwitch
CsWorkgroup                                             : 
OsName                                                  : Microsoft Windows Server 2019 Datacenter
OsType                                                  : WINNT
OsOperatingSystemSKU                                    : DatacenterServerEdition
OsVersion                                               : 10.0.17763
OsCSDVersion                                            : 
OsBuildNumber                                           : 17763
OsHotFixes                                              : {KB5010473, KB4486153, KB4504369, KB4535680...}
OsBootDevice                                            : \Device\HarddiskVolume3
OsSystemDevice                                          : \Device\HarddiskVolume5
OsSystemDirectory                                       : C:\Windows\system32
OsSystemDrive                                           : C:
OsWindowsDirectory                                      : C:\Windows
OsCountryCode                                           : 1
OsCurrentTimeZone                                       : -420
OsLocaleID                                              : 0409
OsLocale                                                : en-US
OsLocalDateTime                                         : 4/4/2022 4:36:02 PM
OsLastBootUpTime                                        : 3/8/2022 5:31:32 PM
OsUptime                                                : 26.23:04:29.5820120
OsBuildType                                             : Multiprocessor Free
OsCodeSet                                               : 1252
OsDataExecutionPreventionAvailable                      : True
OsDataExecutionPrevention32BitApplications              : True
OsDataExecutionPreventionDrivers                        : True
OsDataExecutionPreventionSupportPolicy                  : OptOut
OsDebug                                                 : False
OsDistributed                                           : False
OsEncryptionLevel                                       : 256
OsForegroundApplicationBoost                            : Maximum
OsTotalVisibleMemorySize                                : 75477232
OsFreePhysicalMemory                                    : 37280232
OsTotalVirtualMemorySize                                : 86487280
OsFreeVirtualMemory                                     : 48584828
OsInUseVirtualMemory                                    : 37902452
OsTotalSwapSpaceSize                                    : 
OsSizeStoredInPagingFiles                               : 11010048
OsFreeSpaceInPagingFiles                                : 11010048
OsPagingFiles                                           : {C:\pagefile.sys}
OsHardwareAbstractionLayer                              : 10.0.17763.2686
OsInstallDate                                           : 6/7/2020 11:01:40 AM
OsManufacturer                                          : Microsoft Corporation
OsMaxNumberOfProcesses                                  : 4294967295
OsMaxProcessMemorySize                                  : 137438953344
OsMuiLanguages                                          : {en-US}
OsNumberOfLicensedUsers                                 : 0
OsNumberOfProcesses                                     : 120
OsNumberOfUsers                                         : 19
OsOrganization                                          : 
OsArchitecture                                          : 64-bit
OsLanguage                                              : en-US
OsProductSuites                                         : {TerminalServices, DatacenterEdition, TerminalServicesSingleSession}
OsOtherTypeDescription                                  : 
OsPAEEnabled                                            : 
OsPortableOperatingSystem                               : False
OsPrimary                                               : True
OsProductType                                           : Server
OsRegisteredUser                                        : Windows User
OsSerialNumber                                          : 00430-00000-00000-AA777
OsServicePackMajorVersion                               : 0
OsServicePackMinorVersion                               : 0
OsStatus                                                : OK
OsSuites                                                : {TerminalServices, DatacenterEdition, TerminalServicesSingleSession}
OsServerLevel                                           : FullServer
KeyboardLayout                                          : en-US
TimeZone                                                : (UTC-08:00) Pacific Time (US & Canada)
LogonServer                                             : \\DC02
PowerPlatformRole                                       : EnterpriseServer
HyperVisorPresent                                       : True
HyperVRequirementDataExecutionPreventionAvailable       : 
HyperVRequirementSecondLevelAddressTranslation          : 
HyperVRequirementVirtualizationFirmwareEnabled          : 
HyperVRequirementVMMonitorModeExtensions                : 
DeviceGuardSmartStatus                                  : Off
DeviceGuardRequiredSecurityProperties                   : {0}
DeviceGuardAvailableSecurityProperties                  : {BaseVirtualizationSupport}
DeviceGuardSecurityServicesConfigured                   : {0}
DeviceGuardSecurityServicesRunning                      : {0}
DeviceGuardCodeIntegrityPolicyEnforcementStatus         : 
DeviceGuardUserModeCodeIntegrityPolicyEnforcementStatus : 

Version and build of PowerShell the target node is running

Name                           Value                                                                                                                                                                                                                             
----                           -----                                                                                                                                                                                                                             
PSVersion                      5.1.17763.2268                                                                                                                                                                                                                    
PSEdition                      Desktop                                                                                                                                                                                                                           
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}                                                                                                                                                                                                           
BuildVersion                   10.0.17763.2268                                                                                                                                                                                                                   
CLRVersion                     4.0.30319.42000                                                                                                                                                                                                                   
WSManStackVersion              3.0                                                                                                                                                                                                                               
PSRemotingProtocolVersion      2.3                                                                                                                                                                                                                               
SerializationVersion           1.1.0.1  

Version of the DSC module that was used

Name              : xHyper-V
Path              : C:\Program Files\WindowsPowerShell\Modules\xHyper-V\3.17.0.0\xHyper-V.psd1
Description       : Module with DSC Resources for Hyper-V area
ModuleType        : Manifest
Version           : 3.17.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 Jun 12, 2022
@johlju johlju changed the title xVMSwitch: No idempotence for switches with type of External VMSwitch: No idempotence for switches with type of External 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