mirror of
https://github.com/xcp-ng/xenadmin.git
synced 2024-11-25 06:16:37 +01:00
29 lines
914 B
C#
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;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|