diff --git a/XenAdmin/Actions/GUIActions/SaveDataSourceStateAction.cs b/XenAdmin/Actions/GUIActions/SaveDataSourceStateAction.cs index 5b917516d..8a31d7928 100644 --- a/XenAdmin/Actions/GUIActions/SaveDataSourceStateAction.cs +++ b/XenAdmin/Actions/GUIActions/SaveDataSourceStateAction.cs @@ -82,7 +82,7 @@ namespace XenAdmin.Actions else XenAPI.Host.forget_data_source_archives(Session, host.opaque_ref, ds.DataSource.name_label); } - else if (vm != null) + else if (vm != null && vm.allowed_operations.Contains(vm_operations.data_source_op)) { if (ds.Enabled) XenAPI.VM.record_data_source(Session, vm.opaque_ref, ds.DataSource.name_label); diff --git a/XenAdmin/Controls/CustomDataGraph/ArchiveMaintainer.cs b/XenAdmin/Controls/CustomDataGraph/ArchiveMaintainer.cs index 7ea88c703..b4df34e95 100644 --- a/XenAdmin/Controls/CustomDataGraph/ArchiveMaintainer.cs +++ b/XenAdmin/Controls/CustomDataGraph/ArchiveMaintainer.cs @@ -198,7 +198,8 @@ namespace XenAdmin.Controls.CustomDataGraph if (xenObject is Host h) _dataSources = Host.get_data_sources(h.Connection.Session, h.opaque_ref); - else if (xenObject is VM vm && vm.power_state == vm_power_state.Running) + else if (xenObject is VM vm && vm.power_state == vm_power_state.Running && + vm.allowed_operations.Contains(vm_operations.data_source_op)) _dataSources = VM.get_data_sources(vm.Connection.Session, vm.opaque_ref); Get(ArchiveInterval.None, RrdsUri, RRD_Full_InspectCurrentNode, xenObject); diff --git a/XenModel/Actions/GetDataSourcesAction.cs b/XenModel/Actions/GetDataSourcesAction.cs index 438c86390..36150e3ce 100644 --- a/XenModel/Actions/GetDataSourcesAction.cs +++ b/XenModel/Actions/GetDataSourcesAction.cs @@ -52,7 +52,7 @@ namespace XenAdmin.Actions { List sources; - if (XenObject is VM vm) + if (XenObject is VM vm && vm.allowed_operations.Contains(vm_operations.data_source_op)) sources = VM.get_data_sources(Session, vm.opaque_ref); else if (XenObject is Host host) sources = Host.get_data_sources(Session, host.opaque_ref); @@ -106,7 +106,7 @@ namespace XenAdmin.Actions Host.record_data_source(Session, Host.opaque_ref, _dataSource.name_label); DataSources = Host.get_data_sources(Session, Host.opaque_ref); } - else if (VM != null) + else if (VM != null && VM.allowed_operations.Contains(vm_operations.data_source_op)) { VM.record_data_source(Session, VM.opaque_ref, _dataSource.name_label); DataSources = VM.get_data_sources(Session, VM.opaque_ref);