private bool CanBeMigrated(VDI vdi) { if (vdi == null || vdi.is_a_snapshot || vdi.Locked || vdi.IsHaType() || vdi.cbt_enabled) { return(false); } if (vdi.Connection.ResolveAll(vdi.VBDs).Count == 0) { return(false); } if (vdi.GetVMs().Any(vm => !vm.IsRunning()) && !Helpers.DundeeOrGreater(vdi.Connection)) { return(false); } SR sr = vdi.Connection.Resolve(vdi.SR); if (sr == null || sr.HBALunPerVDI()) { return(false); } if (Helpers.DundeePlusOrGreater(vdi.Connection) && !sr.allowed_operations.Contains(storage_operations.vdi_mirror)) { return(false); } return(true); }
protected override string GetCantExecuteReasonCore(SelectedItem item) { VDI vdi = item.XenObject as VDI; if (vdi == null) { return(base.GetCantExecuteReasonCore(item)); } if (vdi.is_a_snapshot) { return(Messages.CANNOT_MOVE_VDI_IS_SNAPSHOT); } if (vdi.Locked) { return(Messages.CANNOT_MOVE_VDI_IN_USE); } if (vdi.IsHaType()) { return(Messages.CANNOT_MOVE_HA_VD); } if (vdi.cbt_enabled) { return(Messages.CANNOT_MOVE_CBT_ENABLED_VDI); } if (vdi.IsMetadataForDR()) { return(Messages.CANNOT_MOVE_DR_VD); } if (vdi.GetVMs().Any(vm => !vm.IsRunning()) && !Helpers.DundeeOrGreater(vdi.Connection)) { return(Messages.CANNOT_MIGRATE_VDI_NON_RUNNING_VM); } SR sr = vdi.Connection.Resolve(vdi.SR); if (sr == null) { return(base.GetCantExecuteReasonCore(item)); } if (sr.HBALunPerVDI()) { return(Messages.UNSUPPORTED_SR_TYPE); } if (Helpers.DundeePlusOrGreater(vdi.Connection) && !sr.allowed_operations.Contains(storage_operations.vdi_mirror)) { return(Messages.UNSUPPORTED_SR_TYPE); } return(base.GetCantExecuteReasonCore(item)); }
protected override string GetCantExecuteReasonCore(SelectedItem item) { VDI vdi = item.XenObject as VDI; if (vdi == null) { return(base.GetCantExecuteReasonCore(item)); } if (vdi.is_a_snapshot) { return(Messages.CANNOT_MOVE_VDI_IS_SNAPSHOT); } if (vdi.Locked) { return(Messages.CANNOT_MOVE_VDI_IN_USE); } if (vdi.IsHaType()) { return(Messages.CANNOT_MOVE_HA_VD); } if (vdi.cbt_enabled) { return(Messages.CANNOT_MOVE_CBT_ENABLED_VDI); } if (vdi.IsMetadataForDR()) { return(Messages.CANNOT_MOVE_DR_VD); } if (vdi.VBDs.Count != 0) { return(Messages.CANNOT_MOVE_VDI_WITH_VBDS); } SR sr = vdi.Connection.Resolve(vdi.SR); if (sr == null) { return(base.GetCantExecuteReasonCore(item)); } if (sr.HBALunPerVDI()) { return(Messages.UNSUPPORTED_SR_TYPE); } return(base.GetCantExecuteReasonCore(item)); }
private bool CanBeMoved(VDI vdi) { if (vdi == null || vdi.is_a_snapshot || vdi.Locked || vdi.IsHaType()) { return(false); } if (vdi.VBDs.Count != 0) { return(false); } SR sr = vdi.Connection.Resolve(vdi.SR); if (sr == null || sr.HBALunPerVDI()) { return(false); } return(true); }
private bool CanBeMoved(VDI vdi) { if (vdi == null || vdi.is_a_snapshot || vdi.Locked || vdi.IsHaType() || vdi.cbt_enabled) { return(false); } SR sr = vdi.Connection.Resolve(vdi.SR); if (sr == null || sr.HBALunPerVDI()) { return(false); } if (vdi.GetVMs().Any(vm => vm.power_state != vm_power_state.Halted)) { return(false); } return(true); }