private static VirtualTreeNode CreateCanonNode(IStorageLinkObject o)
 {
     return(new VirtualTreeNode(o.Name)
     {
         Tag = o,
         Name = o.opaque_ref,
         ImageIndex = (int)Images.GetIconFor(o),
         SelectedImageIndex = (int)Images.GetIconFor(o),
         ShowCheckBox = o is StorageLinkVolume
     });
 }
Esempio n. 2
0
        private void comboBoxStorageSystem_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (comboBoxStorageSystem.SelectedItem is NonSelectableComboBoxItem)
            {
                if (comboBoxStorageSystem.SelectedItem.ToString() == Messages.ADD_HOST)
                {
                    Program.BeginInvoke(Program.MainWindow, AddStorageSystem);
                    comboBoxStorageSystem.SelectedIndex = -1;
                }
                else if (comboBoxStorageSystem.SelectedIndex < comboBoxStorageSystem.Items.Count - 1 &&
                         (_storageSystemComboLastSelectedIndex < comboBoxStorageSystem.SelectedIndex || comboBoxStorageSystem.SelectedIndex == 0))
                {
                    _storageSystemComboLastSelectedIndex = comboBoxStorageSystem.SelectedIndex;
                    comboBoxStorageSystem.SelectedIndex++;
                }
                else
                {
                    _storageSystemComboLastSelectedIndex = comboBoxStorageSystem.SelectedIndex;
                    comboBoxStorageSystem.SelectedIndex--;
                }
            }
            else
            {
                _storageSystemComboLastSelectedIndex = comboBoxStorageSystem.SelectedIndex;
            }

            OnPageUpdated();

            if (comboBoxStorageSystem.SelectedIndex >= 0)
            {
                if (_storageLinkObject != null)
                {
                    // The user has changed which SL object to use using the storage-system combo-box so update that here.

                    if (_storageLinkObject is StorageLinkServer || _storageLinkObject is StorageLinkSystem)
                    {
                        _storageLinkObject = ((CslgSystemStorage)comboBoxStorageSystem.SelectedItem).StorageLinkSystem;
                    }
                    else
                    {
                        StorageLinkPool storageLinkPool = (StorageLinkPool)_storageLinkObject;

                        if (storageLinkPool.StorageLinkSystem != ((CslgSystemStorage)comboBoxStorageSystem.SelectedItem).StorageLinkSystem)
                        {
                            _storageLinkObject = ((CslgSystemStorage)comboBoxStorageSystem.SelectedItem).StorageLinkSystem;
                        }
                    }
                }
            }
        }
        protected override void ExecuteCore(SelectedItemCollection selection)
        {
            IStorageLinkObject sl     = (IStorageLinkObject)selection[0].XenObject;
            StorageLinkServer  server = sl.StorageLinkConnection.Cache.Server;

            if (server != null)
            {
                string address      = string.Empty;
                int    port         = 27000;
                var    getLicAction = new DelegatedAsyncAction(null,
                                                               string.Format(Messages.SET_STORAGELINK_LICENSE_SERVER_ACTION_TITLE, server.FriendlyName),
                                                               string.Format(Messages.SET_STORAGELINK_LICENSE_SERVER_ACTION_START, server.FriendlyName),
                                                               string.Format(Messages.SET_STORAGELINK_LICENSE_SERVER_ACTION_TITLE, server.FriendlyName),
                                                               session => server.StorageLinkConnection.GetLicenseServer(out address, out port));
                new ActionProgressDialog(getLicAction, ProgressBarStyle.Marquee).ShowDialog(Parent ?? Program.MainWindow);

                if (!getLicAction.Succeeded)
                {
                    address = string.Empty;
                    port    = 27000;
                }

                var dialog = new SetStorageLinkLicenseServerDialog(address, port);

                dialog.FormClosing += (s, e) =>
                {
                    if (dialog.DialogResult == DialogResult.OK)
                    {
                        address = dialog.Host;
                        port    = dialog.Port;

                        var action = new DelegatedAsyncAction(null,
                                                              string.Format(Messages.SET_STORAGELINK_LICENSE_SERVER_ACTION_TITLE, server.FriendlyName),
                                                              string.Format(Messages.SET_STORAGELINK_LICENSE_SERVER_ACTION_START, server.FriendlyName),
                                                              string.Format(Messages.SET_STORAGELINK_LICENSE_SERVER_ACTION_TITLE, server.FriendlyName),
                                                              session => server.StorageLinkConnection.SetLicenseServer(address, port));

                        action.AppliesTo.Add(server.opaque_ref);

                        new ActionProgressDialog(action, ProgressBarStyle.Marquee).ShowDialog(Parent);
                        e.Cancel = !action.Succeeded;
                    }
                };

                dialog.Show(Parent ?? Program.MainWindow);
            }
        }
Esempio n. 4
0
 public NewSRWizard(IXenConnection connection, SR srToReattach, IStorageLinkObject storageLinkObject)
     : this(connection, srToReattach, storageLinkObject, false)
 {
 }
Esempio n. 5
0
        internal NewSRWizard(IXenConnection connection, SR srToReattach, IStorageLinkObject storageLinkObject, bool disasterRecoveryTask)
            : base(connection)
        {
            InitializeComponent();

            xenTabPageSrName         = new NewSrWizardNamePage();
            xenTabPageCifsIso        = new CIFS_ISO();
            xenTabPageCifs           = new CifsFrontend();
            xenTabPageCslg           = new CSLG();
            xenTabPageVhdoNFS        = new VHDoNFS();
            xenTabPageNfsIso         = new NFS_ISO();
            xenTabPageNetApp         = new NetApp();
            xentabPageEqualLogic     = new EqualLogic();
            xenTabPageLvmoIscsi      = new LVMoISCSI();
            xenTabPageLvmoHba        = new LVMoHBA();
            xenTabPageLvmoFcoe       = new LVMoFCoE();
            xenTabPageLvmoHbaSummary = new LVMoHBASummary();
            xenTabPageCslgSettings   = new CslgSettings();
            xenTabPageCslgLocation   = new CslgLocation();
            xenTabPageFilerDetails   = new FilerDetails();
            xenTabPageChooseSrType   = new ChooseSrTypePage();
            xenTabPageRbacWarning    = new RBACWarningPage((srToReattach == null && !disasterRecoveryTask)
                             ? Messages.RBAC_WARNING_PAGE_DESCRIPTION_SR_CREATE
                             : Messages.RBAC_WARNING_PAGE_DESCRIPTION_SR_ATTACH);
            xenTabPageStorageProvisioningMethod = new StorageProvisioning();

            if (connection == null)
            {
                Util.ThrowIfParameterNull(storageLinkObject, "storageLinkObject");
            }
            if (storageLinkObject == null)
            {
                Util.ThrowIfParameterNull(connection, "connection");
            }
            if (storageLinkObject != null && connection != null)
            {
                throw new ArgumentException("connection must be null when passing in a storageLinkObject", "connection");
            }

            //do not use virtual members in constructor
            var format = (srToReattach == null && !disasterRecoveryTask)
                             ? Messages.NEWSR_TEXT
                             : Messages.NEWSR_TEXT_ATTACH;

            m_text = string.Format(format, xenConnection == null ? storageLinkObject.ToString() : Helpers.GetName(xenConnection));

            _srToReattach = srToReattach;

            xenTabPageChooseSrType.SrToReattach         = srToReattach;
            xenTabPageChooseSrType.DisasterRecoveryTask = disasterRecoveryTask;
            xenTabPageCslg.SetStorageLinkObject(storageLinkObject);

            // Order the tab pages
            AddPage(xenTabPageChooseSrType);
            AddPage(xenTabPageSrName);
            AddPage(new XenTabPage {
                Text = Messages.NEWSR_LOCATION
            });

            // RBAC warning page
            _rbac = (xenConnection != null && !xenConnection.Session.IsLocalSuperuser) &&
                    Helpers.GetMaster(xenConnection).external_auth_type != Auth.AUTH_TYPE_NONE;
            if (_rbac)
            {
                // if reattaching, add "Permission checks" page after "Name" page, otherwise as first page (Ref. CA-61525)
                if (_srToReattach != null)
                {
                    AddAfterPage(xenTabPageSrName, xenTabPageRbacWarning);
                }
                else
                {
                    AddPage(xenTabPageRbacWarning, 0);
                }
                ConfigureRbacPage(disasterRecoveryTask);
            }
        }
Esempio n. 6
0
 public void SetStorageLinkObject(IStorageLinkObject storageLinkObject)
 {
     _storageLinkObject = storageLinkObject;
 }
