xenadmin/XenModel/Actions/GPU/VgpuConfigurationAction.cs
Konstantina Chremmou f7d59a8c24 [CP-6383]: Configuration of vGPU types for pGPUs
# HG changeset patch
# User Gabor Apati-Nagy <Gabor.Apati-Nagy@citrix.com>
# Date 1382623622 -3600
#      Thu Oct 24 15:07:02 2013 +0100
# Node ID 9b2305266f104c3ae9ec32804a92b3596d0aa399
# Parent  66330c7be272cd62a342e20ff109eea6b4d846f8

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

33 lines
1.1 KiB
C#

using System;
using System.Collections.Generic;
using XenAdmin.Network;
using XenAPI;
namespace XenAdmin.Actions.GPU
{
public class VgpuConfigurationAction : PureAsyncAction
{
private readonly Dictionary<PGPU, List<XenRef<VGPU_type>>> updatedEnabledVGpuListByPGpu;
public VgpuConfigurationAction(Dictionary<PGPU, List<XenRef<VGPU_type>>> updatedEnabledVGpuListByPGpu, IXenConnection connection)
: base(connection, Messages.ACTION_VGPU_CONFIGURATION_SAVING)
{
this.updatedEnabledVGpuListByPGpu = updatedEnabledVGpuListByPGpu;
Description = Messages.ACTION_PREPARING;
this.Pool = Core.Helpers.GetPool(connection);
}
protected override void Run()
{
Description = Messages.ACTION_VGPU_CONFIGURATION_SAVING;
foreach(var kvp in updatedEnabledVGpuListByPGpu)
{
var pGpu = kvp.Key;
PGPU.set_enabled_VGPU_types(Connection.Session,pGpu.opaque_ref, kvp.Value);
}
Description = Messages.ACTION_VGPU_CONFIGURATION_SAVED;
}
}
}