Пример #1
0
        private void RunIsoInHyperV(string iso, string harddisk)
        {
            if (!File.Exists(harddisk))
            {
                throw new FileNotFoundException("Harddisk file not found!", harddisk);
            }

            var xParams = new NameValueCollection();

            xParams.Add("ISOFile", iso);
            xParams.Add(BuildPropertyNames.VisualStudioDebugPortString, "Pipe: CosmosSerial");

            var xDebugConnector = new DebugConnectorPipeClient(DebugConnectorPipeClient.DefaultCosmosPipeName);

            InitializeDebugConnector(xDebugConnector);

            var xHyperV = new HyperV(xParams, RunWithGDB, harddisk); // harddisk passed in is in vmdk format and therefore not compatible

            //var xHyperV = new HyperV(xParams, RunWithGDB);
            xHyperV.OnShutDown = (a, b) =>
            {
                mKernelRunning = false;
            };

            HandleRunning(xDebugConnector, xHyperV);
        }
Пример #2
0
        /// <summary>
        /// Adds a server to the database. If a cache of virtual machines is given,
        /// then we insert the virtual machines into the Master Tree. If not, then we
        /// obtain a list of virtual machines and then insert it into the Master Tree.
        /// This function is cache safe.
        /// </summary>
        /// <param name="dbHost">The computer object to insert into the database.</param>
        /// <param name="cache">An optional cache parameter.</param>
        public void AddServer(DbHostComputer dbHost, HostState state, List <VirtualMachine> cache = null)
        {
            Insert(dbHost, x => x.HostName);
            if (cache == null)
            {
                cache = HyperV.GetVm(dbHost.HostName);
            }
            var root = this.GetRootTreeNode(dbHost, state, cache);

            Directory.Add(dbHost.HostName, root);
        }
Пример #3
0
        public static void getvms(string[] tokens)
        {
            string server = Dns.GetHostName();

            if (tokens.Length == 2)
            {
                server = tokens[1];
            }
            foreach (var obj in HyperV.GetPsVm(server))
            {
                Console.WriteLine(obj.ToString());
            }
        }
Пример #4
0
 public AddTemplateDialog()
 {
     InitializeComponent();
     jsonHelper = new JsonHelper(Settings.Default.templateFile, FileShare.Read);
     serverComboBox.ComboBox.SelectedIndexChanged += (o, e) =>
     {
         adapterComboBox.ComboBox.Items.Clear();
         adapterComboBox.ComboBox.Items.AddRange(
             HyperV.GetVmSwitch(GetSelectedHost()?.HostName)
             .Select(x => new SwitchObj {
             Name = (string)x.Members["Name"].Value,
             Type = (string)x.Members["SwitchType"].Value
         }).ToArray());
     };
 }
        public void Exeption_no_parameters_specified()
        {
            // arrange
            var target = new HyperV();
            Dictionary <string, object> args = new Dictionary <string, object>
            {
            };
            WorkflowInvoker invoker = new WorkflowInvoker(target);

            // act
            var results = invoker.Invoke(args);

            // assert
            // attribute checks value
        }
        public void Exception_thrown_if_no_VM_specified()
        {
            // arrange
            var target = new HyperV();
            Dictionary <string, object> args = new Dictionary <string, object>
            {
                { "ServerName", "Server" }
            };
            WorkflowInvoker invoker = new WorkflowInvoker(target);

            // act
            var results = invoker.Invoke(args);

            // assert
            // attribute checks value
        }
Пример #7
0
 private void SetBase(MasterTreeNode node)
 {
     if (node.Type != NodeType.VirtualMachines || node.VmType?.Value != VirtualMachineType.NONE)
     {
         return;
     }
     try
     {
         HyperV.CheckpointVm(node.Host, node.Name, "Base Checkpoint DNR");
     }
     catch (Exception e)
     {
         MessageBox.Show(e.Message, "Exception", MessageBoxButtons.OK);
     }
     databaseManager.SetVmType(DbVirtualMachine.FromTreeNode(node), VirtualMachineType.BASE);
     RefreshUI();
 }
