private StorageLinkServer GetStorageLinkServer(IXenObject xo) { if (xo is StorageLinkServer) { return((StorageLinkServer)xo); } else if (xo is StorageLinkSystem) { StorageLinkSystem system = (StorageLinkSystem)xo; return(system.StorageLinkServer); } else if (xo is StorageLinkPool) { StorageLinkPool pool = (StorageLinkPool)xo; if (pool.Parent == null) { return(pool.StorageLinkSystem.StorageLinkServer); } else { return(GetStorageLinkServer(pool.Parent)); } } return(null); }
public RemoveStorageLinkSystemAction(StorageLinkSystem system) : base(null, string.Format(Messages.REMOVE_STORAGE_LINK_SYSTEM_ACTION_TITLE, system.Name), string.Format(Messages.REMOVE_STORAGE_LINK_SYSTEM_ACTION_START_DESCRIPTION, system.Name)) { Util.ThrowIfParameterNull(system, "system"); _system = system; AppliesTo.Add(system.StorageLinkServer.opaque_ref); AppliesTo.Add(system.opaque_ref); }
/// <summary> /// Initializes a new instance of the <see cref="CslgSystemStorage"/> class. /// </summary> /// <param name="displayName">The display name.</param> /// <param name="storageSystemId">The storage system id.</param> /// <param name="protocols">The available protocols.</param> /// <param name="provisioningOptions">The available provisioning options.</param> /// <param name="supportsCHAP">Indicates whether CHAP is supported.</param> public CslgSystemStorage(string displayName, string storageSystemId, IEnumerable <CslgParameter> protocols, IEnumerable <CslgParameter> provisioningOptions, bool supportsCHAP, StorageLinkSystem storageLinkSystem) { Util.ThrowIfStringParameterNullOrEmpty(displayName, "displayName"); Util.ThrowIfStringParameterNullOrEmpty(storageSystemId, "storageSystemId"); Util.ThrowIfParameterNull(protocols, "protocols"); Util.ThrowIfParameterNull(protocols, "provisioningOptions"); _displayName = displayName; _storageSystemId = storageSystemId; _protocols = new ReadOnlyCollection <CslgParameter>(new List <CslgParameter>(protocols)); _provisioningOptions = new ReadOnlyCollection <CslgParameter>(new List <CslgParameter>(provisioningOptions)); _supportsCHAP = supportsCHAP; StorageLinkSystem = storageLinkSystem; }
public StorageLinkJobInfo RemoveStorageSystem(StorageLinkSystem system) { Util.ThrowIfParameterNull(system, "system"); try { foreach (managementCredentials creds in _service.enumStorageManagementCredentials()) { foreach (string ssid in creds.ssidList) { if (ssid == system.opaque_ref) { jobInfo jobInfo = _service.removeStorageManagementCredentials(string.Empty, creds.uuid, (int)StorageLinkEnums.FlagsType.ASYNC); return(GetJobInfo(jobInfo.jobId)); } } } } catch (SoapException e) { throw ConvertSoapException(e); } return(null); }
public StorageLinkJobInfo RemoveStorageSystem(StorageLinkSystem system) { Util.ThrowIfParameterNull(system, "system"); try { foreach (managementCredentials creds in _service.enumStorageManagementCredentials()) { foreach (string ssid in creds.ssidList) { if (ssid == system.opaque_ref) { jobInfo jobInfo = _service.removeStorageManagementCredentials(string.Empty, creds.uuid, (int)StorageLinkEnums.FlagsType.ASYNC); return GetJobInfo(jobInfo.jobId); } } } } catch (SoapException e) { throw ConvertSoapException(e); } return null; }
public RemoveStorageLinkSystemCommand(IMainWindow mainWindow, StorageLinkSystem system) : base(mainWindow, system) { }
private void Update() { var systems = new List <StorageLinkSystem>(); var pools = new List <StorageLinkPool>(); var adapters = new List <StorageLinkAdapter>(); var volumes = new List <StorageLinkVolume>(); var repositories = new List <StorageLinkRepository>(); var server = new StorageLinkServer(this, Host + " " + Username, Host); if (Cache.Server == null) { Invoke(() => Cache.Update(server, new List <StorageLinkSystem>(), new List <StorageLinkPool>(), new List <StorageLinkAdapter>(), new List <StorageLinkVolume>(), new List <StorageLinkRepository>())); } var flags = StorageLinkEnums.FlagsType.NONE; if (RefreshInProgress) { flags = StorageLinkEnums.FlagsType.DEEP_REFRESH_CACHE; } try { foreach (storageAdapterInfo adapterInfo in _service.enumStorageAdapters()) { adapters.Add(new StorageLinkAdapter(this, adapterInfo.objectId, adapterInfo.friendlyName, adapterInfo.name, adapterInfo.storageAdapterCredInputOptions, adapterInfo.defaultNamespace, adapterInfo.defaultPortNumber, adapterInfo.isSMIS)); } storageSystemInfo[] storageSystems; _service.enumStorageSystems(string.Empty, (int)flags, out storageSystems); server = new StorageLinkServer(this, _service.Host + " " + Username, Host); foreach (storageSystemInfo systemInfo in storageSystems) { StorageLinkSystem system = new StorageLinkSystem(this, systemInfo.objectId, systemInfo.friendlyName, server, systemInfo.storageSystemId, systemInfo.serialNum, systemInfo.model, systemInfo.displayName, systemInfo.storageAdapterId, (StorageLinkEnums.StorageSystemCapabilities)systemInfo.capabilities); try { storagePoolInfo[] storagePools; _service.enumStoragePools(systemInfo.storageSystemId, string.Empty, (int)StorageLinkEnums.FlagsType.NONE, out storagePools); storageVolumeInfo[] vols; _service.enumStorageNodes(systemInfo.storageSystemId, string.Empty, string.Empty, (int)flags, out vols); foreach (storagePoolInfo poolInfo in storagePools) { StorageLinkEnums.RaidType raidType = (StorageLinkEnums.RaidType)poolInfo.supportedRaidTypes; StorageLinkEnums.ProvisioningType provTypes = (StorageLinkEnums.ProvisioningType)poolInfo.supportedProvisioningTypes; pools.Add(new StorageLinkPool(this, poolInfo.objectId, poolInfo.friendlyName, poolInfo.parentPool, poolInfo.storageSystemId, poolInfo.sizeInMB, poolInfo.sizeInMB - poolInfo.freeSpaceInMB, (StorageLinkEnums.RaidType)poolInfo.supportedRaidTypes, (StorageLinkEnums.ProvisioningType)poolInfo.supportedProvisioningTypes)); } volumes.AddRange(Array.ConvertAll(vols, v => new StorageLinkVolume(this, v.objectId, server, v.friendlyName, v.storageSystemId, v.storagePoolId, v.sizeInMB, v.usedSpaceInMB))); } catch (SoapException) { //log.Error(e.Message, e); continue; } catch (WebException) { //log.Error(e.Message, e); continue; } systems.Add(system); } storageRepositoryInfo[] srs; _service.enumStorageRepositories(string.Empty, string.Empty, (int)flags, out srs); foreach (storageRepositoryInfo sr in srs) { if (systems.Find(s => s.opaque_ref == sr.storageSystemId) != null && pools.Find(p => p.opaque_ref == sr.storagePoolId) != null) { repositories.Add(new StorageLinkRepository(this, sr.objectId, sr.friendlyName, server, sr.storageSystemId, sr.storagePoolId, (StorageLinkEnums.RaidType)sr.raidType, (StorageLinkEnums.ProvisioningType)sr.provisioningType, (StorageLinkEnums.ProvisioningOptions)sr.useDeduplication, sr.hostGroupUuid)); } } } finally { Invoke(() => Cache.Update(server, systems, pools, adapters, volumes, repositories)); } }
public static Icons GetIconFor(IXenObject o) { VM vm = o as VM; if (vm != null) { return(GetIconFor(vm)); } VM_appliance appl = o as VM_appliance; if (appl != null) { return(GetIconFor(appl)); } SR sr = o as SR; if (sr != null) { return(GetIconFor(sr)); } Host host = o as Host; if (host != null) { return(GetIconFor(host)); } Pool pool = o as Pool; if (pool != null) { return(GetIconFor(pool)); } XenAPI.Network network = o as XenAPI.Network; if (network != null) { return(GetIconFor(network)); } VDI vdi = o as VDI; if (vdi != null) { return(GetIconFor(vdi)); } VBD vbd = o as VBD; if (vbd != null) { return(GetIconFor(vbd)); } Folder folder = o as Folder; if (folder != null) { return(GetIconFor(folder)); } PIF pif = o as PIF; if (pif != null) { return(GetIconFor(pif)); } StorageLinkServer storageLinkServer = o as StorageLinkServer; if (storageLinkServer != null) { return(GetIconFor(storageLinkServer)); } StorageLinkSystem storageLinkSystem = o as StorageLinkSystem; if (storageLinkSystem != null) { return(GetIconFor(storageLinkSystem)); } StorageLinkPool storageLinkPool = o as StorageLinkPool; if (storageLinkPool != null) { return(GetIconFor(storageLinkPool)); } StorageLinkVolume storageLinkVolume = o as StorageLinkVolume; if (storageLinkVolume != null) { return(GetIconFor(storageLinkVolume)); } StorageLinkRepository storageLinkRepository = o as StorageLinkRepository; if (storageLinkRepository != null) { return(GetIconFor(storageLinkRepository)); } System.Diagnostics.Trace.Assert(false, "You asked for an icon for a type I don't recognise!"); return(Icons.XenCenter); }
/// <summary> /// Initializes a new instance of the <see cref="CslgSystemStorage"/> class. /// </summary> /// <param name="displayName">The display name.</param> /// <param name="storageSystemId">The storage system id.</param> /// <param name="protocols">The available protocols.</param> /// <param name="provisioningOptions">The available provisioning options.</param> /// <param name="supportsCHAP">Indicates whether CHAP is supported.</param> public CslgSystemStorage(string displayName, string storageSystemId, IEnumerable<CslgParameter> protocols, IEnumerable<CslgParameter> provisioningOptions, bool supportsCHAP, StorageLinkSystem storageLinkSystem) { Util.ThrowIfStringParameterNullOrEmpty(displayName, "displayName"); Util.ThrowIfStringParameterNullOrEmpty(storageSystemId, "storageSystemId"); Util.ThrowIfParameterNull(protocols, "protocols"); Util.ThrowIfParameterNull(protocols, "provisioningOptions"); _displayName = displayName; _storageSystemId = storageSystemId; _protocols = new ReadOnlyCollection<CslgParameter>(new List<CslgParameter>(protocols)); _provisioningOptions = new ReadOnlyCollection<CslgParameter>(new List<CslgParameter>(provisioningOptions)); _supportsCHAP = supportsCHAP; StorageLinkSystem = storageLinkSystem; }
protected void SetAppliesTo(IXenObject xo) { if (xo == null) { return; } if (xo is Pool) { Pool pool = (Pool)xo; AppliesTo.Add(pool.opaque_ref); } else if (xo is Host) { Host host = (Host)xo; SetAppliesTo(Helpers.GetPoolOfOne(host.Connection)); AppliesTo.Add(host.opaque_ref); } else if (xo is VM) { VM vm = (VM)xo; SetAppliesTo(vm.Home()); AppliesTo.Add(vm.opaque_ref); } else if (xo is SR) { SR sr = (SR)xo; SetAppliesTo(sr.Home); AppliesTo.Add(sr.opaque_ref); } else if (xo is VDI) { VDI vdi = (VDI)xo; SetAppliesTo(vdi.Connection.Resolve(vdi.SR)); } else if (xo is StorageLinkServer) { AppliesTo.Add(xo.opaque_ref); } else if (xo is StorageLinkSystem) { StorageLinkSystem system = (StorageLinkSystem)xo; AppliesTo.Add(system.opaque_ref); SetAppliesTo(system.StorageLinkServer); } else if (xo is StorageLinkPool) { StorageLinkPool pool = (StorageLinkPool)xo; AppliesTo.Add(xo.opaque_ref); if (pool.Parent == null) { SetAppliesTo(pool.StorageLinkSystem); } else { SetAppliesTo(pool.Parent); } } else if (xo is StorageLinkVolume) { StorageLinkVolume volume = (StorageLinkVolume)xo; AppliesTo.Add(xo.opaque_ref); SetAppliesTo(volume.StorageLinkPool); } }
private VirtualTreeNode AddStorageLinkSystemNode(StorageLinkSystem storageLinkSystem) { return AddNode(Helpers.GetName(storageLinkSystem), Images.GetIconFor(storageLinkSystem), false, storageLinkSystem); }
private VirtualTreeNode AddStorageLinkSystemNode(VirtualTreeNode parent, int index, StorageLinkSystem storageLinkSystem) { return(AddNode(parent, index, Helpers.GetName(storageLinkSystem), Images.GetIconFor(storageLinkSystem), false, storageLinkSystem)); }
private VirtualTreeNode AddStorageLinkSystemNode(StorageLinkSystem storageLinkSystem) { return(AddNode(Helpers.GetName(storageLinkSystem), Images.GetIconFor(storageLinkSystem), false, storageLinkSystem)); }
private void Update() { var systems = new List<StorageLinkSystem>(); var pools = new List<StorageLinkPool>(); var adapters = new List<StorageLinkAdapter>(); var volumes = new List<StorageLinkVolume>(); var repositories = new List<StorageLinkRepository>(); var server = new StorageLinkServer(this, Host + " " + Username, Host); if (Cache.Server == null) { Invoke(() => Cache.Update(server, new List<StorageLinkSystem>(), new List<StorageLinkPool>(), new List<StorageLinkAdapter>(), new List<StorageLinkVolume>(), new List<StorageLinkRepository>())); } var flags = StorageLinkEnums.FlagsType.NONE; if (RefreshInProgress) { flags = StorageLinkEnums.FlagsType.DEEP_REFRESH_CACHE; } try { foreach (storageAdapterInfo adapterInfo in _service.enumStorageAdapters()) { adapters.Add(new StorageLinkAdapter(this, adapterInfo.objectId, adapterInfo.friendlyName, adapterInfo.name, adapterInfo.storageAdapterCredInputOptions, adapterInfo.defaultNamespace, adapterInfo.defaultPortNumber, adapterInfo.isSMIS)); } storageSystemInfo[] storageSystems; _service.enumStorageSystems(string.Empty, (int)flags, out storageSystems); server = new StorageLinkServer(this, _service.Host + " " + Username, Host); foreach (storageSystemInfo systemInfo in storageSystems) { StorageLinkSystem system = new StorageLinkSystem(this, systemInfo.objectId, systemInfo.friendlyName, server, systemInfo.storageSystemId, systemInfo.serialNum, systemInfo.model, systemInfo.displayName,systemInfo.storageAdapterId, (StorageLinkEnums.StorageSystemCapabilities)systemInfo.capabilities); try { storagePoolInfo[] storagePools; _service.enumStoragePools(systemInfo.storageSystemId, string.Empty, (int)StorageLinkEnums.FlagsType.NONE, out storagePools); storageVolumeInfo[] vols; _service.enumStorageNodes(systemInfo.storageSystemId, string.Empty, string.Empty, (int)flags, out vols); foreach (storagePoolInfo poolInfo in storagePools) { StorageLinkEnums.RaidType raidType = (StorageLinkEnums.RaidType)poolInfo.supportedRaidTypes; StorageLinkEnums.ProvisioningType provTypes = (StorageLinkEnums.ProvisioningType)poolInfo.supportedProvisioningTypes; pools.Add(new StorageLinkPool(this, poolInfo.objectId, poolInfo.friendlyName, poolInfo.parentPool, poolInfo.storageSystemId, poolInfo.sizeInMB, poolInfo.sizeInMB - poolInfo.freeSpaceInMB, (StorageLinkEnums.RaidType)poolInfo.supportedRaidTypes, (StorageLinkEnums.ProvisioningType)poolInfo.supportedProvisioningTypes)); } volumes.AddRange(Array.ConvertAll(vols, v => new StorageLinkVolume(this, v.objectId, server, v.friendlyName, v.storageSystemId, v.storagePoolId, v.sizeInMB, v.usedSpaceInMB))); } catch (SoapException) { //log.Error(e.Message, e); continue; } catch (WebException) { //log.Error(e.Message, e); continue; } systems.Add(system); } storageRepositoryInfo[] srs; _service.enumStorageRepositories(string.Empty, string.Empty, (int)flags, out srs); foreach (storageRepositoryInfo sr in srs) { if (systems.Find(s => s.opaque_ref == sr.storageSystemId) != null && pools.Find(p => p.opaque_ref == sr.storagePoolId) != null) { repositories.Add(new StorageLinkRepository(this, sr.objectId, sr.friendlyName, server, sr.storageSystemId, sr.storagePoolId, (StorageLinkEnums.RaidType)sr.raidType, (StorageLinkEnums.ProvisioningType)sr.provisioningType, (StorageLinkEnums.ProvisioningOptions)sr.useDeduplication, sr.hostGroupUuid)); } } } finally { Invoke(() => Cache.Update(server, systems, pools, adapters, volumes, repositories)); } }
public static Icons GetIconFor(StorageLinkSystem storageLinkSystem) { return Icons.StorageLinkSystem; }
private VirtualTreeNode AddStorageLinkSystemNode(VirtualTreeNode parent, int index, StorageLinkSystem storageLinkSystem) { return AddNode(parent, index, Helpers.GetName(storageLinkSystem), Images.GetIconFor(storageLinkSystem), false, storageLinkSystem); }
public static Icons GetIconFor(StorageLinkSystem storageLinkSystem) { return(Icons.StorageLinkSystem); }