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

OpticalDiskDriveLetter - Exception when testing ODD can be managed in some Azure VMs #289

Closed
PlagueHO opened this issue May 30, 2024 · 1 comment · Fixed by #290
Closed
Labels
bug The issue is a bug. needs investigation The issue needs to be investigated by the maintainers or/and the community.

Comments

@PlagueHO
Copy link
Member

PlagueHO commented May 30, 2024

Problem description

Error occurring here:

Get-DiskImage -DevicePath $devicePath -ErrorAction Stop | Out-Null

Problem cause is here:

        $driveLetter = $OpticalDisk.Drive
        $devicePath = (Get-CimInstance `
            -ClassName Win32_Volume `
            -Filter "DriveLetter = '$($driveLetter)'").DeviceId -replace "\\$"

This seems to occur because the Drive value is CdRom0 and not a volume label, so not able to look up the volume properly (assumption to be checked).

Get-CimInstance -ClassName Win32_CDROMDrive | fl *

Availability                : 3
Drive                       : CdRom0
ErrorCleared                :
MediaLoaded                 : False
NeedsCleaning               :
Status                      : OK
StatusInfo                  :
Caption                     : Msft Virtual CD/ROM ATA Device
Description                 : CD-ROM Drive
InstallDate                 :
Name                        : Msft Virtual CD/ROM ATA Device
ConfigManagerErrorCode      : 0
ConfigManagerUserConfig     : False
CreationClassName           : Win32_CDROMDrive
DeviceID                    : IDE\CDROMMSFT_VIRTUAL_CD/ROM_____________________1.0_____\5&CFB56DE&0&1.0.0
ErrorDescription            :
LastErrorCode               :
PNPDeviceID                 : IDE\CDROMMSFT_VIRTUAL_CD/ROM_____________________1.0_____\5&CFB56DE&0&1.0.0
PowerManagementCapabilities :
PowerManagementSupported    :
SystemCreationClassName     : Win32_ComputerSystem
SystemName                  : ***
Capabilities                : {3, 7}
CapabilityDescriptions      : {Random Access,  Supports Removable Media}
CompressionMethod           : Unknown
DefaultBlockSize            :
ErrorMethodology            :
MaxBlockSize                :
MaxMediaSize                :
MinBlockSize                :
NumberOfMediaSupported      :
DriveIntegrity              :
FileSystemFlags             :
FileSystemFlagsEx           :
Id                          : CdRom0
Manufacturer                : (Standard CD-ROM drives)
MaximumComponentLength      :
MediaType                   : DVD-ROM
MfrAssignedRevisionLevel    : 1.0
RevisionLevel               :
SCSIBus                     : 1
SCSILogicalUnit             : 0
SCSIPort                    : 1
SCSITargetId                : 0
SerialNumber                :
Size                        :
TransferRate                : -1
VolumeName                  :
VolumeSerialNumber          :
PSComputerName              :
CimClass                    : root/cimv2:Win32_CDROMDrive
CimInstanceProperties       : {Caption, Description, InstallDate, Name...}
CimSystemProperties         : Microsoft.Management.Infrastructure.CimSystemProperties
has context menu

Verbose logs

Get-OpticalDiskDriveLetter: Using Get-CimInstance to get the drive letter of optical disk 1 in the 
[[OpticalDiskDriveLetter]MoveOpticalDrive] Perform operation 'Enumerate CimInstances' with following parameters, ''namespaceName' = root\\cimv2,'className' = Win32_CDROMDrive'."},
[[OpticalDiskDriveLetter]MoveOpticalDrive] Perform operation 'Query CimInstances' with following parameters, ''queryExpression' = SELECT * FROM Win32_Volume WHERE DriveLetter = 'CdRom0','queryDialect' = WQL,'namespaceName' = root\\cimv2'.
[[OpticalDiskDriveLetter]MoveOpticalDrive] Operation 'Query CimInstances' complete.
[[OpticalDiskDriveLetter]MoveOpticalDrive] Test-OpticalDiskCanBeManaged: Testing if the optical disk with Device Id '' and assigned drive letter 'CdRom0' can be managed by this resource.
Cannot bind argument to parameter 'DevicePath' because it is an empty string.

DSC configuration

OpticalDiskDriveLetter MoveOpticalDrive {
            DiskId      = 1
            DriveLetter = 'Z'
            Ensure      = "Absent"
        }

Suggested solution

N/A

Operating system the target node is running

N/A

PowerShell version and build the target node is running