Пример #8
0
        /// <summary>
        /// Exception safe cache flushing for virtual machines.
        /// </summary>
        public void FlushCache(PsStreamEventHandlers handlers = null)
        {
            foreach (var e in Directory)
            {
                e.Value.BurnChildren();
            }
            Directory.Clear();
            var hosts = GetCollection <DbHostComputer>();
            var virts = GetCollection <DbVirtualMachine>();

            // Loop through each host
            foreach (var h in hosts.FindAll())
            {
                MasterTreeNode root = null;
                HostState      st   = HostState.Unknown;
                try
                {
                    Interface.BringOnline(h.HostName);
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message, "Exception", MessageBoxButtons.OK);
                    st = HostState.Offline;
                }

                var vm = new List <VirtualMachine>();
                try
                {
                    vm = HyperV.GetVm(h.HostName, handlers);
                    st = HostState.Online;
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message, "Exception", MessageBoxButtons.OK);
                    st = HostState.Offline;
                }

                root = this.GetRootTreeNode(h, st, vm);
                // Finally, add this host to our tree
                if (root != null)
                {
                    Directory.Add(h.HostName, root);
                }
            }
        }
Пример #9
0
        public void Can_take_snapshot_of_a_running_VM()
        {
            // arrange
            var target = new HyperV { Action = HyperVAction.Snapshot };

            Dictionary<string, object> args = new Dictionary<string, object>
            {
                { "ServerName", this.Server },
                 { "VMName",  this.VMName }
            };
            WorkflowInvoker invoker = new WorkflowInvoker(target);

            // act
            var results = invoker.Invoke(args);

            // assert
            Assert.AreEqual(true, results["Succeeded"]);
        }
        public void Can_start_a_stopped_or_paused_VM()
        {
            // arrange
            var target = new HyperV { Action = HyperVAction.Start };

            Dictionary<string, object> args = new Dictionary<string, object>
            {
                 { "ServerName", this.Server },
                 { "VMName",  this.VMName }
            };
            WorkflowInvoker invoker = new WorkflowInvoker(target);

            // act
            var results = invoker.Invoke(args);

            // assert
            Assert.AreEqual(true, results["Succeeded"]);
        }
Пример #11
0
        public void Can_shutdown_a_running_VM()
        {
            // arrange
            var target = new HyperV {
                Action = HyperVAction.Shutdown
            };
            Dictionary <string, object> args = new Dictionary <string, object>
            {
                { "ServerName", this.Server },
                { "VMName", this.VMName }
            };
            WorkflowInvoker invoker = new WorkflowInvoker(target);

            // act
            var results = invoker.Invoke(args);

            // assert
            Assert.AreEqual(true, results["Succeeded"]);
        }
Пример #12
0
        public static void newvm(string[] tokens)
        {
            // Get user input
            string server = Dns.GetHostName();

            if (tokens.Length == 2)
            {
                server = tokens[1];
            }
            string name, vhdpath, vmswitch;

            Console.Write("Name: ");
            name = Console.ReadLine();
            Console.WriteLine($@"Default VHD Path is: C:\VHDs\{name}.vhdx");
            Console.Write("VHD Name (leave blank for default): ");
            vhdpath = Console.ReadLine();
            if (string.IsNullOrEmpty(vhdpath))
            {
                vhdpath = name;
            }
            Console.WriteLine("Available switches:");
            var switches = HyperV.GetVmSwitch(server);

            for (int i = 0; i < switches.Count; i++)
            {
                Console.WriteLine($"[{i}] { switches[i].Members["Name"].Value }");
            }
            vmswitch = switches[GetSelectedIndex()].Members["Name"].Value.ToString();

            // Parse JSON
            using (StreamReader reader = File.OpenText(@"Config\templates.json"))
            {
                JObject doc = (JObject)JToken.ReadFrom(new JsonTextReader(reader));
                Console.WriteLine("All available VM configurations:");
                for (int i = 0; i < doc["templates"].Count(); i++)
                {
                    Console.WriteLine($"[{ i }] { doc["templates"][i]["name"] }");
                }
                var config = doc["templates"][GetSelectedIndex()];
                PSWrapper.Execute(server, config, PsStreamEventHandlers.DefaultHandlers, name, vhdpath, vmswitch);
            }
        }
Пример #13
0
        public void Can_restore_the_last_snapshot_to_a_stopped_VM()
        {
            // arrange
            var target = new HyperV {
                Action = HyperVAction.ApplyLastSnapshot
            };

            Dictionary <string, object> args = new Dictionary <string, object>
            {
                { "ServerName", this.Server },
                { "VMName", this.VMName }
            };
            WorkflowInvoker invoker = new WorkflowInvoker(target);

            // act
            var results = invoker.Invoke(args);

            // assert
            Assert.AreEqual(true, results["Succeeded"]);
        }
