search
Categories
Sponsors
VirtualMetric Hyper-V Monitoring, Hyper-V Reporting
Archive
Blogroll

Badges
MCSE
Community

Cozumpark Bilisim Portali
Posted in Windows Powershell | No Comment | 3,007 views | 17/02/2012 07:38

As you may know, I’ve recently published new version of SetLinuxVM. It’s currently in version 3. There are many great improvements but specificly I want to talk about Wait-VMReboot and Wait-VMProcess.

The biggest challenge in SetLinuxVM v2 was reboot process. There was a static time wait to cover reboot and service restart scenarios. But reboot and service restart duration may differ and depends on Distro, kernel and workloads on VM. If SetLinuxVM sends a command while Linux VM is rebooting, that command will probably fail. So SetLinuxVM should wait enough to Linux VM gets ready to login screen. But that wait has very big impact on provisioning duration.

So what SetLinuxVM v3 is doing? It does same thing as human eyes. Actually we are watching VM reboot process and if we see login screen, then we type our root username and password. So I did same process on SetLinuxVM. SetLinuxVM captures screen of Linux VM every 10 seconds and checks differences between two capture. So let’s give an example for this process.

1. I send a reboot signal to Linux VM.

2. I capture my first screenshot. VM is at the beginnnig of reboot process.

$State1 = (Watch-LinuxVM -VMName $VMName -VMHost $VMHost -VMCluster $VMCluster -VMMServer $VMMServer -WmiHost $WmiHost).ImageData

3. After 10 seconds, I capture another screenshot, almost at the end of procces.

$State2 = (Watch-LinuxVM -VMName $VMName -VMHost $VMHost -VMCluster $VMCluster -VMMServer $VMMServer -WmiHost $WmiHost).ImageData

4. If I check State1 and State2, Powershell tells me that they are not same. So after 10 seconds I capture another screenshot.

$State1 = (Watch-LinuxVM -VMName $VMName -VMHost $VMHost -VMCluster $VMCluster -VMMServer $VMMServer -WmiHost $WmiHost).ImageData

5. I capture a new screenshot after 10 seconds.

$State2 = (Watch-LinuxVM -VMName $VMName -VMHost $VMHost -VMCluster $VMCluster -VMMServer $VMMServer -WmiHost $WmiHost).ImageData

6. If I check State1 and State2, Powershell tells me that they are identical! So that means VM is finished reboot process or stucked in somewhere. Due to eliminate stucked situations, I do this verification twice. After second verification, if State1 and State2 is idential then SetLinuxVM says that VM is fully rebooted. But that’s just an assume. VM may be stucked forever in reboot process but there is nothing SetLinuxVM can do. You should fix that as a System Administrator.

You can use Wait-VMReboot like this:

Wait-VMReboot -VMName "CentOS01"

I hope you like it! Thanks for reading..