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

Unexpected Volume Size does not change InDesiredState value #75

Closed
ed-vazquez opened this issue Jan 11, 2017 · 4 comments
Closed

Unexpected Volume Size does not change InDesiredState value #75

ed-vazquez opened this issue Jan 11, 2017 · 4 comments
Labels
duplicate The issue or PR is the duplicate of another.

Comments

@ed-vazquez
Copy link

ed-vazquez commented Jan 11, 2017

Below are 2 config blocks.

Initial_DataDisk sets a volume on a disk to 200MB.
DifferentSizeVolume_DataDisk expects a volume size of 300MB.
Test-DscConfiguration inDesiredState = True although there is a mismatch in volume sizes.

Configuration Initial_DataDisk
{

    Import-DscResource -ModuleName xStorage

    Node localhost
    {
        xWaitforDisk Disk1
        {
            DiskNumber = 1
            RetryIntervalSec = 60
            RetryCount = 60
        }

        xDisk XVolume {
            DiskNumber = 1
            DriveLetter = 'Z'
            Size = 200MB
        }
    }
}

Configuration DifferentSizeVolume_DataDisk
{

    Import-DscResource -ModuleName xStorage

    Node localhost
    {
        xWaitforDisk Disk1
        {
            DiskNumber = 1
            RetryIntervalSec = 60
            RetryCount = 60
        }

        xDisk XVolume {
            DiskNumber = 1
            DriveLetter = 'Z'
            Size = 300MB
        }
    }
}


#write mofs
Initial_DataDisk -OutputPath C:\Initial_DataDisk 
DifferentSizeVolume_DataDisk -OutputPath C:\DifferentSizeVolume_DataDisk 

#DSC Volume w/Initial_DataDisk
Start-DscConfiguration -Path C:\Initial_DataDisk -Wait -Force

#Test volume with different volume size
Test-DscConfiguration -Path C:\DifferentSizeVolume_DataDisk -Verbose

<#
    Test Volume w/Different size Volume
    Expect desired state to be false because volume size does not match
    Verbose seems to identify mismatch but InDesiredState value is True 

VM Disk size = 1GB

InDesiredState             : True
ResourcesInDesiredState    : {[xWaitForDisk]Disk1, [xDisk]XVolume}
ResourcesNotInDesiredState : 
ReturnValue                : 0
PSComputerName             : localhost

VERBOSE: [WIN-HOST]:                            [[xDisk]XVolume] Test-TargetResource: Drive Z size 209715200 does not match expected size 3145
72800.

#>
@ed-vazquez
Copy link
Author

Issue may that test-resource does not return false for a mismatch like the other tests.

# Drive size
    if ($Size)
    {
        if ($partition.Size -ne $Size)
        {
            # The partition size mismatches but can't be changed (yet)
            Write-Verbose -Message ( @(
                    "$($MyInvocation.MyCommand): "
                    $($LocalizedData.DriveSizeMismatchMessage `
                        -f $DriveLetter,$Partition.Size,$Size)
                ) -join '' )
        } # if
    } # if

@PlagueHO
Copy link
Member

Hi @VazquezTech - Thank you for reporting this. You are quite correct. This is a known limitation of the resource. This has been on my todo list but I haven't had time to look into it.

This is actually a duplicate of issue #11. It requires the destructive switch (is discussed in #50) to be implemented to allow destructive changes to be made to a disk (in this case resizing the partition).

We choose to return $true when a size mismatch occurs to prevent the Set-TargetResource firing when we can't actually do anything to resolve the size mismatch (yet).

But as this is a duplicate of issue #11, can we close this issue and raise and further discussion in that one?

@PlagueHO PlagueHO added the duplicate The issue or PR is the duplicate of another. label Jan 12, 2017
@ed-vazquez
Copy link
Author

ed-vazquez commented Jan 12, 2017 via email

@PlagueHO
Copy link
Member

Thanks @VazquezTech - I'll try and get to the issue #11 when I get time (seem to be very short of it these days).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate The issue or PR is the duplicate of another.
Projects
None yet
Development

No branches or pull requests

2 participants