Пример #14
0
        public ServerPropertyGrid(string hostName)
        {
            this.HostName = hostName;
            // Populate all
            PSObject psObj = null;

            new BackgroundWorkerQueueDialog("Getting server information...", ProgressBarStyle.Marquee)
            .AppendTask("", DummyWorker.GetWorker((ctx) => psObj = HyperV.GetVmHost(hostName, PsStreamEventHandlers.GetUIHandlers(ctx))))
            .ShowDialog();
            if (psObj == null)
            {
                return;
            }

            this.VirtualHardDiskPath       = (string)psObj.Members["VirtualHardDiskPath"].Value;
            this.VirtualMachinePath        = (string)psObj.Members["VirtualMachinePath"].Value;
            this.MacAddressMaximum         = (string)psObj.Members["MacAddressMaximum"].Value;
            this.MacAddressMinimum         = (string)psObj.Members["MacAddressMinimum"].Value;
            this.EnableEnhancedSessionMode = (bool)psObj.Members["EnableEnhancedSessionMode"].Value;
            this.MemoryCapacity            = (long)psObj.Members["MemoryCapacity"].Value;
            this.LogicalProcessorCount     = (int)psObj.Members["LogicalProcessorCount"].Value;
        }
Пример #15
0
        public void Can_restore_a_different_named_snapshot_to_a_stopped_VM()
        {
            // arrange
            var target = new HyperV {
                Action = HyperVAction.ApplyNamedSnapshot
            };

            Dictionary <string, object> args = new Dictionary <string, object>
            {
                { "ServerName", this.Server },
                { "VMName", this.VMName },
                { "SnapshotName", "TestVM" }
            };
            WorkflowInvoker invoker = new WorkflowInvoker(target);

            // act
            var results = invoker.Invoke(args);

            // assert
            // actually you see the error 32775
            Assert.AreEqual(true, results["Succeeded"]);
        }
Пример #16
0
        public InspectDiskDialog(string computer, string path)
        {
            InitializeComponent();
            var bg = new BackgroundWorkerQueueDialog("Getting information...", ProgressBarStyle.Marquee);

            bg.AppendTask("Getting information...", DummyWorker.GetWorker((ctx) =>
            {
                try
                {
                    pso   = HyperV.GetVhd(computer, path, PsStreamEventHandlers.GetUIHandlers(ctx))[0];
                    ctx.s = StatusCode.OK;
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message, "Exception", MessageBoxButtons.OK);
                    ctx.s = StatusCode.FAILED;
                }
                return(ctx);
            }));
            bg.ShowDialog();
            this.c = computer;
        }
Пример #17
0
        public static void getswitches(string[] tokens)
        {
            string server = Dns.GetHostName();

            if (tokens.Length == 2)
            {
                server = tokens[1];
            }
            PrintRow(new string[] { "Name", "NetAdapterInterfaceDescription", "SwitchType", "Id" });
            PrintLine();
            var switches = HyperV.GetVmSwitch(server);

            foreach (var obj in switches)
            {
                if ((string)obj.Members["SwitchType"].Value == "External")
                {
                    Console.ForegroundColor = ConsoleColor.Green;
                }
                else
                {
                    Console.ForegroundColor = ConsoleColor.Gray;
                }
                PrintRow(new string[]
                {
                    (string)obj.Members["Name"].Value,
                    (string)obj.Members["NetAdapterInterfaceDescription"].Value,
                    (string)obj.Members["SwitchType"].Value,
                    ((Guid)obj.Members["Id"].Value).ToString()
                });
                Console.ForegroundColor = ConsoleColor.White;
            }
            Console.WriteLine();
            foreach (var obj in switches)
            {
                Console.WriteLine(obj);
            }
        }