N/A

StorageDsc version

6.0.0
@PlagueHO PlagueHO added bug The issue is a bug. needs investigation The issue needs to be investigated by the maintainers or/and the community. labels May 30, 2024
@PlagueHO
Copy link
Member Author

Results of running:

PS C:\Users\nfvrpuser> Get-CimInstance -ClassName Win32_Volume | fl *
 
 Caption                      : \\?\Volume{228e25db-0000-0000-0000-100000000000}\
Description                  :
InstallDate                  :
Name                         : \\?\Volume{228e25db-0000-0000-0000-100000000000}\
Status                       :
Availability                 :
ConfigManagerErrorCode       :
ConfigManagerUserConfig      :
CreationClassName            :
DeviceID                     : \\?\Volume{228e25db-0000-0000-0000-100000000000}\
ErrorCleared                 :
ErrorDescription             :
LastErrorCode                :
PNPDeviceID                  :
PowerManagementCapabilities  :
PowerManagementSupported     :
StatusInfo                   :
SystemCreationClassName      :
SystemName                   : NFVRPAA000001
Access                       :
BlockSize                    : 512
ErrorMethodology             :
NumberOfBlocks               :
Purpose                      :
Automount                    : True
BootVolume                   : False
Capacity                     : 524287488
Compressed                   : False
DirtyBitSet                  : False
DriveLetter                  :
DriveType                    : 3
FileSystem                   : NTFS
FreeSpace                    : 487582208
IndexingEnabled              : True
Label                        : System Reserved
MaximumFileNameLength        : 255
PageFilePresent              : False
QuotasEnabled                : False
QuotasIncomplete             : False
QuotasRebuilding             : False
SerialNumber                 : 3533452987
SupportsDiskQuotas           : True
SupportsFileBasedCompression : True
SystemVolume                 : True
PSComputerName               :
CimClass                     : root/cimv2:Win32_Volume
CimInstanceProperties        : {Caption, Description, InstallDate, Name...}
CimSystemProperties          : Microsoft.Management.Infrastructure.CimSystemProperties
 
Caption                      : D:\
Description                  :
InstallDate                  :
Name                         : D:\
Status                       :
Availability                 :
ConfigManagerErrorCode       :
ConfigManagerUserConfig      :
CreationClassName            :
DeviceID                     : \\?\Volume{53a87756-0000-0000-0000-100000000000}\
ErrorCleared                 :
ErrorDescription             :
LastErrorCode                :
PNPDeviceID                  :
PowerManagementCapabilities  :
PowerManagementSupported     :
StatusInfo                   :
SystemCreationClassName      :
SystemName                   : NFVRPAA000001
Access                       :
BlockSize                    : 4096
ErrorMethodology             :
NumberOfBlocks               :
Purpose                      :
Automount                    : True
BootVolume                   : False
Capacity                     : 107372081152
Compressed                   : False
DirtyBitSet                  : False
DriveLetter                  : D:
DriveType                    : 3
FileSystem                   : NTFS
FreeSpace                    : 105385205760
IndexingEnabled              : True
Label                        : Temporary Storage
MaximumFileNameLength        : 255
PageFilePresent              : True
QuotasEnabled                : False
QuotasIncomplete             : False
QuotasRebuilding             : False
SerialNumber                 : 4142108717
SupportsDiskQuotas           : True
SupportsFileBasedCompression : True
SystemVolume                 : False
PSComputerName               :
CimClass                     : root/cimv2:Win32_Volume
CimInstanceProperties        : {Caption, Description, InstallDate, Name...}
CimSystemProperties          : Microsoft.Management.Infrastructure.CimSystemProperties
 
Caption                      : E:\
Description                  :
InstallDate                  :
Name                         : E:\
Status                       :
Availability                 :
ConfigManagerErrorCode       :
ConfigManagerUserConfig      :
CreationClassName            :
DeviceID                     : \\?\Volume{a54000d8-d5cf-4065-97a7-81045fedad3f}\
ErrorCleared                 :
ErrorDescription             :
LastErrorCode                :
PNPDeviceID                  :
PowerManagementCapabilities  :
PowerManagementSupported     :
StatusInfo                   :
SystemCreationClassName      :
SystemName                   : NFVRPAA000001
Access                       :
BlockSize                    : 4096
ErrorMethodology             :
NumberOfBlocks               :
Purpose                      :
Automount                    : True
BootVolume                   : False
Capacity                     : 68701646848
Compressed                   : False
DirtyBitSet                  : False
DriveLetter                  : E:
DriveType                    : 3
FileSystem                   : NTFS
FreeSpace                    : 66612121600
IndexingEnabled              : True
Label                        : NFVRP
MaximumFileNameLength        : 255
PageFilePresent              : False
QuotasEnabled                : False
QuotasIncomplete             : False
QuotasRebuilding             : False
SerialNumber                 : 1788644264
SupportsDiskQuotas           : True
SupportsFileBasedCompression : True
SystemVolume                 : False
PSComputerName               :
CimClass                     : root/cimv2:Win32_Volume
CimInstanceProperties        : {Caption, Description, InstallDate, Name...}
CimSystemProperties          : Microsoft.Management.Infrastructure.CimSystemProperties
 
Caption                      : C:\
Description                  :
InstallDate                  :
Name                         : C:\
Status                       :
Availability                 :
ConfigManagerErrorCode       :
ConfigManagerUserConfig      :
CreationClassName            :
DeviceID                     : \\?\Volume{228e25db-0000-0000-0000-501f00000000}\
ErrorCleared                 :
ErrorDescription             :
LastErrorCode                :
PNPDeviceID                  :
PowerManagementCapabilities  :
PowerManagementSupported     :
StatusInfo                   :
SystemCreationClassName      :
SystemName                   : NFVRPAA000001
Access                       :
BlockSize                    : 4096
ErrorMethodology             :
NumberOfBlocks               :
Purpose                      :
Automount                    : True
BootVolume                   : True
Capacity                     : 135839870976
Compressed                   : False
DirtyBitSet                  : False
DriveLetter                  : C:
DriveType                    : 3
FileSystem                   : NTFS
FreeSpace                    : 120349122560
IndexingEnabled              : True
Label                        : Windows
MaximumFileNameLength        : 255
PageFilePresent              : False
QuotasEnabled                : False
QuotasIncomplete             : False
QuotasRebuilding             : False
SerialNumber                 : 3902560915
SupportsDiskQuotas           : True
SupportsFileBasedCompression : True
SystemVolume                 : False
PSComputerName               :
CimClass                     : root/cimv2:Win32_Volume
CimInstanceProperties        : {Caption, Description, InstallDate, Name...}
CimSystemProperties          : Microsoft.Management.Infrastructure.CimSystemProperties
 
Caption                      : \\?\Volume{52a193f8-18db-11ef-8403-806e6f6e6963}\
Description                  :
InstallDate                  :
Name                         : \\?\Volume{52a193f8-18db-11ef-8403-806e6f6e6963}\
Status                       :
Availability                 :
ConfigManagerErrorCode       :
ConfigManagerUserConfig      :
CreationClassName            :
DeviceID                     : \\?\Volume{52a193f8-18db-11ef-8403-806e6f6e6963}\
ErrorCleared                 :
ErrorDescription             :
LastErrorCode                :
PNPDeviceID                  :
PowerManagementCapabilities  :
PowerManagementSupported     :
StatusInfo                   :
SystemCreationClassName      :
SystemName                   : NFVRPAA000001
Access                       :
BlockSize                    :
ErrorMethodology             :
NumberOfBlocks               :
Purpose                      :
Automount                    : True
BootVolume                   :
Capacity                     :
Compressed                   :
DirtyBitSet                  :
DriveLetter                  :
DriveType                    : 5
FileSystem                   :
FreeSpace                    :
IndexingEnabled              :
Label                        :
MaximumFileNameLength        :
PageFilePresent              :
QuotasEnabled                :
QuotasIncomplete             :
QuotasRebuilding             :
SerialNumber                 :
SupportsDiskQuotas           :
SupportsFileBasedCompression :
SystemVolume                 :
PSComputerName               :
CimClass                     : root/cimv2:Win32_Volume
CimInstanceProperties        : {Caption, Description, InstallDate, Name...}
CimSystemProperties          : Microsoft.Management.Infrastructure.CimSystemProperties

Indicates that there isn't a clear way to link the Disk to the Volume and therefore can only use the drive letter.

Preventing the exception and marking the drive as not manageable is all we can do for this condition. This is fine in the case where the state should be absent (as the drive is definitely not mounted), but if desired state was present then it would not be possible to mount this volume.

So, for the fix, I'll just prevent the exception and write a verbose log that the condition has been found and that device is not manageable.

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. needs investigation The issue needs to be investigated by the maintainers or/and the community.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant