Exemplo n.º 1
0
        protected override AsyncAction CreateAction(out bool cancelled)
        {
            Program.AssertOnEventThread();
            cancelled = false;

            if (EmptySRDeviceConfigList)
                return null;

            Host master = pool.Connection.Resolve(pool.master);
            if (master == null)
                return null;

            List<AsyncAction> subActions = new List<AsyncAction>();
            foreach (SRDeviceConfig item in srDeviceConfigList)
            {
                if (item.DeviceConfig == null)
                    continue;

                ScannedDeviceInfo deviceInfo = new ScannedDeviceInfo(item.SR.GetSRType(true),
                                                                     item.DeviceConfig,
                                                                     item.SR.uuid);
                subActions.Add(new DrTaskCreateAction(pool.Connection, deviceInfo));
            }

            if (subActions.Count == 0)
                return null;

            return subActions.Count == 1
                       ? subActions[0]
                       : new ParallelAction(pool.Connection, Messages.ACTION_MULTIPLE_DR_TASK_CREATE_TITLE,
                                            Messages.ACTION_MULTIPLE_DR_TASK_CREATE_START,
                                            Messages.ACTION_MULTIPLE_DR_TASK_CREATE_END, subActions);
        }
 public DrTaskCreateAction(IXenConnection connection, ScannedDeviceInfo deviceInfo)
     : base(connection, Messages.ACTION_DR_TASK_CREATE_TITLE)
 {
     _deviceInfo = deviceInfo;
     #region RBAC Dependencies
     ApiMethodsToRoleCheck.AddRange(StaticRBACDependencies);
     #endregion
 }
Exemplo n.º 3
0
 public DrTaskCreateAction(IXenConnection connection, ScannedDeviceInfo deviceInfo)
     : base(connection, Messages.ACTION_DR_TASK_CREATE_TITLE)
 {
     _deviceInfo = deviceInfo;
     #region RBAC Dependencies
     ApiMethodsToRoleCheck.AddRange(StaticRBACDependencies);
     #endregion
 }
Exemplo n.º 4
0
        private List<AsyncAction> GetActions(Host master, bool disasterRecoveryTask)
        {
            // Now we need to decide what to do.
            // This will be one off create, introduce, reattach

            List<AsyncAction> finalActions = new List<AsyncAction>();
            actionSrDescriptorDict.Clear();

            foreach (var srDescriptor in m_srWizardType.SrDescriptors)
            {
                if (String.IsNullOrEmpty(srDescriptor.UUID))
                {
                    // Don't need to show any warning, as the only destructive creates
                    // are in iSCSI and HBA, where they show their own warning
                    finalActions.Add(new SrCreateAction(xenConnection, master,
                                                        srDescriptor.Name,
                                                        srDescriptor.Description,
                                                        m_srWizardType.Type,
                                                        m_srWizardType.ContentType,
                                                        !master.RestrictPoolAttachedStorage,
                                                        srDescriptor.DeviceConfig,
                                                        Program.StorageLinkConnections.GetCopy()));
                }
                else if (_srToReattach == null || _srToReattach.Connection != xenConnection)
                {
                    // introduce
                    if (disasterRecoveryTask &&
                        (_srToReattach == null || SR.SupportsDatabaseReplication(xenConnection, _srToReattach)))
                    {
                        // "Find existing SRs" or "Attach SR needed for DR" cases
                        ScannedDeviceInfo deviceInfo = new ScannedDeviceInfo(m_srWizardType.Type,
                                                                             srDescriptor.DeviceConfig,
                                                                             srDescriptor.UUID);
                        finalActions.Add(new DrTaskCreateAction(xenConnection, deviceInfo));
                    }
                    else
                        finalActions.Add(new SrIntroduceAction(xenConnection,
                                                               srDescriptor.UUID,
                                                               srDescriptor.Name,
                                                               srDescriptor.Description,
                                                               m_srWizardType.Type,
                                                               m_srWizardType.ContentType,
                                                               !master.RestrictPoolAttachedStorage,
                                                               srDescriptor.DeviceConfig));
                }
                else
                {
                    // Reattach
                    if (disasterRecoveryTask && SR.SupportsDatabaseReplication(xenConnection, _srToReattach))
                    {
                        // "Attach SR needed for DR" case
                        ScannedDeviceInfo deviceInfo = new ScannedDeviceInfo(_srToReattach.GetSRType(true),
                                                                             srDescriptor.DeviceConfig,
                                                                             _srToReattach.uuid);
                        finalActions.Add(new DrTaskCreateAction(xenConnection, deviceInfo));
                    }
                    else
                        finalActions.Add(new SrReattachAction(_srToReattach,
                                                              srDescriptor.Name,
                                                              srDescriptor.Description,
                                                              srDescriptor.DeviceConfig));
                }

                AsyncAction action = finalActions.Last();
                if (!actionSrDescriptorDict.ContainsKey(action))
                    actionSrDescriptorDict.Add(action, srDescriptor);
            }

            return finalActions;
        }
Exemplo n.º 5
0
        protected override AsyncAction CreateAction(out bool cancelled)
        {
            Program.AssertOnEventThread();
            cancelled = false;

            if (!sr.shared)
            {
                return null;
            }

            if (device_config == null) //no device config, we need to run the New SR wizard
            {
                NewSRWizard wizard = new NewSRWizard(pool.Connection, sr, null, true);
                wizard.ShowDialog(Program.MainWindow);
                return wizard.FinalAction;
            }

            Host master = pool.Connection.Resolve(pool.master);
            if (master == null)
            {
                return null;
            }

            ScannedDeviceInfo deviceInfo = new ScannedDeviceInfo(sr.GetSRType(true), device_config, sr.uuid);

            return new DrTaskCreateAction(pool.Connection, deviceInfo);
        }