Exemplo n.º 1
0
        private void PropertiesButton_Click(object sender, EventArgs e)
        {
            if (NetworksGridView.SelectedRows.Count <= 0)
            {
                return;
            }

            NetworkListViewItem selectedItem = ((NetworkListViewItem)NetworksGridView.SelectedRows[0]);

            VIF newVif;

            using (var dialog = new VIFDialog(Connection, selectedItem.Vif, selectedItem.Index, Template.HasSriovRecommendation()))
            {
                if (dialog.ShowDialog() != DialogResult.OK)
                {
                    return;
                }

                newVif = dialog.NewVif();
            }

            selectedItem.Vif = newVif;
            selectedItem.UpdateDetails();

            UpdateEnablement();
        }
Exemplo n.º 2
0
        private void AddNetworkButton_Click(object sender, EventArgs e)
        {
            if (XenObject is VM)
            {
                VM vm = (VM)_xenObject;

                if (NetworksGridView.Rows.Count >= vm.MaxVIFsAllowed())
                {
                    using (var dlg = new ThreeButtonDialog(
                               new ThreeButtonDialog.Details(
                                   SystemIcons.Error,
                                   FriendlyErrorNames.VIFS_MAX_ALLOWED,
                                   FriendlyErrorNames.VIFS_MAX_ALLOWED_TITLE)))
                    {
                        dlg.ShowDialog(Program.MainWindow);
                    }
                    return;
                }

                Host master = Helpers.GetMaster(vm.Connection);
                if (master == null)
                {
                    // Cache populating?
                    return;
                }

                VIF pVif;
                using (var d = new VIFDialog(vm.Connection, null, VIF.GetDeviceId(vm), vm.HasSriovRecommendation()))
                {
                    if (d.ShowDialog(this) != DialogResult.OK)
                    {
                        return;
                    }

                    pVif = d.GetNewSettings();
                }

                pVif.VM = new XenRef <VM>(vm.opaque_ref);
                var action = new CreateVIFAction(vm, pVif);
                action.Completed += createVIFAction_Completed;
                action.RunAsync();
            }
            else if (XenObject is Host)
            {
                Host host = (Host)_xenObject;
                Program.MainWindow.ShowPerConnectionWizard(_xenObject.Connection,
                                                           new NewNetworkWizard(_xenObject.Connection, null, host));
            }
            else if (XenObject is Pool)
            {
                Pool pool = (Pool)_xenObject;
                Host host = pool.Connection.Resolve(pool.master);
                if (host != null)
                {
                    Program.MainWindow.ShowPerConnectionWizard(_xenObject.Connection,
                                                               new NewNetworkWizard(_xenObject.Connection, pool, host));
                }
            }
        }
Exemplo n.º 3
0
        private void AddButton_Click(object sender, EventArgs e)
        {
            VIFDialog dialog = new VIFDialog(Connection, null, NetworksGridView.Rows.Count);

            if (dialog.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            NetworksGridView.Rows.Add(new NetworkListViewItem(Connection, dialog.NewVif(), NetworksGridView.Rows.Count, true));
            UpdateEnablement();
        }
Exemplo n.º 4
0
        private void AddNetworkButton_Click(object sender, EventArgs e)
        {
            if (XenObject is VM)
            {
                VM vm = (VM)_xenObject;

                if (NetworksGridView.Rows.Count >= vm.MaxVIFsAllowed)
                {
                    new ThreeButtonDialog(
                        new ThreeButtonDialog.Details(
                            SystemIcons.Error,
                            FriendlyErrorNames.VIFS_MAX_ALLOWED,
                            FriendlyErrorNames.VIFS_MAX_ALLOWED_TITLE)).ShowDialog(Program.MainWindow);
                    return;
                }

                Host master = Helpers.GetMaster(vm.Connection);
                if (master == null)
                {
                    // Cache populating?
                    return;
                }
                VIFDialog d = new VIFDialog(vm.Connection, null, VIF.GetDeviceId(vm));
                if (d.ShowDialog(this) != DialogResult.OK)
                {
                    return;
                }

                Proxy_VIF pVif = d.GetNewSettings();
                pVif.VM = vm.opaque_ref;
                CreateVIFCommand action = new CreateVIFCommand(Program.MainWindow, vm, pVif);
                action.Execute();
            }
            else if (XenObject is Host)
            {
                Host host = (Host)_xenObject;
                Program.MainWindow.ShowPerConnectionWizard(_xenObject.Connection,
                                                           new NewNetworkWizard(_xenObject.Connection, null, host));
            }
            else if (XenObject is Pool)
            {
                Pool pool = (Pool)_xenObject;
                Host host = pool.Connection.Resolve(pool.master);
                if (host != null)
                {
                    Program.MainWindow.ShowPerConnectionWizard(_xenObject.Connection,
                                                               new NewNetworkWizard(_xenObject.Connection, pool, host));
                }
            }
        }
Exemplo n.º 5
0
        private void AddButton_Click(object sender, EventArgs e)
        {
            VIF newVif;

            using (var dialog = new VIFDialog(Connection, null, NetworksGridView.Rows.Count, Template.HasSriovRecommendation()))
            {
                if (dialog.ShowDialog() != DialogResult.OK)
                {
                    return;
                }

                newVif = dialog.NewVif();
            }

            NetworksGridView.Rows.Add(new NetworkListViewItem(Connection, newVif, NetworksGridView.Rows.Count, true));
            UpdateEnablement();
        }
Exemplo n.º 6
0
        private void launchVmNetworkSettingsDialog()
        {
            VM  vm  = XenObject as VM;
            VIF vif = SelectedVif;

            if (vm == null || vif == null)
            {
                return;
            }

            int device;

            if (!int.TryParse(vif.device, out device))
            {
                log.ErrorFormat("Aborting vif edit. Could not parse existing vif device to int. Value is: '{0}'", vif.device);
                return;
            }

            VIF proxyVIF;

            using (var d = new VIFDialog(vm.Connection, vif, device, vm.HasSriovRecommendation()))
            {
                if (d.ShowDialog() != DialogResult.OK)
                {
                    return;
                }

                proxyVIF = d.GetNewSettings();
            }

            var action = new UpdateVIFAction(vm, vif, proxyVIF);

            action.Completed += updateVIFAction_Completed;
            InBuildList       = true;
            action.RunAsync();
        }