Пример #18
0
 private void UnsetBase(MasterTreeNode node)
 {
     if (node.Type != NodeType.VirtualMachines || node.VmType?.Value != VirtualMachineType.BASE)
     {
         return;
     }
     if (MessageBox.Show(
             "This action may corrupt all existing templates of this base VM. Data loss may occur. Are you sure you want to continue?",
             "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Hand) == DialogResult.No)
     {
         return;
     }
     try
     {
         HyperV.RestoreVmSnapshot(node.Host, node.Name, "Base Checkpoint DNR");
         HyperV.RemoveVmSnapshot(node.Host, node.Name, "Base Checkpoint DNR");
     }
     catch (Exception e)
     {
         MessageBox.Show(e.Message, "Exception", MessageBoxButtons.OK);
     }
     databaseManager.SetVmType(DbVirtualMachine.FromTreeNode(node), VirtualMachineType.NONE);
     RefreshUI();
 }
Пример #19
0
         public void Can_restore_a_different_named_snapshot_to_a_stopped_VM()
         {
             // arrange
             var target = new HyperV { Action = HyperVAction.ApplyNamedSnapshot };

             Dictionary<string, object> args = new Dictionary<string, object>
            {
                { "ServerName", this.Server },
                 { "VMName",  this.VMName },
                 { "SnapshotName", "TestVM" }
            };
             WorkflowInvoker invoker = new WorkflowInvoker(target);

             // act
             var results = invoker.Invoke(args);

             // assert
             // actually you see the error 32775
             Assert.AreEqual(true, results["Succeeded"]);
         }
Пример #20
0
        public void Validate(HiveDefinition hiveDefinition)
        {
            Covenant.Requires <ArgumentNullException>(hiveDefinition != null);

            switch (Environment)
            {
            case HostingEnvironments.Aws:

                if (Aws == null)
                {
                    throw new HiveDefinitionException($"[{nameof(HostingOptions)}.{nameof(Aws)}] must be initialized when cloud provider is [{Environment}].");
                }

                Aws.Validate(hiveDefinition);
                break;

            case HostingEnvironments.Azure:

                if (Azure == null)
                {
                    throw new HiveDefinitionException($"[{nameof(HostingOptions)}.{nameof(Azure)}] must be initialized when cloud provider is [{Environment}].");
                }

                Azure.Validate(hiveDefinition);
                break;

            case HostingEnvironments.Google:

                if (Google == null)
                {
                    throw new HiveDefinitionException($"[{nameof(HostingOptions)}.{nameof(Google)}] must be initialized when cloud provider is [{Environment}].");
                }

                Google.Validate(hiveDefinition);
                break;

            case HostingEnvironments.HyperV:

                HyperV = HyperV ?? new HyperVOptions();

                HyperV.Validate(hiveDefinition);
                break;

            case HostingEnvironments.HyperVDev:

                LocalHyperV = LocalHyperV ?? new LocalHyperVOptions();

                LocalHyperV.Validate(hiveDefinition);
                break;

            case HostingEnvironments.Machine:

                Machine = Machine ?? new MachineOptions();

                Machine.Validate(hiveDefinition);
                break;

            case HostingEnvironments.XenServer:

                XenServer = XenServer ?? new XenServerOptions();

                XenServer.Validate(hiveDefinition);
                break;

            default:

                throw new NotImplementedException();
            }

            if (IsCloudProvider && !hiveDefinition.Vpn.Enabled)
            {
                // VPN is implicitly enabled when hosting on a cloud.

                hiveDefinition.Vpn.Enabled = true;
            }

            if (!string.IsNullOrWhiteSpace(VmNamePrefix))
            {
                if (!HiveDefinition.IsValidName(VmNamePrefix))
                {
                    throw new HiveDefinitionException($"[{nameof(HostingOptions)}.{nameof(VmNamePrefix)}={VmNamePrefix}] must include only letters, digits, underscores, or periods.");
                }
            }
        }
Пример #21
0
        /// <summary>
        /// Validates the options and also ensures that all <c>null</c> properties are
        /// initialized to their default values.
        /// </summary>
        /// <param name="clusterDefinition">The cluster definition.</param>
        /// <exception cref="ClusterDefinitionException">Thrown if the definition is not valid.</exception>
        public void Validate(ClusterDefinition clusterDefinition)
        {
            Covenant.Requires <ArgumentNullException>(clusterDefinition != null, nameof(clusterDefinition));

            switch (Environment)
            {
            case HostingEnvironment.Aws:

                if (Aws == null)
                {
                    throw new ClusterDefinitionException($"[{nameof(ClusterDefinition.Hosting)}.{nameof(Aws)}] must be initialized when cloud provider is [{Environment}].");
                }

                Aws.Validate(clusterDefinition);

                Cloud = Cloud ?? new CloudOptions();
                Cloud.Validate(clusterDefinition);
                break;

            case HostingEnvironment.Azure:

                if (Azure == null)
                {
                    throw new ClusterDefinitionException($"[{nameof(ClusterDefinition.Hosting)}.{nameof(Azure)}] must be initialized when cloud provider is [{Environment}].");
                }

                Azure.Validate(clusterDefinition);

                Cloud = Cloud ?? new CloudOptions();
                Cloud.Validate(clusterDefinition);
                break;

            case HostingEnvironment.BareMetal:

                Machine = Machine ?? new MachineHostingOptions();
                Machine.Validate(clusterDefinition);
                break;

            case HostingEnvironment.Google:

                if (Google == null)
                {
                    throw new ClusterDefinitionException($"[{nameof(ClusterDefinition.Hosting)}.{nameof(Google)}] must be initialized when cloud provider is [{Environment}].");
                }

                Google.Validate(clusterDefinition);

                Cloud = Cloud ?? new CloudOptions();
                Cloud.Validate(clusterDefinition);
                break;

            case HostingEnvironment.HyperV:

                HyperV = HyperV ?? new HyperVHostingOptions();
                HyperV.Validate(clusterDefinition);

                Vm = Vm ?? new VmHostingOptions();
                Vm.Validate(clusterDefinition);
                break;

            case HostingEnvironment.XenServer:

                XenServer = XenServer ?? new XenServerHostingOptions();
                XenServer.Validate(clusterDefinition);

                Cloud = Cloud ?? new CloudOptions();
                Cloud.Validate(clusterDefinition);

                Vm = Vm ?? new VmHostingOptions();
                Vm.Validate(clusterDefinition);
                break;

            default:

                throw new NotImplementedException();
            }
        }
Пример #22
0
        public void Validate(ClusterDefinition clusterDefinition)
        {
            Covenant.Requires <ArgumentNullException>(clusterDefinition != null, nameof(clusterDefinition));

            switch (Environment)
            {
            case HostingEnvironments.Aws:

                if (Aws == null)
                {
                    throw new ClusterDefinitionException($"[{nameof(HostingOptions)}.{nameof(Aws)}] must be initialized when cloud provider is [{Environment}].");
                }

                Aws.Validate(clusterDefinition);
                break;

            case HostingEnvironments.Azure:

                if (Azure == null)
                {
                    throw new ClusterDefinitionException($"[{nameof(HostingOptions)}.{nameof(Azure)}] must be initialized when cloud provider is [{Environment}].");
                }

                Azure.Validate(clusterDefinition);
                break;

            case HostingEnvironments.Google:

                if (Google == null)
                {
                    throw new ClusterDefinitionException($"[{nameof(HostingOptions)}.{nameof(Google)}] must be initialized when cloud provider is [{Environment}].");
                }

                Google.Validate(clusterDefinition);
                break;

            case HostingEnvironments.HyperV:

                HyperV = HyperV ?? new HyperVOptions();

                HyperV.Validate(clusterDefinition);
                break;

            case HostingEnvironments.HyperVLocal:

                HyperVDev = HyperVDev ?? new LocalHyperVOptions();

                HyperVDev.Validate(clusterDefinition);
                break;

            case HostingEnvironments.Machine:

                Machine = Machine ?? new MachineOptions();

                Machine.Validate(clusterDefinition);
                break;

            case HostingEnvironments.XenServer:

                XenServer = XenServer ?? new XenServerOptions();

                XenServer.Validate(clusterDefinition);
                break;

            default:

                throw new NotImplementedException();
            }

            if (!string.IsNullOrWhiteSpace(VmNamePrefix))
            {
                if (!ClusterDefinition.IsValidName(VmNamePrefix))
                {
                    throw new ClusterDefinitionException($"[{nameof(HostingOptions)}.{nameof(VmNamePrefix)}={VmNamePrefix}] must include only letters, digits, underscores, or periods.");
                }
            }
        }
Пример #23
0
        public void Can_restore_the_last_snapshot_to_a_stopped_VM()
        {
            // arrange
            var target = new HyperV { Action = HyperVAction.ApplyLastSnapshot };

            Dictionary<string, object> args = new Dictionary<string, object>
            {
                { "ServerName", this.Server },
                 { "VMName",  this.VMName }
            };
            WorkflowInvoker invoker = new WorkflowInvoker(target);

            // act
            var results = invoker.Invoke(args);

            // assert
            Assert.AreEqual(true, results["Succeeded"]);
        }
Пример #24
0
        private bool ValidateTexts(bool flushCache = false)
        {
            // Clean!
            vms = null;
            if (flushCache)
            {
                _hn_cache = null;
            }

            // A clean alternative way to run consecutive network events
            BackgroundWorkerQueueDialog backgroundWorker = new BackgroundWorkerQueueDialog("Retrieving Network Information");

            backgroundWorker.AppendTask("Starting...", NetworkWorkers.GetStarterWorker(new NetworkWorkerObject
            {
                HostName   = hostnameText.Text,
                IpAddress  = ipText.Text,
                MacAddress = macText.Text
            }));
            backgroundWorker.AppendTask("Getting IP address from server...", NetworkWorkers.GetIpWorker());
            backgroundWorker.AppendTask("Getting MAC address from IP...", NetworkWorkers.GetMacWorker());
            backgroundWorker.ShowDialog();
            var v = backgroundWorker.GetWorker();

            // Set fields, only if the returned object has text - therefore preserving whatever was typed beforehand
            if (backgroundWorker.GetWorker().ReturnedObjects[1].s == StatusCode.OK)
            {
                ipText.Text = ((NetworkWorkerObject)backgroundWorker.GetWorker().ReturnedObjects[1].o).IpAddress;
            }
            if (backgroundWorker.GetWorker().ReturnedObjects[2].s == StatusCode.OK)
            {
                macText.Text = ((NetworkWorkerObject)backgroundWorker.GetWorker().ReturnedObjects[2].o).MacAddress;
            }

            // If something's empty/failed, let user know
            hostnameText.IsValid = (string.IsNullOrWhiteSpace(hostnameText.Text)) ?
                                   tribool.FALSE : tribool.TRUE;
            ipText.IsValid = (string.IsNullOrWhiteSpace(ipText.Text) ||
                              backgroundWorker.GetWorker().ReturnedObjects[1].s != StatusCode.OK) ?
                             tribool.FALSE : tribool.TRUE;
            macText.IsValid = (string.IsNullOrWhiteSpace(macText.Text) ||
                               backgroundWorker.GetWorker().ReturnedObjects[2].s != StatusCode.OK) ?
                              tribool.FALSE : tribool.TRUE;

            // Check if the PowerShell thing is on...
            backgroundWorker = new BackgroundWorkerQueueDialog("Checking for PSRemoting and WinRM...", ProgressBarStyle.Marquee);
            backgroundWorker.AppendTask("Pinging...", DummyWorker.GetWorker((ctx) =>
            {
                try
                {
                    Interface.BringOnline(hostnameText.Text);
                }
                catch (Exception e)
                {
                    MessageBox.Show(e.Message, "Exception", MessageBoxButtons.OK);
                    ctx.s = StatusCode.FAILED;
                    return(ctx);
                }
                ctx.s = StatusCode.OK;
                return(ctx);
            }));
            backgroundWorker.ShowDialog();
            if (backgroundWorker.GetWorker().ReturnedObjects[0].s != StatusCode.OK)
            {
                return(false);
            }

            // Get VMs
            // Check if the vms in the cache are different
            if (_hn_cache == hostnameText.Text)
            {
                return(true);
            }
            listBox1.Items.Clear();
            backgroundWorker = new BackgroundWorkerQueueDialog("Scanning for Virtual Machines...", ProgressBarStyle.Marquee);
            backgroundWorker.AppendTask("Getting machines...", DummyWorker.GetWorker(() =>
            {
                try
                {
                    _hn_cache = hostnameText.Text;
                    vms       = HyperV.GetVm(hostnameText.Text);
                    vms?.ForEach(x =>
                    {
                        ThreadManager.Invoke(this, listBox1, () =>
                                             listBox1.Items.Add(x.Name + " [" + x.Uuid.ToString().ToUpper() + "]"));
                    });
                }
                catch (Exception e)
                {
                    MessageBox.Show(e.Message, "Exception", MessageBoxButtons.OK);
                }
            }));
            backgroundWorker.ShowDialog();
            return(true);
        }