Giter VIP home page Giter VIP logo

ait.buildsuite.hyperv's People

Contributors

aitowner avatar larsroith avatar norschel avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ait.buildsuite.hyperv's Issues

Advanced logic for detecting the correct start of a VM

As a user, I would like to be able to configure the extension more precisely to determine whether a VM is booted correctly.
The current approach checks the ApplicationHealthy property. However, this property is not always available (e.g. Windows 7).

In the context of the issue a selection should be made possible with at least two approaches:

  • ApplicationHealthy (old behavior)
  • Time-based (e.g. timeout 5/10/15 min)
  • Ping with number of successful responses (e.g. 10/20/40)

The restore snapshot script fails if a VM controls the VM host

I created a VM called 'VMHOST-CTRL1' on a VM-Host, so that the host does not need to run an agent and is purely a host.
The Restore Snapshot script runs 'Enable-VMEventing -force' at the end. However, that requires the hyper-v feature to be installed, which is not the case if a machine is simply able to remotely manage a vm host.
I was forced to use nested virtualization and install the hyper-v feature on the VM.

Exception from the log:

2019-04-11T12:34:55.2409828Z Restoring snapshots has been finished for all VM(s).
2019-04-11T12:34:55.2409935Z
2019-04-11T12:34:55.2409991Z
2019-04-11T12:34:55.2410088Z (Re-)Enable Hyper-V cmdlet caching.
2019-04-11T12:34:55.2410156Z
2019-04-11T12:34:55.2410212Z
2019-04-11T12:34:55.4325466Z ##[error]Microsoft.HyperV.PowerShell.VirtualizationException: The Hyper-V Management Tools could not access an expected WMI class on computer 'VMHOST-CTRL1'. This may indicate that the Hyper-V Platform is not installed on the computer or that the version of the Hyper-V Platform is incompatible with these management tools. ---> Microsoft.Virtualization.Client.Management.ServerConnectionException: The Hyper-V Management Tools could not access an expected WMI class on computer 'VMHOST-CTRL1'. This may indicate that the Hyper-V Platform is not installed on the computer or that the version of the Hyper-V Platform is incompatible with these management tools. ---> Microsoft.Management.Infrastructure.CimException: Invalid class
2019-04-11T12:34:55.4336389Z at Microsoft.Management.Infrastructure.Internal.Operations.CimSyncEnumeratorBase1.MoveNext() 2019-04-11T12:34:55.4336702Z at System.Linq.Enumerable.WhereSelectEnumerableIterator2.MoveNext()
2019-04-11T12:34:55.4336947Z at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()
2019-04-11T12:34:55.4337168Z at Microsoft.Virtualization.Client.Management.Server.LoadOSInfo()
2019-04-11T12:34:55.4337377Z --- End of inner exception stack trace ---
2019-04-11T12:34:55.4337593Z at Microsoft.Virtualization.Client.Management.Server.LoadOSInfo()
2019-04-11T12:34:55.4337833Z at Microsoft.HyperV.PowerShell.VirtualizationObjectLocator.PrepareServerConnections(Server server, Boolean allowDownlevelServers)
2019-04-11T12:34:55.4338093Z at Microsoft.HyperV.PowerShell.Commands.ParameterResolvers.GetServers(IServerParameters cmdletParameters, IOperationWatcher operationWatcher)
2019-04-11T12:34:55.4338375Z at Microsoft.HyperV.PowerShell.Commands.EnableVMEventing.PerformOperation(IOperationWatcher operationWatcher)
2019-04-11T12:34:55.4338635Z at Microsoft.HyperV.PowerShell.Commands.VirtualizationCmdletBase.PerformOperationWithLogging(IOperationWatcher operationWatcher)
2019-04-11T12:34:55.4338872Z --- End of inner exception stack trace ---

Fixing PSScriptAnalyzer Warnings and Errors

CMD:
$errorRules = Get-ScriptAnalyzerRule -Severity Error,Warning
Invoke-ScriptAnalyzer -Path .\src\HyperVServer\HyperVServer\HyperVServer.ps1 -IncludeRule $errorRules -ExcludeRule PSAvoidUsingWriteHost

Output:

RuleName Severity ScriptName Line Message


PSUseShouldProcessForStateChangingF Warning HyperVServ 58 Function 'Set-HyperVCmdletDisabled' has verb that
unctions er.ps1 could change system state. Therefore, the function
has to support 'ShouldProcess'.
PSUseShouldProcessForStateChangingF Warning HyperVServ 64 Function 'Set-HyperVCmdletEnabled' has verb that
unctions er.ps1 could change system state. Therefore, the function
has to support 'ShouldProcess'.
PSUseShouldProcessForStateChangingF Warning HyperVServ 140 Function 'Start-HyperVVM' has verb that could change
unctions er.ps1 system state. Therefore, the function has to support
'ShouldProcess'.
PSUseShouldProcessForStateChangingF Warning HyperVServ 261 Function 'Stop-VMUnfriendly' has verb that could
unctions er.ps1 change system state. Therefore, the function has to
support 'ShouldProcess'.
PSUseShouldProcessForStateChangingF Warning HyperVServ 289 Function 'Stop-VMByTurningOffVM' has verb that could
unctions er.ps1 change system state. Therefore, the function has to
support 'ShouldProcess'.
PSUseShouldProcessForStateChangingF Warning HyperVServ 314 Function 'Stop-HyperVVM' has verb that could change
unctions er.ps1 system state. Therefore, the function has to support
'ShouldProcess'.
PSUseShouldProcessForStateChangingF Warning HyperVServ 390 Function 'New-HyperVSnapshot' has verb that could
unctions er.ps1 change system state. Therefore, the function has to
support 'ShouldProcess'.
PSUseShouldProcessForStateChangingF Warning HyperVServ 515 Function 'Remove-HyperVSnapshot' has verb that could
unctions er.ps1 change system state. Therefore, the function has to
support 'ShouldProcess'.
PSUseSingularNouns Warning HyperVServ 82 The cmdlet 'Get-VMExists' uses a plural noun. A
er.ps1 singular noun should be used instead.
PSUseSingularNouns Warning HyperVServ 111 The cmdlet 'Get-VMNames' uses a plural noun. A
er.ps1 singular noun should be used instead.
PSAvoidUsingWMICmdlet Warning HyperVServ 276 File 'HyperVServer.ps1' uses WMI cmdlet. For
er.ps1 PowerShell 3.0 and above, use CIM cmdlet which
perform the same tasks as the WMI cmdlets. The CIM
cmdlets comply with WS-Management (WSMan) standards
and with the Common Information Model (CIM)
standard, which enables the cmdlets to use the same
techniques to manage Windows computers and those
running other operating systems.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.