/// <summary> /// Won't appear in the program history (SuppressHistory == true). /// </summary> /// <param name="masterUuid">The UUID of the host from which to perform the probe (usually the pool master).</param> /// <param name="srType">netapp or iscsi</param> public SrProbeAction(IXenConnection connection, Host host, SR.SRTypes srType, Dictionary <String, String> dconf) : base(connection, string.Format(Messages.ACTION_SCANNING_SR_FROM, Helpers.GetName(connection)), null, true) { this.host = host; this.srType = srType; this.dconf = dconf; switch (srType) { case XenAPI.SR.SRTypes.nfs: Description = string.Format(Messages.ACTION_SR_SCANNING, XenAPI.SR.getFriendlyTypeName(srType), dconf["server"]); break; case XenAPI.SR.SRTypes.lvmoiscsi: Description = string.Format(Messages.ACTION_SR_SCANNING, XenAPI.SR.getFriendlyTypeName(srType), dconf["target"]); break; case XenAPI.SR.SRTypes.lvmohba: String device = dconf.ContainsKey(DEVICE) ? dconf[DEVICE] : dconf[SCSIid]; Description = string.Format(Messages.ACTION_SR_SCANNING, XenAPI.SR.getFriendlyTypeName(srType), device); break; default: Description = string.Format(Messages.ACTION_SR_SCANNING, XenAPI.SR.getFriendlyTypeName(srType), Messages.REPAIRSR_SERVER); // this is a bit minging: CA-22111 break; } smconf = new Dictionary <string, string>(); }
/// <summary> /// Won't appear in the program history (SuppressHistory == true). /// </summary> /// <param name="masterUuid">The UUID of the host from which to perform the probe (usually the pool master).</param> /// <param name="srType">netapp or iscsi</param> public SrProbeAction(IXenConnection connection, Host host, SR.SRTypes srType, Dictionary<String, String> dconf) : base(connection, string.Format(Messages.ACTION_SCANNING_SR_FROM, Helpers.GetName(connection)), null, true) { this.host = host; this.srType = srType; this.dconf = dconf; switch (srType) { case XenAPI.SR.SRTypes.nfs: Description = string.Format(Messages.ACTION_SR_SCANNING, XenAPI.SR.getFriendlyTypeName(srType), dconf["server"]); break; case XenAPI.SR.SRTypes.lvmoiscsi: Description = string.Format(Messages.ACTION_SR_SCANNING, XenAPI.SR.getFriendlyTypeName(srType), dconf["target"]); break; case XenAPI.SR.SRTypes.lvmohba: String device = dconf.ContainsKey(DEVICE) ? dconf[DEVICE] : dconf[SCSIid]; Description = string.Format(Messages.ACTION_SR_SCANNING, XenAPI.SR.getFriendlyTypeName(srType), device); break; default: Description = string.Format(Messages.ACTION_SR_SCANNING, XenAPI.SR.getFriendlyTypeName(srType), Messages.REPAIRSR_SERVER); // this is a bit minging: CA-22111 break; } smconf = new Dictionary<string, string>(); }
public LVMoHBAWarningDialogLauncher(IWin32Window owner, Dictionary <FibreChannelDescriptor, FibreChannelDescriptor> srDescriptors, SR.SRTypes requestedSrType) { this.owner = owner; inputSrDescriptors = srDescriptors; this.requestedSrType = requestedSrType; SrDescriptors = new List <FibreChannelDescriptor>(); }
private bool RunProbe(Host master, SR.SRTypes srType, out List <SR.SRInfo> srs) { srs = new List <SR.SRInfo>(); var dconf = GetDeviceConfig(srType); if (dconf == null) { return(false); } var action = new SrProbeAction(Connection, master, srType, dconf); using (var dialog = new ActionProgressDialog(action, ProgressBarStyle.Marquee) { ShowCancel = true }) dialog.ShowDialog(this); srs = action.SRs ?? new List <SR.SRInfo>(); if (action.Succeeded) { return(true); } HandleFailure(action); return(false); }
private bool ScanDeviceForSRs(SR.SRTypes type, string deviceId, Dictionary <string, string> dconf) { Host master = Helpers.GetMaster(Connection); if (master == null || dconf == null) { return(false); } Dictionary <string, string> smconf = new Dictionary <string, string>(); smconf[METADATA] = "true"; // Start probe SrProbeAction srProbeAction = new SrProbeAction(Connection, master, type, dconf, smconf); using (var dlg = new ActionProgressDialog(srProbeAction, ProgressBarStyle.Marquee)) dlg.ShowDialog(this); if (!srProbeAction.Succeeded) { return(false); } try { List <SR.SRInfo> srList = SR.ParseSRListXML(srProbeAction.Result); List <SR.SRInfo> metadataSrs = srList; //srList.Where(srInfo => srInfo.PoolMetadataDetected).ToList(); if (ScannedDevices.ContainsKey(deviceId)) { //update SR list ScannedDevices[deviceId].SRList.Clear(); ScannedDevices[deviceId].SRList.AddRange(metadataSrs); } else { ScannedDevices.Add(deviceId, new ScannedDeviceInfo(type, dconf, metadataSrs)); } foreach (SR.SRInfo srInfo in metadataSrs) { SrRow row; if (!FindRowByUuid(srInfo.UUID, out row)) { row = new SrRow(srInfo, type, srInfo.PoolMetadataDetected, srInfo.PoolMetadataDetected); dataGridViewSRs.Rows.Add(row); ToggleRowChecked(row); } } return(true); } catch { return(false); } }
public LVMoHBAWarningDialogLauncher(IWin32Window owner, List <FibreChannelDescriptor> srDescriptors, bool foundExistingSRs, SR.SRTypes requestedSrType) { this.owner = owner; this.foundExistingSRs = foundExistingSRs; inputSrDescriptors = srDescriptors; this.requestedSrType = requestedSrType; SrDescriptors = new List <FibreChannelDescriptor>(); }
public FibreChannelProbeAction(Host master, SR.SRTypes srType = SR.SRTypes.lvmohba) : base(master.Connection, string.Format(Messages.PROBING_HBA_TITLE, master.Name()), null, true) { Host = master; this.srType = srType; #region RBAC Dependencies ApiMethodsToRoleCheck.Add(srType != SR.SRTypes.gfs2 ? "SR.probe" : "SR.probe_ext"); #endregion }
private void ScanForSRs(SR.SRTypes type) { var srs = new List <SR.SRInfo>(); switch (type) { case SR.SRTypes.lvmohba: var devices = FiberChannelScan(); if (devices != null && devices.Count > 0) { foreach (FibreChannelDevice device in devices) { string deviceId = string.IsNullOrEmpty(device.SCSIid) ? device.Path : device.SCSIid; var metadataSrs = ScanDeviceForSRs(SR.SRTypes.lvmohba, deviceId, new Dictionary <string, string> { { SCSIID, device.SCSIid } }); if (metadataSrs != null && metadataSrs.Count > 0) { srs.AddRange(metadataSrs); } } } AddScanResultsToDataGridView(srs, SR.SRTypes.lvmohba); break; case SR.SRTypes.lvmoiscsi: using (var dialog = new IscsiDeviceConfigDialog(Connection)) { if (dialog.ShowDialog(this) == DialogResult.OK) { Dictionary <String, String> dconf = dialog.DeviceConfig; string deviceId = string.IsNullOrEmpty(dconf[SCSIID]) ? dconf[LUNSERIAL] : dconf[SCSIID]; var metadataSrs = ScanDeviceForSRs(SR.SRTypes.lvmoiscsi, deviceId, dconf); if (metadataSrs != null && metadataSrs.Count > 0) { srs.AddRange(metadataSrs); } } else { // if the user cancels the dialog there is no need to show the "no SRs found" pop-up return; } } AddScanResultsToDataGridView(srs, SR.SRTypes.lvmoiscsi); break; } if (srs.Count == 0) { using (var dlg = new InformationDialog(Messages.DR_WIZARD_STORAGEPAGE_SCAN_RESULT_NONE)) dlg.ShowDialog(this); } }
public SrScanAction(IXenConnection connection, string hostname, string username, string password, SR.SRTypes type) : base(connection, String.Format(Messages.ACTION_SR_SCAN_NAME, hostname), String.Format(Messages.ACTION_SR_SCAN_DESCRIPTION, XenAPI.SR.getFriendlyTypeName(type), hostname), true) { this.hostname = hostname; this.username = username; this.password = password; this.type = type; }
private UserSelectedOption GetSelectedOption(FibreChannelDescriptor descriptor, int remainingCount, bool foundExistingSr, SR.SRTypes existingSrType, out bool repeatForRemainingLUNs) { using (var dialog = new LVMoHBAWarningDialog(descriptor.Device, remainingCount, foundExistingSr, existingSrType, requestedSrType)) { dialog.ShowDialog(owner); repeatForRemainingLUNs = dialog.RepeatForRemainingLUNs; return(dialog.SelectedOption); } }
private bool RunProbe(Host master, SR.SRTypes srType, out List <SR.SRInfo> srs) { srs = null; Dictionary <String, String> dconf = GetDeviceConfig(srType); if (dconf == null) { return(false); } var action = new SrProbeAction(Connection, master, srType, dconf); using (var dialog = new ActionProgressDialog(action, ProgressBarStyle.Marquee)) { dialog.ShowCancel = true; dialog.ShowDialog(this); } _srToIntroduce = null; if (action.Succeeded) { try { srs = action.ProbeExtResult != null?SR.ParseSRList(action.ProbeExtResult) : SR.ParseSRListXML(action.Result); return(true); } catch (Exception) { return(false); } } Exception exn = action.Exception; log.Warn(exn, exn); Failure failure = exn as Failure; if (failure != null) { errorIconAtHostOrIP.Visible = true; errorLabelAtHostname.Visible = true; errorLabelAtHostname.Text = failure.ErrorDescription[0] == "SR_BACKEND_FAILURE_140" ? Messages.INVALID_HOST : (failure.ErrorDescription.Count > 2 ? failure.ErrorDescription[2] : failure.ErrorDescription[0]); textBoxIscsiHost.Focus(); } return(false); }
public IscsiChoicesDialog(IXenConnection connection, SR.SRInfo srInfo, SR.SRTypes existingSrType, SR.SRTypes requestedSrType) : base(connection) { InitializeComponent(); this.labelSRinfo.Text = String.Format(Messages.ISCSI_DIALOG_SR_DETAILS, Util.DiskSizeString(srInfo.Size), srInfo.UUID); this.labelMessage.Text = String.Format(Messages.EXISTING_SR_FOUND_ON_LUN, SR.getFriendlyTypeName(existingSrType), SR.getFriendlyTypeName(requestedSrType)); }
private Dictionary <String, String> GetDeviceConfig(SR.SRTypes srType) { Dictionary <String, String> dconf = new Dictionary <String, String>(); ToStringWrapper <IScsiIqnInfo> iqn = comboBoxIscsiIqns.SelectedItem as ToStringWrapper <IScsiIqnInfo>; if (iqn == null || !LunMap.ContainsKey(getIscsiLUN())) { return(null); } if (srType == SR.SRTypes.gfs2) { if (_srToIntroduce != null && _srToIntroduce.Configuration != null) { dconf = _srToIntroduce.Configuration; } dconf["provider"] = "iscsi"; dconf["target"] = iqn.item.IpAddress; dconf["port"] = iqn.item.Port.ToString(); dconf["targetIQN"] = getIscsiIQN(); dconf["SCSIid"] = LunMap[getIscsiLUN()].ScsiID; dconf["chapuser"] = IScsiChapUserTextBox.Text; dconf["chappassword"] = IScsiChapSecretTextBox.Text; return(dconf); } // Reset target IP address to home address specified in IQN scan. // Allows multi-homing - see CA-11607 dconf[TARGET] = iqn.item.IpAddress; dconf[PORT] = iqn.item.Port.ToString(); dconf[TARGETIQN] = getIscsiIQN(); ISCSIInfo info = LunMap[getIscsiLUN()]; if (info.LunID == -1) { dconf[LUNSERIAL] = info.Serial; } else { dconf[SCSIID] = info.ScsiID; } if (IscsiUseChapCheckBox.Checked) { dconf[CHAPUSER] = IScsiChapUserTextBox.Text; dconf[CHAPPASSWORD] = IScsiChapSecretTextBox.Text; } return(dconf); }
public LVMoHBAWarningDialog(FibreChannelDevice currentDevice, int remainingDevicesCount, bool foundExistingSR, SR.SRTypes existingSrType, SR.SRTypes requestedSrType) { InitializeComponent(); this.currentDevice = currentDevice; this.remainingDevicesCount = remainingDevicesCount; this.foundExistingSR = foundExistingSR; this.existingSrType = existingSrType; this.requestedSrType = requestedSrType; PopulateControls(); ActiveControl = buttonCancel; }
private Dictionary <String, String> GetDeviceConfig(SR.SRTypes srType) { Dictionary <String, String> dconf = new Dictionary <String, String>(); ToStringWrapper <IScsiIqnInfo> iqn = comboBoxIscsiIqns.SelectedItem as ToStringWrapper <IScsiIqnInfo>; if (iqn == null || !LunMap.ContainsKey(getIscsiLUN())) { return(null); } if (srType == SR.SRTypes.gfs2) { // build the uri for gfs2 var jsonUri = new JavaScriptSerializer().Serialize(new { provider = "iscsi", ips = iqn.item.IpAddress, port = iqn.item.Port.ToString(), iqns = getIscsiIQN(), ScsiId = LunMap[getIscsiLUN()].ScsiID, chapuser = IScsiChapUserTextBox.Text, chappassword = IScsiChapSecretTextBox.Text }); dconf[URI] = jsonUri; return(dconf); } // Reset target IP address to home address specified in IQN scan. // Allows multi-homing - see CA-11607 dconf[TARGET] = iqn.item.IpAddress; dconf[PORT] = iqn.item.Port.ToString(); dconf[TARGETIQN] = getIscsiIQN(); ISCSIInfo info = LunMap[getIscsiLUN()]; if (info.LunID == -1) { dconf[LUNSERIAL] = info.Serial; } else { dconf[SCSIID] = info.ScsiID; } if (IscsiUseChapCheckBox.Checked) { dconf[CHAPUSER] = IScsiChapUserTextBox.Text; dconf[CHAPPASSWORD] = IScsiChapSecretTextBox.Text; } return(dconf); }
private void ScanForSRs(SR.SRTypes type) { var srs = new List <SR.SRInfo>(); switch (type) { case SR.SRTypes.lvmohba: var devices = FiberChannelScan(); if (devices != null && devices.Count > 0) { foreach (FibreChannelDevice device in devices) { string deviceId = string.IsNullOrEmpty(device.SCSIid) ? device.Path : device.SCSIid; var metadataSrs = ScanDeviceForSRs(SR.SRTypes.lvmohba, deviceId, GetFCDeviceConfig(device)); if (metadataSrs != null && metadataSrs.Count > 0) { srs.AddRange(metadataSrs); } } } AddScanResultsToDataGridView(srs, SR.SRTypes.lvmohba); break; case SR.SRTypes.lvmoiscsi: using (var dialog = new IscsiDeviceConfigDialog(Connection)) { if (dialog.ShowDialog(this) == DialogResult.OK) { Dictionary <String, String> dconf = dialog.DeviceConfig; string deviceId = string.IsNullOrEmpty(dconf[SCSIID]) ? dconf[LUNSERIAL] : dconf[SCSIID]; var metadataSrs = ScanDeviceForSRs(SR.SRTypes.lvmoiscsi, deviceId, dconf); if (metadataSrs != null && metadataSrs.Count > 0) { srs.AddRange(metadataSrs); } } } AddScanResultsToDataGridView(srs, SR.SRTypes.lvmoiscsi); break; } if (srs.Count == 0) { using (var dlg = new ThreeButtonDialog( new ThreeButtonDialog.Details(SystemIcons.Information, Messages.DR_WIZARD_STORAGEPAGE_SCAN_RESULT_NONE, Messages.XENCENTER))) { dlg.ShowDialog(this); } } }
public bool FiberChannelScan(IWin32Window owner, IXenConnection connection, out List <FibreChannelDevice> devices) { devices = new List <FibreChannelDevice>(); Host master = Helpers.GetMaster(connection); if (master == null) { return(false); } SR.SRTypes srType = this is LVMoFCoE ? SR.SRTypes.lvmofcoe : SR.SRTypes.lvmohba; //srType is a workaround instead of SrType FibreChannelProbeAction action = new FibreChannelProbeAction(master, srType); // TODO: use SRType using (var dialog = new ActionProgressDialog(action, ProgressBarStyle.Marquee)) dialog.ShowDialog(owner); //Will block until dialog closes, action completed if (!action.Succeeded) { return(false); } try { devices = FibreChannelProbeParsing.ProcessXML(action.Result); if (devices.Count == 0) { using (var dlg = new ThreeButtonDialog( new ThreeButtonDialog.Details(SystemIcons.Warning, Messages.FIBRECHANNEL_NO_RESULTS, Messages.XENCENTER))) { dlg.ShowDialog(); } return(false); } return(true); } catch (Exception e) { log.Debug("Exception parsing result of fibre channel scan", e); log.Debug(e, e); using (var dlg = new ThreeButtonDialog( new ThreeButtonDialog.Details(SystemIcons.Warning, Messages.FIBRECHANNEL_XML_ERROR, Messages.XENCENTER))) { dlg.ShowDialog(); } return(false); } }
/// <summary> /// Won't appear in the program history (SuppressHistory == true). /// </summary> public SrProbeAction(IXenConnection connection, Host host, SR.SRTypes srType, Dictionary <string, string> dconf, Dictionary <string, string> smconf = null) : base(connection, string.Format(Messages.ACTION_SCANNING_SR_FROM, Helpers.GetName(connection)), null, true) { this.host = host; this.SrType = srType; this.dconf = dconf; string target; switch (srType) { case SR.SRTypes.nfs: target = dconf["server"]; break; case SR.SRTypes.lvmoiscsi: target = dconf["target"]; break; case SR.SRTypes.lvmohba: case SR.SRTypes.lvmofcoe: target = dconf.ContainsKey("device") ? dconf["device"] : dconf["SCSIid"]; break; case SR.SRTypes.gfs2: target = dconf.ContainsKey("target") ? dconf["target"] : dconf["SCSIid"]; break; default: target = Messages.REPAIRSR_SERVER; break; } Description = string.Format(Messages.ACTION_SR_SCANNING, SR.getFriendlyTypeName(srType), target); this.smconf = smconf ?? new Dictionary <string, string>(); #region RBAC Dependencies if (SrType == SR.SRTypes.gfs2) { ApiMethodsToRoleCheck.Add("sr.probe_ext"); } else { ApiMethodsToRoleCheck.Add("sr.probe"); ApiMethodsToRoleCheck.AddRange(Role.CommonTaskApiList); } #endregion }
public SrIntroduceAction(IXenConnection connection, String srUuid, String srName, String srDescription, SR.SRTypes srType, String srContentType, Dictionary<String, String> dconf) : base(connection, string.Format(Messages.ACTION_SR_ATTACHING_TITLE, srName, Helpers.GetName(connection))) { _srUuid = srUuid; _srName = srName; _srDescription = srDescription; _srContentType = srContentType; _srType = srType; _srIsShared = true; // used to depend on restrict_pool_attached_storage flag: now always true _dconf = dconf; }
public LVMoHBAWarningDialog(IXenConnection connection, string deviceDetails, int remainingDevicesCount, bool foundExistingSR, SR.SRTypes existingSrType, SR.SRTypes requestedSrType) { InitializeComponent(); _connection = connection; this.deviceDetails = deviceDetails; this.remainingDevicesCount = remainingDevicesCount; this.foundExistingSR = foundExistingSR; this.existingSrType = existingSrType; this.requestedSrType = requestedSrType; PopulateControls(); ActiveControl = buttonCancel; }
public SrIntroduceAction(IXenConnection connection, String srUuid, String srName, String srDescription, SR.SRTypes srType, String srContentType, bool srIsShared, Dictionary <String, String> dconf) : base(connection, string.Format(Messages.ACTION_SR_ATTACHING_TITLE, srName, Helpers.GetName(connection))) { _srUuid = srUuid; _srName = srName; _srDescription = srDescription; _srContentType = srContentType; _srType = srType; _srIsShared = srIsShared; _dconf = dconf; }
public SrIntroduceAction(IXenConnection connection, String srUuid, String srName, String srDescription, SR.SRTypes srType, String srContentType, bool srIsShared, Dictionary<String, String> dconf) : base(connection, string.Format(Messages.ACTION_SR_ATTACHING_TITLE, srName, Helpers.GetName(connection))) { _srUuid = srUuid; _srName = srName; _srDescription = srDescription; _srContentType = srContentType; _srType = srType; _srIsShared = srIsShared; _dconf = dconf; }
public SrIntroduceAction(IXenConnection connection, String srUuid, String srName, String srDescription, SR.SRTypes srType, String srContentType, Dictionary <String, String> dconf) : base(connection, string.Format(Messages.ACTION_SR_ATTACHING_TITLE, srName, Helpers.GetName(connection))) { _srUuid = srUuid; _srName = srName; _srDescription = srDescription; _srContentType = srContentType; _srType = srType; _srIsShared = true; // used to depend on restrict_pool_attached_storage flag: now always true, but left in in case we want to create local SRs one day _dconf = dconf; }
private LVMoHBAWarningDialog.UserSelectedOption GetSelectedOption(FibreChannelDescriptor descriptor, int remainingCount, bool foundExistingSr, SR.SRTypes existingSrType, out bool repeatForRemainingLUNs) { var deviceDetails = string.Format(Messages.LVMOHBA_WARNING_DIALOG_LUN_DETAILS, descriptor.Device.Vendor, descriptor.Device.Serial, string.IsNullOrEmpty(descriptor.Device.SCSIid) ? descriptor.Device.Path : descriptor.Device.SCSIid, Util.DiskSizeString(descriptor.Device.Size)); using (var dialog = new LVMoHBAWarningDialog(_connection, deviceDetails, remainingCount, foundExistingSr, existingSrType, requestedSrType)) { dialog.ShowDialog(owner); repeatForRemainingLUNs = dialog.RepeatForRemainingLUNs; return(dialog.SelectedOption); } }
private List <SR.SRInfo> ScanDeviceForSRs(SR.SRTypes type, string deviceId, Dictionary <string, string> dconf) { Host master = Helpers.GetMaster(Connection); if (master == null || dconf == null) { return(null); } Dictionary <string, string> smconf = new Dictionary <string, string>(); smconf[METADATA] = "true"; // Start probe SrProbeAction srProbeAction = new SrProbeAction(Connection, master, type, dconf, smconf); using (var dlg = new ActionProgressDialog(srProbeAction, ProgressBarStyle.Marquee)) dlg.ShowDialog(this); if (!srProbeAction.Succeeded) { return(null); } try { var metadataSrs = SR.ParseSRListXML(srProbeAction.Result); if (ScannedDevices.ContainsKey(deviceId)) { //update SR list ScannedDevices[deviceId].SRList.Clear(); ScannedDevices[deviceId].SRList.AddRange(metadataSrs); } else { ScannedDevices.Add(deviceId, new ScannedDeviceInfo(type, dconf, metadataSrs)); } return(metadataSrs); } catch { return(null); } }
private void ScanForSRs(SR.SRTypes type) { bool succeeded; List <string> srs = new List <string>(); switch (type) { case SR.SRTypes.lvmohba: List <FibreChannelDevice> devices = new List <FibreChannelDevice>(); succeeded = FiberChannelScan(devices); if (succeeded) { foreach (FibreChannelDevice device in devices) { string deviceId = string.IsNullOrEmpty(device.SCSIid) ? device.Path : device.SCSIid; succeeded = succeeded && ScanDeviceForSRs(SR.SRTypes.lvmohba, deviceId, GetFCDeviceConfig(device)); srs.AddRange(ScannedDevices[deviceId].SRList.Select(srInfo => srInfo.Name)); } } ShowScanResult(srs, succeeded); break; case SR.SRTypes.lvmoiscsi: IscsiDeviceConfigDialog dialog = new IscsiDeviceConfigDialog(Connection); if (dialog.ShowDialog(this) == DialogResult.OK) { Dictionary <String, String> dconf = dialog.DeviceConfig; string deviceId = string.IsNullOrEmpty(dconf[SCSIID]) ? dconf[LUNSERIAL] : dconf[SCSIID]; succeeded = ScanDeviceForSRs(SR.SRTypes.lvmoiscsi, deviceId, dconf); if (succeeded) { srs.AddRange(ScannedDevices[deviceId].SRList.Select(srInfo => srInfo.Name)); } ShowScanResult(srs, succeeded); } break; } }
private void AddScanResultsToDataGridView(List <SR.SRInfo> metadataSrs, SR.SRTypes type) { if (metadataSrs == null || metadataSrs.Count == 0) { return; } foreach (SR.SRInfo srInfo in metadataSrs) { SrRow row; if (!FindRowByUuid(srInfo.UUID, out row)) { row = new SrRow(srInfo, type, srInfo.PoolMetadataDetected, srInfo.PoolMetadataDetected); dataGridViewSRs.Rows.Add(row); ToggleRowChecked(row); } } SortRows(); }
public SrCreateAction(IXenConnection connection, Host host, string srName, string srDescription, SR.SRTypes srType, string srContentType, Dictionary <string, string> dconf, Dictionary <string, string> smconf) : 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; if (srType == SR.SRTypes.lvmomirror_iscsi) { _srType = SR.SRTypes.lvmomirror; } else { _srType = srType; } _srContentType = srContentType; _srIsShared = true; // used to depend on restrict_pool_attached_storage flag: now always true, but left in in case we want to create local SRs one day _dconf = dconf; _smconf = smconf; #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 LVMoIsciWarningDialog(IXenConnection connection, SR.SRInfo srInfo, SR.SRTypes existingSrType, SR.SRTypes requestedSrType) : base(connection, "", 0, srInfo != null, existingSrType, requestedSrType) { labelLUNDetails.Visible = false; labelSrDetails.Visible = srInfo != null; // CA-17230: if the found SR is used by other connected pools, offer only to attach it if (srInfo != null) { SR sr = SrWizardHelpers.SrInUse(srInfo.UUID); if (sr != null) { panelFormat.Visible = false; labelWarning.Text = GetSrInUseMessage(sr); } labelSrDetails.Text = string.Format(Messages.ISCSI_DIALOG_SR_DETAILS, Util.DiskSizeString(srInfo.Size), srInfo.UUID); } }
public SrCreateAction(IXenConnection connection, Host host, string srName, string srDescription, SR.SRTypes srType, string srContentType, bool srIsShared, Dictionary <string, string> dconf, Dictionary <string, string> smconf, 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; _smconf = smconf; 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 SrRow(SR.SRInfo srInfo, SR.SRTypes type, bool poolMetadataDetected, bool selected) { SrInfo = srInfo; var cellTick = new DataGridViewCheckBoxCell { Value = selected }; var cellName = new DataGridViewTextBoxCell { Value = srInfo.Name }; var cellDesc = new DataGridViewTextBoxCell { Value = srInfo.Description }; var cellType = new DataGridViewTextBoxCell { Value = SR.getFriendlyTypeName(type) }; var cellMetadata = new DataGridViewTextBoxCell { Value = poolMetadataDetected.ToStringI18n() }; Cells.AddRange(cellTick, cellName, cellDesc, cellType, cellMetadata); }
/// <summary> /// Won't appear in the program history (SuppressHistory == true). /// </summary> public SrProbeAction(IXenConnection connection, Host host, SR.SRTypes srType, Dictionary <String, String> dconf, Dictionary <String, String> smconf) : base(connection, string.Format(Messages.ACTION_SCANNING_SR_FROM, Helpers.GetName(connection)), null, true) { this.host = host; this.SrType = srType; this.dconf = dconf; string target; switch (srType) { case SR.SRTypes.nfs: target = dconf["server"]; break; case SR.SRTypes.lvmoiscsi: target = dconf["target"]; break; case SR.SRTypes.lvmohba: case SR.SRTypes.lvmofcoe: target = dconf.ContainsKey("device") ? dconf["device"] : dconf["SCSIid"]; break; case SR.SRTypes.gfs2: target = dconf.ContainsKey("target") ? dconf["target"] : dconf["SCSIid"]; break; default: target = Messages.REPAIRSR_SERVER; break; } Description = string.Format(Messages.ACTION_SR_SCANNING, SR.getFriendlyTypeName(srType), target); this.smconf = smconf; }
public SrCreateAction(IXenConnection connection, Host host, string srName, string srDescription, SR.SRTypes srType, string srContentType, Dictionary<string, string> dconf, Dictionary<string, string> smconf) : 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 = true; // used to depend on restrict_pool_attached_storage flag: now always true, but left in in case we want to create local SRs one day _dconf = dconf; _smconf = smconf; #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 ScannedDeviceInfo(SR.SRTypes type, Dictionary <string, string> deviceConfig, string srUuid) : this(type, deviceConfig, new List <SR.SRInfo> { new SR.SRInfo(srUuid) }) { }
public ScannedDeviceInfo(SR.SRTypes type, Dictionary<string, string> deviceConfig, List<SR.SRInfo> srList) { Type = type; DeviceConfig = deviceConfig; SRList = srList; }
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 FibreChannelProbeAction(Host master, SR.SRTypes srType) : this(master) { this.srType = srType; }