Beispiel #1
0
        public void init()
        {
            var s = Properties.Settings.Default;

            using (hypervisor_vmware hyp = new hypervisor_vmware(new hypSpec_vmware(
                                                                     s.NASVMName, s.NASVMServerHostname, s.NASVMServerUsername, s.NASVMServerPassword,
                                                                     nasusername, naspassword,
                                                                     "clean", null, 0, null, nashostname), clientExecutionMethod.SSHToBASH))
            {
                // Restore the FreeNAS VM to a known-good state, power it on, and wait for it to boot.
                hyp.powerOff();
                hyp.restoreSnapshot();
                hyp.powerOn();

                // Wait until boot has finished (this isn't a great way of checking, but oh well)
                while (true)
                {
                    executionResult cronStatus = hyp.startExecutable("service", "cron status");
                    if (cronStatus.resultCode == 0)
                    {
                        break;
                    }
                    Thread.Sleep(TimeSpan.FromSeconds(2));
                }

                var aa = hyp.startExecutable("service", "collectd stop");
                var bb = hyp.startExecutable("service", "syslog-ng stop");

                hyp.patchFreeNASInstallation();
            }
        }
 public static void prepVM(hypervisor_vmware hypervisor)
 {
     hypervisor.connect();
     hypervisor.powerOff();
     hypervisor.restoreSnapshot();
     hypervisor.powerOn();
 }