From 994ced83888f27206673a6d7aa00ca8e7bdff9fe Mon Sep 17 00:00:00 2001 From: Mihaela Stoica Date: Thu, 20 Oct 2016 14:52:51 +0100 Subject: [PATCH] CA-226112: Disable PVS read caching causes System.NullReferenceException Signed-off-by: Mihaela Stoica --- XenAdmin/Commands/DisablePvsReadCachingCommand.cs | 3 +-- XenAdmin/Dialogs/EnablePvsReadCachingDialog.cs | 4 +--- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/XenAdmin/Commands/DisablePvsReadCachingCommand.cs b/XenAdmin/Commands/DisablePvsReadCachingCommand.cs index 541aef871..4c209a36e 100644 --- a/XenAdmin/Commands/DisablePvsReadCachingCommand.cs +++ b/XenAdmin/Commands/DisablePvsReadCachingCommand.cs @@ -97,8 +97,7 @@ namespace XenAdmin.Commands /// private AsyncAction GetAsyncActionForVm(VM vm) { - var pvsProxy = vm.Connection.Cache.PVS_proxies.FirstOrDefault(p => p.VM.Equals(vm)); // null if no proxy - + var pvsProxy = vm.PvsProxy; if (pvsProxy == null) return null; // No proxy to disable return new PvsProxyDestroyAction(pvsProxy); diff --git a/XenAdmin/Dialogs/EnablePvsReadCachingDialog.cs b/XenAdmin/Dialogs/EnablePvsReadCachingDialog.cs index 2dc2504b7..12f954da4 100644 --- a/XenAdmin/Dialogs/EnablePvsReadCachingDialog.cs +++ b/XenAdmin/Dialogs/EnablePvsReadCachingDialog.cs @@ -139,9 +139,7 @@ namespace XenAdmin.Dialogs /// private bool PvsProxyAlreadyEnabled(VM vm) { - var pvsProxies = vm.Connection.Cache.PVS_proxies; - - return pvsProxies.Any(pvsProxy => pvsProxy.VM.Equals(vm)); + return vm.PvsProxy != null; } ///