HyperV-R2 fixes

This commit is contained in:
Alexander Trofimov 2015-05-21 12:04:16 +03:00
parent bba637b689
commit 6320eee5d5
3 changed files with 21 additions and 11 deletions

View file

@ -91,7 +91,7 @@ namespace WebsitePanel.VmConfig
} }
attempts++; attempts++;
Log.WriteError(string.Format("Attempt #{0} to find network adapter failed!", attempts)); Log.WriteError(string.Format("Attempt #{0} to find network adapter (mac: {1}) failed!", attempts, macAddress));
// wait 1 min // wait 1 min
System.Threading.Thread.Sleep(60000); System.Threading.Thread.Sleep(60000);
//repeat loop //repeat loop

View file

@ -6,7 +6,7 @@
<appSettings> <appSettings>
<!-- Start-up delay in milliseconds - time to wait before tasks execution --> <!-- Start-up delay in milliseconds - time to wait before tasks execution -->
<add key="Service.StartupDelay" value="0"/> <add key="Service.StartupDelay" value="20000"/>
<!-- Interval in milliseconds to poll registry keys. 1 - read registry only once --> <!-- Interval in milliseconds to poll registry keys. 1 - read registry only once -->
<add key="Service.RegistryPollInterval" value="30000"/> <add key="Service.RegistryPollInterval" value="30000"/>

View file

@ -228,21 +228,31 @@ namespace WebsitePanel.Providers.Virtualization
try try
{ {
Command cmd = new Command("Get-VM"); HostedSolutionLog.LogInfo("Before Get-VM command");
Command cmd = new Command("Get-VM");
Collection<PSObject> result = PowerShell.Execute(cmd, true); Collection<PSObject> result = PowerShell.Execute(cmd, true);
HostedSolutionLog.LogInfo("After Get-VM command");
foreach (PSObject current in result) foreach (PSObject current in result)
{ {
VirtualMachine vm = new VirtualMachine HostedSolutionLog.LogInfo("- start VM -");
{ var vm = new VirtualMachine();
VirtualMachineId = current.GetProperty("Id").ToString(), HostedSolutionLog.LogInfo("create");
Name = current.GetString("Name"), vm.VirtualMachineId = current.GetProperty("Id").ToString();
State = current.GetEnum<VirtualMachineState>("State"), HostedSolutionLog.LogInfo("VirtualMachineId {0}", vm.VirtualMachineId);
Uptime = Convert.ToInt64(current.GetProperty<TimeSpan>("UpTime").TotalMilliseconds), vm.Name = current.GetString("Name");
ReplicationState = current.GetEnum<ReplicationState>("ReplicationState") HostedSolutionLog.LogInfo("Name {0}", vm.Name);
}; vm.State = current.GetEnum<VirtualMachineState>("State");
HostedSolutionLog.LogInfo("State {0}", vm.State);
vm.Uptime = Convert.ToInt64(current.GetProperty<TimeSpan>("UpTime").TotalMilliseconds);
HostedSolutionLog.LogInfo("Uptime {0}", vm.Uptime);
vm.ReplicationState = current.GetEnum<ReplicationState>("ReplicationState");
HostedSolutionLog.LogInfo("ReplicationState {0}", vm.ReplicationState);
vmachines.Add(vm); vmachines.Add(vm);
HostedSolutionLog.LogInfo("- end VM -");
} }
HostedSolutionLog.LogInfo("Finish");
} }
catch (Exception ex) catch (Exception ex)
{ {