当前位置: 首页>>代码示例>>C#>>正文


C# SR.CanBeSeenFrom方法代码示例

本文整理汇总了C#中SR.CanBeSeenFrom方法的典型用法代码示例。如果您正苦于以下问题:C# SR.CanBeSeenFrom方法的具体用法?C# SR.CanBeSeenFrom怎么用?C# SR.CanBeSeenFrom使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SR的用法示例。


在下文中一共展示了SR.CanBeSeenFrom方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetBeskDiskStorage

        /// <summary>
        /// returns null if nothing suitable
        /// </summary>
        private static SR GetBeskDiskStorage(IXenConnection connection, long diskSize, Host affinity, SR suggestion)
        {
            // try suggestion
            if (suggestion != null && suggestion.FreeSpace > diskSize && suggestion.CanBeSeenFrom(affinity))
                return suggestion;

            // try default sr
            SR def_sr = connection.Resolve(Helpers.GetPoolOfOne(connection).default_SR);
            if (def_sr != null && def_sr.FreeSpace > diskSize && def_sr.CanBeSeenFrom(affinity))
                return def_sr;

            // pick an sr
            foreach (SR sr in connection.Cache.SRs)
            {
                if (!sr.CanCreateVmOn())
                    continue;

                if (sr.FreeSpace > diskSize && sr.CanBeSeenFrom(affinity))
                    return sr;
            }

            // there is nothing
            return null;
        }
开发者ID:robertbreker,项目名称:xenadmin,代码行数:27,代码来源:Page_Storage.cs

示例2: GetBeskDiskStorage

        /// <summary>
        /// Tries to find the best SR for the given VDI considering the suggestedSR which has priority over other SRs in this check.
        /// SuggestedSR, default SR, other SRs are checked.
        /// Returns first suitable SR or NULL.
        /// </summary>
        private static SR GetBeskDiskStorage(IXenConnection connection, VDI disk, Host affinity, SR suggestedSR)
        {
            // try suggestion
            if (suggestedSR != null && suggestedSR.CanBeSeenFrom(affinity) && IsSufficientFreeSpaceAvailableOnSrForVdi(suggestedSR, disk))
                return suggestedSR;

            // try default sr
            SR defaultSR = connection.Resolve(Helpers.GetPoolOfOne(connection).default_SR);
            if (defaultSR != null && defaultSR.CanBeSeenFrom(affinity) && IsSufficientFreeSpaceAvailableOnSrForVdi(defaultSR, disk))
                return defaultSR;

            // pick an sr
            foreach (SR sr in connection.Cache.SRs)
            {
                if (!sr.CanCreateVmOn())
                    continue;

                if (sr.CanBeSeenFrom(affinity) && IsSufficientFreeSpaceAvailableOnSrForVdi(sr, disk))
                    return sr;
            }

            // there has been no suitable SR found
            return null;
        }
开发者ID:ushamandya,项目名称:xenadmin,代码行数:29,代码来源:Page_Storage.cs


注:本文中的SR.CanBeSeenFrom方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。