xenadmin/XenModel/Actions/Pool/SetGpuPlacementPolicyAction.cs
Konstantina Chremmou 402e2458ce CP-6382: Added GPU page to the Pool properties dialog (PR-1675)
# HG changeset patch
# User Mihaela Stoica <Mihaela.Stoica@citrix.com>
# Date 1381486465 -3600
#      Fri Oct 11 11:14:25 2013 +0100
# Node ID ae162fb56bac4f1c2f7cc4c47b640a6933ea6deb
# Parent  48644db7dcf80d93efb9d6e86e982b95894cbd9d

Signed-off-by: Konstantina Chremmou <konstantina.chremmou@citrix.com>
2013-11-14 10:35:48 +00:00

29 lines
914 B
C#

using XenAPI;
namespace XenAdmin.Actions
{
public class SetGpuPlacementPolicyAction : PureAsyncAction
{
private allocation_algorithm allocationAlgorithm;
public SetGpuPlacementPolicyAction(Pool pool, allocation_algorithm allocationAlgorithm)
: base(pool.Connection, Messages.SET_GPU_PLACEMENT_POLICY_ACTION_TITLE,
Messages.SET_GPU_PLACEMENT_POLICY_ACTION_DESCRIPTION, true)
{
this.allocationAlgorithm = allocationAlgorithm;
}
protected override void Run()
{
var gpuGroups = Connection.Cache.GPU_groups;
foreach (var gpuGroup in gpuGroups)
{
GPU_group.set_allocation_algorithm(Session, gpuGroup.opaque_ref, allocationAlgorithm);
}
Description = Messages.SET_GPU_PLACEMENT_POLICY_ACTION_DONE;
}
}
}