本文整理汇总了C#中Pool.Clone方法的典型用法代码示例。如果您正苦于以下问题:C# Pool.Clone方法的具体用法?C# Pool.Clone怎么用?C# Pool.Clone使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Pool
的用法示例。
在下文中一共展示了Pool.Clone方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ClearNonSharedSrs
/// <summary>
/// If we're joining a pool that has a non-shared default/crash/suspend SR, then clear that
/// pool's default SRs, since a pool with default SRs set to local storage is a confusing
/// configuration that we do not allow to be set through the GUI (only shared SRs can be set
/// as the default in pools, even though xapi allows otherwise).
/// </summary>
/// <param name="pool"></param>
protected void ClearNonSharedSrs(Pool pool)
{
SR defSR = pool.Connection.Resolve<SR>(pool.default_SR);
if (defSR != null && !defSR.shared)
{
XenAPI.Pool poolCopy = (Pool)pool.Clone();
poolCopy.default_SR = new XenRef<SR>(Helper.NullOpaqueRef);
poolCopy.crash_dump_SR = new XenRef<SR>(Helper.NullOpaqueRef);
poolCopy.suspend_image_SR = new XenRef<SR>(Helper.NullOpaqueRef);
pool.Locked = true;
try
{
poolCopy.SaveChanges(Session);
}
finally
{
pool.Locked = false;
}
}
}