mirror of
https://github.com/xcp-ng/xenadmin.git
synced 2024-11-25 06:16:37 +01:00
Merge pull request #1388 from geosharath/CA-213505
CA-213505: Right click on a VM allows assignment to a policy of unsupported snapshot type
This commit is contained in:
commit
cfed0d1eec
@ -79,11 +79,25 @@ namespace XenAdmin.Commands
|
||||
|
||||
Array.Sort(groups);
|
||||
|
||||
for (int index = 0; index < groups.Length; index++)
|
||||
for (int index = 0, offset = 0; index < groups.Length; index++)
|
||||
{
|
||||
T group = groups[index];
|
||||
var menuText = index < 9
|
||||
? String.Format(Messages.DYNAMIC_MENUITEM_WITH_ACCESS_KEY, index + 1, group.Name)
|
||||
|
||||
/* do not add unsupported policies to the drop down for VMSS */
|
||||
XenAPI.VMSS policy = group as VMSS;
|
||||
if (policy != null && policy.policy_type == policy_backup_type.snapshot_with_quiesce)
|
||||
{
|
||||
List<VM> vms = Command.GetSelection().AsXenObjects<VM>();
|
||||
bool doNotInclude = vms.Any(vm => !vm.allowed_operations.Contains(vm_operations.snapshot_with_quiesce));
|
||||
if (doNotInclude)
|
||||
{
|
||||
offset--;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
var menuText = (index + offset) < 9
|
||||
? String.Format(Messages.DYNAMIC_MENUITEM_WITH_ACCESS_KEY, (index + offset) + 1, group.Name)
|
||||
: String.Format(Messages.DYNAMIC_MENUITEM_WITHOUT_ACCESS_KEY, group.Name);
|
||||
|
||||
var cmdGroup = new AssignGroupToVMCommand(Command.MainWindowCommandInterface, Command.GetSelection(), group, menuText);
|
||||
|
Loading…
Reference in New Issue
Block a user