本文整理匯總了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;
}
示例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;
}
示例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;
}
示例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;
}