public storagePoolInfo GetSampleStoragePool()
 {
     storagePoolInfo sp = new storagePoolInfo();
     sp.objectId = "storagePoolInfo";
     sp.friendlyName = "samplePool";
     sp.storageSystemId = "storageSystemId";
     sp.parentPool = "";
     return sp;
 }
Beispiel #2
0
        public storagePoolInfo GetSampleStoragePool()
        {
            storagePoolInfo sp = new storagePoolInfo();

            sp.objectId        = "storagePoolInfo";
            sp.friendlyName    = "samplePool";
            sp.storageSystemId = "storageSystemId";
            sp.parentPool      = "";
            return(sp);
        }
Beispiel #3
0
 public jobInfo enumStoragePools(string storageSystemId, string filters, int flags, out storagePoolInfo[] spInfoList)
 {
     spInfoList = new storagePoolInfo[0];
     foreach (storageSystemInfo ss in StorageSystemsAndPools.Keys)
     {
         if (ss.objectId == storageSystemId)
         {
             spInfoList = StorageSystemsAndPools[ss];
         }
     }
     return(null);
 }
            private void RefreshStorageLinkSystem(string storageSystemId)
            {
                StorageLinkSystem system = new List <StorageLinkSystem>(_connection.Cache.StorageSystems).Find(s => s.opaque_ref == storageSystemId);

                if (system != null)
                {
                    storagePoolInfo[]   storagePools   = new storagePoolInfo[0];
                    storageVolumeInfo[] storageVolumes = new storageVolumeInfo[0];

                    try
                    {
                        _connection._service.enumStoragePools(storageSystemId, string.Empty, (int)StorageLinkEnums.FlagsType.NONE, out storagePools);
                        _connection._service.enumStorageNodes(storageSystemId, string.Empty, string.Empty, (int)StorageLinkEnums.FlagsType.NONE, out storageVolumes);
                    }
                    catch (SoapException e)
                    {
                        // if the creds have just been removed then don't throw the exception on.
                        if (e.Detail == null || e.Detail.InnerText.IndexOf("SL_MSG_ERR_NO_STORAGE_MANAGEMENT_CREDENTIALS_COULD_BE_FOUND_FOR_STORAGE_SYSTEM") < 0)
                        {
                            throw;
                        }
                    }

                    List <StorageLinkPool>   pools   = new List <StorageLinkPool>();
                    List <StorageLinkVolume> volumes = new List <StorageLinkVolume>();

                    foreach (storagePoolInfo poolInfo in storagePools)
                    {
                        pools.Add(new StorageLinkPool(_connection, poolInfo.objectId, poolInfo.friendlyName, poolInfo.parentPool, poolInfo.storageSystemId, poolInfo.sizeInMB, poolInfo.sizeInMB - poolInfo.freeSpaceInMB, (StorageLinkEnums.RaidType)poolInfo.supportedRaidTypes, (StorageLinkEnums.ProvisioningType)poolInfo.supportedProvisioningTypes));
                    }

                    foreach (storageVolumeInfo volumeInfo in storageVolumes)
                    {
                        volumes.Add(new StorageLinkVolume(_connection,
                                                          volumeInfo.objectId,
                                                          system.StorageLinkServer,
                                                          volumeInfo.friendlyName,
                                                          volumeInfo.storageSystemId,
                                                          volumeInfo.storagePoolId,
                                                          volumeInfo.sizeInMB,
                                                          volumeInfo.usedSpaceInMB));
                    }

                    _connection.Invoke(() => _connection.Cache.Update(storageSystemId, pools, volumes));
                }
            }
        public void TestStorageSystemExistsOnConnect()
        {
            storageSystemInfo ss = _ws.GetSampleStorageSystem();
            storagePoolInfo   sp = _ws.GetSampleStoragePool();
            storageVolumeInfo sv = _ws.GetSampleStorageVolume();

            _ws.StorageSystemsAndPools.Add(ss, new[] { sp });
            _ws.StoragePoolsAndVolumes.Add(sp, new[] { sv });

            Connect();

            WaitFor(() => _con.Cache.StorageSystems.Count == 1, "Storage System didn't get added.");

            Assert.AreEqual(_con.Cache.StorageSystems[0].opaque_ref, ss.objectId);
            Assert.AreEqual(_con.Cache.StorageSystems[0].SerialNumber, ss.serialNum);
            Assert.AreEqual(_con.Cache.StorageSystems[0].Model, ss.model);
            Assert.AreEqual(_con.Cache.StorageSystems[0].FullName, ss.displayName);
            Assert.AreEqual((uint)_con.Cache.StorageSystems[0].Capabilities, ss.capabilities);
            Assert.AreEqual(_con.Cache.StorageSystems[0].FriendlyName, ss.friendlyName);

            Assert.AreEqual(_con.Cache.StoragePools[0].opaque_ref, sp.objectId);

            Assert.AreEqual(_con.Cache.StorageVolumes[0].opaque_ref, sv.objectId);
        }
 public jobInfo enumStoragePools(string storageSystemId, string filters, int flags, out storagePoolInfo[] spInfoList)
 {
     spInfoList = new storagePoolInfo[0];
     foreach (storageSystemInfo ss in StorageSystemsAndPools.Keys)
     {
         if (ss.objectId == storageSystemId)
         {
             spInfoList = StorageSystemsAndPools[ss];
         }
     }
     return null;
 }
            private void RefreshStorageLinkSystem(string storageSystemId)
            {
                StorageLinkSystem system = new List<StorageLinkSystem>(_connection.Cache.StorageSystems).Find(s => s.opaque_ref == storageSystemId);

                if (system != null)
                {
                    storagePoolInfo[] storagePools = new storagePoolInfo[0];
                    storageVolumeInfo[] storageVolumes = new storageVolumeInfo[0];

                    try
                    {
                        _connection._service.enumStoragePools(storageSystemId, string.Empty, (int)StorageLinkEnums.FlagsType.NONE, out storagePools);
                        _connection._service.enumStorageNodes(storageSystemId, string.Empty, string.Empty, (int)StorageLinkEnums.FlagsType.NONE, out storageVolumes);
                    }
                    catch (SoapException e)
                    {
                        // if the creds have just been removed then don't throw the exception on.
                        if (e.Detail == null || e.Detail.InnerText.IndexOf("SL_MSG_ERR_NO_STORAGE_MANAGEMENT_CREDENTIALS_COULD_BE_FOUND_FOR_STORAGE_SYSTEM") < 0)
                        {
                            throw;
                        }
                    }

                    List<StorageLinkPool> pools = new List<StorageLinkPool>();
                    List<StorageLinkVolume> volumes = new List<StorageLinkVolume>();

                    foreach (storagePoolInfo poolInfo in storagePools)
                    {
                        pools.Add(new StorageLinkPool(_connection, poolInfo.objectId, poolInfo.friendlyName, poolInfo.parentPool, poolInfo.storageSystemId, poolInfo.sizeInMB, poolInfo.sizeInMB - poolInfo.freeSpaceInMB, (StorageLinkEnums.RaidType)poolInfo.supportedRaidTypes, (StorageLinkEnums.ProvisioningType)poolInfo.supportedProvisioningTypes));
                    }

                    foreach (storageVolumeInfo volumeInfo in storageVolumes)
                    {
                        volumes.Add(new StorageLinkVolume(_connection,
                            volumeInfo.objectId,
                            system.StorageLinkServer,
                            volumeInfo.friendlyName,
                            volumeInfo.storageSystemId,
                            volumeInfo.storagePoolId,
                            volumeInfo.sizeInMB,
                            volumeInfo.usedSpaceInMB));
                    }

                    _connection.Invoke(() => _connection.Cache.Update(storageSystemId, pools, volumes));
                }
            }