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


C# VDI.GetVMs方法代码示例

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


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

示例1: VDIIsSuitable

 private bool VDIIsSuitable(VDI vdi)
 {
     
     if (vdi == null)
         return false;
     if (vdi.is_a_snapshot)
         return false;
     if (vdi.Locked)
         return false;
     if (vdi.IsHaType)
         return false;
     if(vdi.Connection.ResolveAll(vdi.VBDs).Count < 1)
         return false;
     if(vdi.GetVMs().Any(vm=>!vm.IsRunning) && !Helpers.DundeeOrGreater(vdi.Connection))
         return false;
     SR sr = GetSR(vdi);
     if (sr == null || sr.HBALunPerVDI)
         return false;
     return true;
 }
开发者ID:huizh,项目名称:xenadmin,代码行数:20,代码来源:MigrateVirtualDiskCommand.cs

示例2: CanBeMigrated

        private bool CanBeMigrated(VDI vdi)
        {
            if (vdi == null || vdi.is_a_snapshot || vdi.Locked || vdi.IsHaType)
                return false;

            if(vdi.Connection.ResolveAll(vdi.VBDs).Count == 0)
                return false;
            if(vdi.GetVMs().Any(vm=>!vm.IsRunning) && !Helpers.DundeeOrGreater(vdi.Connection))
                return false;

            SR sr = vdi.Connection.Resolve(vdi.SR);
            if (sr == null || sr.HBALunPerVDI)
                return false;
            if (Helpers.DundeePlusOrGreater(vdi.Connection) && !sr.allowed_operations.Contains(storage_operations.vdi_mirror))
                return false;

            return true;
        }
开发者ID:ushamandya,项目名称:xenadmin,代码行数:18,代码来源:MigrateVirtualDiskCommand.cs

示例3: getDestroyVDIAction

        private List<AsyncAction> getDestroyVDIAction(VDI vdi, List<VM> deletedVMSnapshots)
        {
            List<AsyncAction> actions = new List<AsyncAction>();

            // Destroy the entire snapshot if it exists.  Else destroy disk
            if (vdi.is_a_snapshot && vdi.GetVMs().Count >= 1)
            {
                foreach (VM vm in vdi.GetVMs())
                {
                    if (!vm.is_a_snapshot || deletedVMSnapshots.Contains(vm))
                        continue;

                    AsyncAction action = new VMSnapshotDeleteAction(vm);
                    actions.Add(action);
                    deletedVMSnapshots.Add(vm);
                }
            }
            else
            {
                SR sr = vdi.Connection.Resolve(vdi.SR);
                if (sr == null)
                {
                    // Nothing we can do here, but this should have been caught in the getcantexecutereason method and prompted
                    return actions;
                }
                DestroyDiskAction a = new DestroyDiskAction(vdi);
                a.AllowRunningVMDelete = AllowRunningVMDelete;
                actions.Add(a);
            }

            return actions;
        }
开发者ID:ChrisH4rding,项目名称:xenadmin,代码行数:32,代码来源:DeleteVirtualDiskCommand.cs

示例4: VDIIsSuitable

 private bool VDIIsSuitable(VDI vdi)
 {
     if (vdi == null)
         return false;
     if (vdi.is_a_snapshot)
         return false;
     if (vdi.Locked)
         return false;
     if (vdi.IsHaType)
         return false;
     if(vdi.Connection.ResolveAll(vdi.VBDs).Count < 1)
         return false;
     if(vdi.GetVMs().Any(vm=>!vm.IsRunning))
         return false;
     if (vdi.Connection.Resolve(vdi.SR).HBALunPerVDI)
         return false;
     return true;
 }
开发者ID:ChrisH4rding,项目名称:xenadmin,代码行数:18,代码来源:MigrateVirtualDiskCommand.cs


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