예제 #1
0
        protected override void Run()
        {
            // Remove any existing VGPUs before adding new ones
            foreach (VGPU vgpu in vm.Connection.ResolveAll(vm.VGPUs))
            {
                VGPU.destroy(Session, vgpu.opaque_ref);
            }

            if (gpu_group == null)  // The VM doesn't want a VGPU
            {
                return;
            }

            // Add the new VGPU
            string device = "0";  // fixed at the moment, see PR-1060
            Dictionary <string, string> other_config = new Dictionary <string, string>();

            if (Helpers.FeatureForbidden(vm, Host.RestrictVgpu) || vgpuType == null)
            {
                VGPU.async_create(Session, vm.opaque_ref, gpu_group.opaque_ref, device, other_config);
            }
            else
            {
                VGPU.async_create(Session, vm.opaque_ref, gpu_group.opaque_ref, device,
                                  other_config, vgpuType.opaque_ref);
            }
        }
예제 #2
0
        private void AddGpu(GPU_group gpuGroup, VGPU_type vGpuType, string device = "0")
        {
            if (gpuGroup == null)
            {
                return;
            }

            Dictionary <string, string> other_config = new Dictionary <string, string>();

            if (Helpers.FeatureForbidden(vm, Host.RestrictVgpu) || vGpuType == null)
            {
                VGPU.async_create(Session, vm.opaque_ref, gpuGroup.opaque_ref, device, other_config);
            }
            else
            {
                VGPU.async_create(Session, vm.opaque_ref, gpuGroup.opaque_ref, device,
                                  other_config, vGpuType.opaque_ref);
            }
        }