Esempio n. 7
0
        internal NewSRWizard(IXenConnection connection, SR srToReattach, IStorageLinkObject storageLinkObject, bool disasterRecoveryTask)
            : base(connection)
        {
            InitializeComponent();

            xenTabPageSrName = new NewSrWizardNamePage();
            xenTabPageCifsIso = new CIFS_ISO();
            xenTabPageCslg = new CSLG();
            xenTabPageVhdoNFS = new VHDoNFS();
            xenTabPageNfsIso = new NFS_ISO();
            xenTabPageNetApp = new NetApp();
            xentabPageEqualLogic = new EqualLogic();
            xenTabPageLvmoIscsi = new LVMoISCSI();
            xenTabPageLvmoHba = new LVMoHBA();
            xenTabPageLvmoHbaSummary = new LVMoHBASummary();
            xenTabPageCslgSettings = new CslgSettings();
            xenTabPageCslgLocation = new CslgLocation();
            xenTabPageFilerDetails = new FilerDetails();
            xenTabPageChooseSrType = new ChooseSrTypePage();
            xenTabPageRbacWarning = new RBACWarningPage((srToReattach == null && !disasterRecoveryTask)
                             ? Messages.RBAC_WARNING_PAGE_DESCRIPTION_SR_CREATE
                             : Messages.RBAC_WARNING_PAGE_DESCRIPTION_SR_ATTACH);

            if (connection == null)
                Util.ThrowIfParameterNull(storageLinkObject, "storageLinkObject");
            if (storageLinkObject == null)
                Util.ThrowIfParameterNull(connection, "connection");
            if (storageLinkObject != null && connection != null)
                throw new ArgumentException("connection must be null when passing in a storageLinkObject", "connection");

            //do not use virtual members in constructor
            var format = (srToReattach == null && !disasterRecoveryTask)
                             ? Messages.NEWSR_TEXT
                             : Messages.NEWSR_TEXT_ATTACH;
            m_text = string.Format(format, xenConnection == null ? storageLinkObject.ToString() : Helpers.GetName(xenConnection));

            _srToReattach = srToReattach;

            xenTabPageChooseSrType.SrToReattach = srToReattach;
            xenTabPageChooseSrType.DisasterRecoveryTask = disasterRecoveryTask;
            xenTabPageCslg.SetStorageLinkObject(storageLinkObject);

            // Order the tab pages
            AddPage(xenTabPageChooseSrType);
            AddPage(xenTabPageSrName);
            AddPage(new XenTabPage {Text = Messages.NEWSR_LOCATION});

            // RBAC warning page
            _rbac = (xenConnection != null && !xenConnection.Session.IsLocalSuperuser) &&
                   Helpers.GetMaster(xenConnection).external_auth_type != Auth.AUTH_TYPE_NONE;
            if (_rbac)
            {
                // if reattaching, add "Permission checks" page after "Name" page, otherwise as first page (Ref. CA-61525)
                if (_srToReattach != null)
                    AddAfterPage(xenTabPageSrName, xenTabPageRbacWarning);
                else
                    AddPage(xenTabPageRbacWarning, 0);
                ConfigureRbacPage(disasterRecoveryTask);
            }
        }
Esempio n. 8
0
 public NewSRWizard(IXenConnection connection, SR srToReattach, IStorageLinkObject storageLinkObject)
     : this(connection, srToReattach, storageLinkObject, false)
 {
 }
Esempio n. 9
0
        private void comboBoxStorageSystem_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (comboBoxStorageSystem.SelectedItem is NonSelectableComboBoxItem)
            {
                if (comboBoxStorageSystem.SelectedItem.ToString() == Messages.ADD_HOST)
                {
                    Program.BeginInvoke(Program.MainWindow, AddStorageSystem);
                    comboBoxStorageSystem.SelectedIndex = -1;
                }
                else if (comboBoxStorageSystem.SelectedIndex < comboBoxStorageSystem.Items.Count - 1 &&
                    (_storageSystemComboLastSelectedIndex < comboBoxStorageSystem.SelectedIndex || comboBoxStorageSystem.SelectedIndex == 0))
                {
                    _storageSystemComboLastSelectedIndex = comboBoxStorageSystem.SelectedIndex;
                    comboBoxStorageSystem.SelectedIndex++;
                }
                else
                {
                    _storageSystemComboLastSelectedIndex = comboBoxStorageSystem.SelectedIndex;
                    comboBoxStorageSystem.SelectedIndex--;
                }
            }
            else
            {
                _storageSystemComboLastSelectedIndex = comboBoxStorageSystem.SelectedIndex;
            }

            OnPageUpdated();

            if (comboBoxStorageSystem.SelectedIndex >= 0)
            {
                if (_storageLinkObject != null)
                {
                    // The user has changed which SL object to use using the storage-system combo-box so update that here.

                    if (_storageLinkObject is StorageLinkServer || _storageLinkObject is StorageLinkSystem)
                    {
                        _storageLinkObject = ((CslgSystemStorage)comboBoxStorageSystem.SelectedItem).StorageLinkSystem;
                    }
                    else
                    {
                        StorageLinkPool storageLinkPool = (StorageLinkPool)_storageLinkObject;

                        if (storageLinkPool.StorageLinkSystem != ((CslgSystemStorage)comboBoxStorageSystem.SelectedItem).StorageLinkSystem)
                        {
                            _storageLinkObject = ((CslgSystemStorage)comboBoxStorageSystem.SelectedItem).StorageLinkSystem;
                        }
                    }
                }
            }
        }
Esempio n. 10
0
 public void SetStorageLinkObject(IStorageLinkObject storageLinkObject)
 {
     _storageLinkObject = storageLinkObject;
 }
 private static VirtualTreeNode CreateCanonNode(IStorageLinkObject o)
 {
     return new VirtualTreeNode(o.Name)
     {
         Tag = o,
         Name = o.opaque_ref,
         ImageIndex = (int)Images.GetIconFor(o),
         SelectedImageIndex = (int)Images.GetIconFor(o),
         ShowCheckBox = o is StorageLinkVolume
     };
 }