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

Disable Media/File Caching #28

Closed
iainbrighton opened this issue Nov 22, 2015 · 11 comments
Closed

Disable Media/File Caching #28

iainbrighton opened this issue Nov 22, 2015 · 11 comments

Comments

@iainbrighton
Copy link
Contributor

Related to discussions in issue #9, it would be great to be able the disabling of file-based media, i.e. ISO and WIM media. This would be good for reducing disk storage on always-connected hosts, e.g. not laptops! By default this should be left enabled for performance reasons.

@iainbrighton
Copy link
Contributor Author

It appears that mounting an ISO file from a UNC file share doesn't work too well? When an ISO is mounted with Mount-DiskImage -ImagePath '\\UNC\Path\To.Iso' -StorageType ISO -PassThru, it is not reflected in any subsequent calls to Get-Volume?

DriveLetter FileSystemLabel           FileSystem DriveType HealthStatus OperationalStatus
----------- ---------------           ---------- --------- ------------ -----------------
F                                                CD-ROM    Healthy      Unknown
C           Evo850                    NTFS       Fixed     Healthy      OK
D           Data                      NTFS       Fixed     Healthy      OK
            Recovery                  NTFS       Fixed     Healthy      OK
                                      NTFS       Fixed     Healthy      OK
E           M4                        NTFS       Fixed     Healthy      OK

When -ImagePath points to a local path Get-Volume shows this:

DriveLetter FileSystemLabel           FileSystem DriveType HealthStatus OperationalStatus
----------- ---------------           ---------- --------- ------------ -----------------
F                                                CD-ROM    Healthy      Unknown
C           Evo850                    NTFS       Fixed     Healthy      OK
D           Data                      NTFS       Fixed     Healthy      OK
            Recovery                  NTFS       Fixed     Healthy      OK
                                      NTFS       Fixed     Healthy      OK
R           IR3_SSS_X64FREE_EN-US_DV9 UDF        CD-ROM    Healthy      OK
E           M4                        NTFS       Fixed     Healthy      OK

In short, to progress this, I need a way of determining the mounted drive letter of an ISO mounted on a UNC share. Get-CimInstance -ClassName Win32_Volume and Get-WmiObject -Class Win32_Volume return the mounted ISO, but I cannot work out how to get back to the source file path..

@iainbrighton
Copy link
Contributor Author

Creating a Windows Image from a networked .WIM files does work (as I expected).

I think I'll temporarily only implement the -DisableLocalFileCaching functionality for .WIM media. ISO media will still be downloaded/cached locally until I can get to the bottom of the ISO mounting issue described above.

@iainbrighton
Copy link
Contributor Author

@csandfeld If you have some WIM files you should be able to run Set-LabHostDefaults -DisableLocalFileCaching to stop the module copying .WIM files from an existing location (as long as the Uri starts with file://). This is implemented in v0.8.6

Note: this is only currently implemented for WIM media.

@iainbrighton iainbrighton reopened this Nov 26, 2015
@csandfeld
Copy link
Contributor

All my wishes seem to come true today :)

@iainbrighton
Copy link
Contributor Author

Haha – not quite. There’s one more inbound…

@csandfeld
Copy link
Contributor

Tried disabling file caching for a WIM file, but ran into the following:

VERBOSE: [13:25:07] Caching of file-based media is disabled. Skipping media 'S12R2STDX64' download.
Get-Item : Cannot find path 'D:\TestLab\ISOs\S12R2STDX64.wim' because it does not exist.
At C:\Program Files\WindowsPowerShell\Modules\VirtualEngineLab\Src\LabMedia.ps1:240 char:17
+ ...     return (Get-Item -Path $invokeResourceDownloadParams.DestinationP ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (D:\TestLab\ISOs\S12R2STDX64.wim:String) [Get-Item], ItemNot 
   FoundException
    + FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.GetItemCommand

VERBOSE: [13:25:07] Creating disk image 'Windows Server 2012 R2 Standard x64'.
VERBOSE: [13:25:07] Creating disk image 'D:\TestLab\MasterVirtualHardDisks\S12R2STDX64.vhdx'.
VERBOSE: [13:25:08] Mounting disk image 'D:\TestLab\MasterVirtualHardDisks\S12R2STDX64.vhdx'.
VERBOSE: [13:25:08] Initializing disk image 'D:\TestLab\MasterVirtualHardDisks\S12R2STDX64.vhdx'.
VERBOSE: [13:25:09] Creating 'System' disk partition.
VERBOSE: [13:25:09] Formatting 'System' disk partition.
VERBOSE: [13:25:10] Creating 'OS' disk partition.
VERBOSE: [13:25:10] Formatting 'OS' disk partition.
New-LabImage : Cannot bind argument to parameter 'MediaPath' because it is an empty string.
At C:\Program Files\WindowsPowerShell\Modules\VirtualEngineLab\Src\LabVM.ps1:211 char:27
+ ... ef] $null = New-LabImage -Id $node.Media -ConfigurationData $Configur ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Write-Error], WriteErrorException
    + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,New-LabImage

WARNING: [13:25:13] Removing incomplete image 'D:\TestLab\MasterVirtualHardDisks\S12R2STDX64.vhdx'.
VERBOSE: [13:25:13] Setting Virtual Switch configuration 'External'.
VERBOSE: [13:25:13] Checking DSC Resource 'xHyper-V\MSFT_xVMSwitch'.
VERBOSE: [13:25:13] Invoking command 'Test-VMSwitchTargetResource'.
VERBOSE: [13:25:15] Skipping command 'Set-VMSwitchTargetResource'.
VERBOSE: [13:25:15] (Re)setting VHDX configuration 'S12R2STDX64'.
VERBOSE: [13:25:15] Checking DSC Resource 'xHyper-V\MSFT_xVHD'.
VERBOSE: [13:25:15] Invoking command 'Test-VHDTargetResource'.
Either specify ParentPath or MaximumSize property.
At C:\Program Files\WindowsPowerShell\Modules\VirtualEngineLab\DSCResources\xHyper-V\DSCResources\MSFT_xVHD
\MSFT_xVHD.psm1:199 char:8
+        Throw "Either specify ParentPath or MaximumSize property."
+        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : OperationStopped: (Either specify ...mSize property.:String) [], RuntimeExce 
   ption
    + FullyQualifiedErrorId : Either specify ParentPath or MaximumSize property.


C:\> 

@iainbrighton
Copy link
Contributor Author

OK – I think I can see what the issue is there. I best be writing another test ;)

@iainbrighton
Copy link
Contributor Author

@csandfeld this should be resolved in the latest dev branch 0.8.9. I've merged the -Credential/-Password functionality into dev.

@csandfeld
Copy link
Contributor

That did the trick - you're a rock star 👍

@iainbrighton
Copy link
Contributor Author

@csandfeld can I close this issue out?

@csandfeld
Copy link
Contributor

Yes, certainly - thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants