public ChangeStorageLinkPasswordDialog(StorageLinkConnection connection) { Util.ThrowIfParameterNull(connection, "connection"); _connection = connection; InitializeComponent(); UsernameTextBox.Text = "admin"; label1.Text = string.Format(Messages.CHANGE_SL_SERVER_PASSWORD_DIALOG_TEXT, connection.Host); }
public StorageLinkJobInfo(StorageLinkConnection storageLinkConnection, string jobId, int progress, string title, string description, DateTime completedDate, StorageLinkEnums.JobState state, string errorMessage) { Util.ThrowIfParameterNull(storageLinkConnection, "storageLinkConnection"); StorageLinkConnection = storageLinkConnection; JobId = jobId; Progress = progress; Title = title; Description = description; CompletedDate = completedDate; State = state; ErrorMessage = errorMessage; }
public AddStorageLinkSystemDialog(StorageLinkConnection storageLinkConnection) { Util.ThrowIfParameterNull(storageLinkConnection, "storageLinkConnection"); _storageLinkConnection = storageLinkConnection; InitializeComponent(); StorageAdapterComboBox.Items.AddRange(Util.PopulateList<object>(storageLinkConnection.Cache.StorageAdapters).ToArray()); if (StorageAdapterComboBox.Items.Count > 0) { StorageAdapterComboBox.SelectedIndex = 0; } }
/// <summary> /// Initializes a new instance of the <see cref="ChangeStorageLinkPasswordAction"/> class. /// /// You need to be a pool-operator or higher to even get access to the password for the storagelink service. /// /// </summary> /// <param name="storageLinkConnection">The storage link connection.</param> /// <param name="username">The username.</param> /// <param name="oldPassword">The old password.</param> /// <param name="newPassword">The new password.</param> public ChangeStorageLinkPasswordAction(IEnumerable<IXenConnection> xenConnections,StorageLinkConnection storageLinkConnection, string username, string oldPassword, string newPassword) : base(null, Messages.CHANGE_SL_SERVER_PASSWORD_ACTION_TITLE, Messages.CHANGE_SL_SERVER_PASSWORD_ACTION_DES_START) { Util.ThrowIfParameterNull(storageLinkConnection, "storageLinkConnection"); Util.ThrowIfStringParameterNullOrEmpty(username, "username"); Util.ThrowIfParameterNull(oldPassword, "oldPassword"); Util.ThrowIfParameterNull(newPassword, "newPassword"); _storageLinkConnection = storageLinkConnection; _username = username; _oldPassword = oldPassword; _newPassword = newPassword; _xenConnections = xenConnections; AppliesTo.Add(storageLinkConnection.Cache.Server.opaque_ref); AppliesTo.AddRange(GetPoolsToCheck().ConvertAll(p => p.opaque_ref)); }
public SrCreateAction(IXenConnection connection, Host host, string srName, string srDescription, SR.SRTypes srType, string srContentType, bool srIsShared, Dictionary<string, string> dconf, List<StorageLinkConnection> copyStorageLinkConnections) : base(connection, string.Format(Messages.ACTION_SR_CREATING_TITLE, XenAPI.SR.getFriendlyTypeName(srType), srName, Helpers.GetName(connection))) { Host = host; Pool = Helpers.GetPool(connection); _srName = srName; _srDescription = srDescription; _srType = srType; _srContentType = srContentType; _srIsShared = srIsShared; _dconf = dconf; if (_srType == SR.SRTypes.cslg && !Helpers.BostonOrGreater(connection)) _SLConnection = copyStorageLinkConnections.Find(s => s.Host == _dconf["target"]); #region RBAC Dependencies ApiMethodsToRoleCheck.AddRange(StaticRBACDependencies); ApiMethodsToRoleCheck.AddRange(Role.CommonSessionApiList); if (isFirstSharedNonISOSR()) // for SrAction(SrActionKind.SetAsDefault) { ApiMethodsToRoleCheck.Add("pool.set_name_label"); ApiMethodsToRoleCheck.Add("pool.set_name_description"); ApiMethodsToRoleCheck.Add("pool.set_default_SR"); ApiMethodsToRoleCheck.Add("pool.set_suspend_image_SR"); ApiMethodsToRoleCheck.Add("pool.set_crash_dump_SR"); ApiMethodsToRoleCheck.Add("pool.set_other_config"); ApiMethodsToRoleCheck.Add("pool.set_ha_allow_overcommit"); ApiMethodsToRoleCheck.Add("pool.set_tags"); ApiMethodsToRoleCheck.Add("pool.set_gui_config"); ApiMethodsToRoleCheck.Add("pool.set_wlb_enabled"); ApiMethodsToRoleCheck.Add("pool.set_wlb_verify_cert"); } #endregion }
public override bool Equals(object obj) { StorageLinkConnection other = obj as StorageLinkConnection; return(other != null && other.Host == Host && other.Username == Username); }
/// <summary> /// Runs this instance. /// </summary> protected override void Run() { Dictionary<String, String> dconf = GetAuthenticationDeviceConfig(); Log.DebugFormat("Attempting to find SRs on CSLG {0}.", dconf["target"]); if (Connection != null && Helpers.MidnightRideOrGreater(Connection) && !Helpers.CowleyOrGreater(Connection)) { RunProbe(dconf); _cslgSystemStorages = new ReadOnlyCollection<CslgSystemStorage>(ParseStorageSystemsXml(Util.GetContentsOfValueNode(Result))); } else if (Connection != null && Helpers.BostonOrGreater(Connection)) { dconf["adapterid"] = _adapterid; RunProbe(dconf); if (!string.IsNullOrEmpty(Result)) _cslgSystemStorages = new ReadOnlyCollection<CslgSystemStorage>(ParseStorageSystemsXml(Util.GetContentsOfValueNode(Result))); } else { bool created = false; if (Connection != null) { // There will be no connection if a storagelink-object is selected in the tree. string secretRef = Secret.get_by_uuid(Connection.Session, dconf["password_secret"]); string password = Secret.get_value(Connection.Session, secretRef); StorageLinkConnection = _SLConnections.Find(c => c.Host == dconf["target"] && c.Username == dconf["username"] && c.Password == password); if (StorageLinkConnection == null) { // the user has clicked the "test connection" button in the properties dialog then // the storagelink connection won't exist in the Program.StorageLinkConnections collection. StorageLinkConnection = new StorageLinkConnection(_invoker, dconf["target"], dconf["username"], password); StorageLinkConnection.BeginConnect(); created = true; } } else { StorageLinkConnection = _SLConnections.Find(c => c.Host == dconf["target"] && c.Username == dconf["username"]); } try { var list = new List<CslgSystemStorage>(); // wait for storagelink connection to finish populating for (int i = 0; i < 600 && StorageLinkConnection.ConnectionState == StorageLinkConnectionState.Connecting; i++) { Thread.Sleep(100); } if (!string.IsNullOrEmpty(StorageLinkConnection.Error)) { throw new InvalidOperationException(StorageLinkConnection.Error); } if (StorageLinkConnection.ConnectionState != StorageLinkConnectionState.Connected) { throw new InvalidOperationException(string.Format(Messages.STORAGELINK_UNABLE_TO_CONNECT, dconf["target"])); } foreach (StorageLinkSystem s in StorageLinkConnection.Cache.StorageSystems) { var provisioningOptions = new List<CslgParameter> { new CslgParameter(null, Messages.NEWSR_CSLG_NONE) }; if ((s.Capabilities & StorageLinkEnums.StorageSystemCapabilities.POOL_LEVEL_DEDUPLICATION) != 0) { provisioningOptions.Add(new CslgParameter("DEDUP", Messages.NEWSR_CSLG_DEDUPLICATION)); } var protocols = new List<CslgParameter> { new CslgParameter(null, Messages.NEWSR_CSLG_AUTO) }; if ((s.Capabilities & StorageLinkEnums.StorageSystemCapabilities.ISCSI) != 0) { protocols.Add(new CslgParameter("ISCSI", Messages.NEWSR_CSLG_ISCSI)); } if ((s.Capabilities & StorageLinkEnums.StorageSystemCapabilities.FIBRE_CHANNEL) != 0) { protocols.Add(new CslgParameter("FC", Messages.NEWSR_CSLG_FC)); } list.Add(new CslgSystemStorage(s.ToString(), s.StorageSystemId, protocols, provisioningOptions, false, s)); } _cslgSystemStorages = new ReadOnlyCollection<CslgSystemStorage>(list); } finally { if (created) { StorageLinkConnection.EndConnect(); } } } }
public void SetUp() { _ws = new MockStorageLinkWebService("Mock", "bla", "bla"); _con = new StorageLinkConnection(null, _ws); }
public CreatedMockStorageLinkConnectionEventArgs(MockStorageLinkWebService mockWebService, StorageLinkConnection storageLinkConnection) { Util.ThrowIfParameterNull(storageLinkConnection, "connection"); MockWebService = mockWebService; StorageLinkConnection = storageLinkConnection; }
public EventListener(StorageLinkConnection connection) { _connection = connection; }