Skip to content

Commit

Permalink
Merge branch 'xenserver:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
CitrixChris authored Nov 20, 2023
2 parents 26e2e3d + 5c858be commit d03d9a2
Show file tree
Hide file tree
Showing 61 changed files with 3,653 additions and 1,211 deletions.
4 changes: 2 additions & 2 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@
* SUCH DAMAGE.
*/

def XENADMIN_BRANDING_TAG = 'v5.3'
def XENADMIN_BRANDING_TAG = 'v5.4'

@Library(['PacmanSharedLibrary', "xencenter-pipeline@v4.10"])
@Library(['PacmanSharedLibrary', "xencenter-pipeline@v4.12"])
import com.xenserver.pipeline.xencenter.*

properties([
Expand Down
3 changes: 1 addition & 2 deletions WixInstaller/wix_src.patch
Original file line number Diff line number Diff line change
Expand Up @@ -1007,7 +1007,7 @@ diff -ru wixlib/ExitDialog.wxl wixlib/ExitDialog.wxl
+ <Control Id="OptionalCheckBox" Type="CheckBox" X="135" Y="200" Width="220" Height="10" Hidden="yes" Property="WIXUI_EXITDIALOGOPTIONALCHECKBOX" CheckBoxValue="1" Text="[WIXUI_EXITDIALOGOPTIONALCHECKBOXTEXT]">
+ <Condition Action="show">WIXUI_EXITDIALOGOPTIONALCHECKBOXTEXT AND NOT (WixUI_InstallMode="Remove") AND XS_WixUIRMPressedOk="0"</Condition>
</Control>
diff --git wixlib/MsiRMFilesInUse.wxs wixlib/MsiRMFilesInUse.wxs
diff -ru wixlib/MsiRMFilesInUse.wxs wixlib/MsiRMFilesInUse.wxs
--- wixlib/MsiRMFilesInUse.wxs
+++ wixlib/MsiRMFilesInUse.wxs
@@ -6,10 +6,13 @@
Expand All @@ -1024,4 +1024,3 @@ diff --git wixlib/MsiRMFilesInUse.wxs wixlib/MsiRMFilesInUse.wxs
</Control>
<Control Id="Cancel" Type="PushButton" X="304" Y="243" Width="56" Height="17" Cancel="yes" Text="!(loc.WixUICancel)">
<Publish Event="EndDialog" Value="Exit">1</Publish>

4 changes: 2 additions & 2 deletions XenAdmin/Commands/ActivateVBDCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ private bool AreIODriversNeededAndMissing(VM vm)
return false;
}

return !vm.GetVirtualisationStatus(out _).HasFlag(VM.VirtualisationStatus.IO_DRIVERS_INSTALLED);
return !vm.GetVirtualizationStatus(out _).HasFlag(VM.VirtualizationStatus.IoDriversInstalled);
}

private bool CanRun(VBD vbd)
Expand Down Expand Up @@ -139,7 +139,7 @@ protected override string GetCantRunReasonCore(IXenObject item)
return Messages.TOOLTIP_DEACTIVATE_SYSVDI;

if (AreIODriversNeededAndMissing(vm))
return vm.HasNewVirtualisationStates()
return vm.HasNewVirtualizationStates()
? string.Format(Messages.CANNOT_ACTIVATE_VD_VM_NEEDS_IO_DRIVERS, Helpers.GetName(vm).Ellipsise(50))
: string.Format(Messages.CANNOT_ACTIVATE_VD_VM_NEEDS_TOOLS, BrandManager.VmTools, Helpers.GetName(vm).Ellipsise(50));

Expand Down
14 changes: 8 additions & 6 deletions XenAdmin/Commands/CrossPoolMigrateCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -119,14 +119,16 @@ public static bool CanRun(VM vm, Host preselectedHost, out string failureReason,
return false;
}

var vms = new List<VM> {vm};
if (preselectedHost != null)
{
var vms = new List<VM> {vm};

if (preselectedHost != null && new ResidentHostIsSameAsSelectionFilter(preselectedHost, vms).FailureFound(out failureReason))
return false;
if (new ResidentHostIsSameAsSelectionFilter(preselectedHost, vms).FailureFound(out failureReason))
return false;

if (preselectedHost != null && new CrossPoolMigrateCanMigrateFilter(preselectedHost, new List<VM> {vm},
WizardMode.Migrate, cache).FailureFound(out failureReason))
return false;
if (new CrossPoolMigrateFilter(preselectedHost, vms, WizardMode.Migrate, cache).FailureFound(out failureReason))
return false;
}

failureReason = string.Empty;
return true;
Expand Down
4 changes: 2 additions & 2 deletions XenAdmin/Commands/DeactivateVBDCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ private bool AreIODriversNeededAndMissing(VM vm)
return false;
}

return !vm.GetVirtualisationStatus(out _).HasFlag(VM.VirtualisationStatus.IO_DRIVERS_INSTALLED);
return !vm.GetVirtualizationStatus(out _).HasFlag(VM.VirtualizationStatus.IoDriversInstalled);
}

private bool CanRun(VBD vbd)
Expand Down Expand Up @@ -140,7 +140,7 @@ protected override string GetCantRunReasonCore(IXenObject item)
return Messages.TOOLTIP_DEACTIVATE_SYSVDI;

if (AreIODriversNeededAndMissing(vm))
return vm.HasNewVirtualisationStates()
return vm.HasNewVirtualizationStates()
? string.Format(Messages.CANNOT_DEACTIVATE_VDI_NEEDS_IO_DRIVERS, Helpers.GetName(vm).Ellipsise(50))
: string.Format(Messages.CANNOT_DEACTIVATE_VDI_NEEDS_TOOLS, BrandManager.VmTools, Helpers.GetName(vm).Ellipsise(50));

Expand Down
6 changes: 3 additions & 3 deletions XenAdmin/Commands/InstallToolsCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -275,10 +275,10 @@ public static bool CanRun(VM vm)
if (vm == null || vm.is_a_template || vm.Locked || vm.power_state != vm_power_state.Running)
return false;

var vStatus = vm.GetVirtualisationStatus(out _);
var vStatus = vm.GetVirtualizationStatus(out _);

if (vStatus.HasFlag(VM.VirtualisationStatus.UNKNOWN) ||
vStatus.HasFlag(VM.VirtualisationStatus.IO_DRIVERS_INSTALLED) && vStatus.HasFlag(VM.VirtualisationStatus.MANAGEMENT_INSTALLED))
if (vStatus.HasFlag(VM.VirtualizationStatus.Unknown) ||
vStatus.HasFlag(VM.VirtualizationStatus.IoDriversInstalled) && vStatus.HasFlag(VM.VirtualizationStatus.ManagementInstalled))
return false;

var vmHome = vm.Home();
Expand Down
10 changes: 5 additions & 5 deletions XenAdmin/Commands/VMLifeCycleCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -162,19 +162,19 @@ protected string GetCantRunNoToolsOrDriversReasonCore(IXenObject item)
if (vm == null)
return null;

var status = vm.GetVirtualisationStatus(out _);
var status = vm.GetVirtualizationStatus(out _);
//trying to guess the reason
if (vm.HasNewVirtualisationStates())
if (vm.HasNewVirtualizationStates())
{
if (!status.HasFlag(VM.VirtualisationStatus.IO_DRIVERS_INSTALLED)) //note: this will also be true when the enum is in Unknown state
if (!status.HasFlag(VM.VirtualizationStatus.IoDriversInstalled)) //note: this will also be true when the enum is in Unknown state
return Messages.VM_MISSING_IO_DRIVERS;
}
else
{
if (status == VM.VirtualisationStatus.NOT_INSTALLED || status.HasFlag(VM.VirtualisationStatus.UNKNOWN))
if (status == VM.VirtualizationStatus.NotInstalled || status.HasFlag(VM.VirtualizationStatus.Unknown))
return FriendlyErrorNames.VM_MISSING_PV_DRIVERS;

if (status.HasFlag(VM.VirtualisationStatus.PV_DRIVERS_OUT_OF_DATE))
if (status.HasFlag(VM.VirtualizationStatus.PvDriversOutOfDate))
return FriendlyErrorNames.VM_OLD_PV_DRIVERS;
}

Expand Down
62 changes: 39 additions & 23 deletions XenAdmin/Commands/VMOperationHostCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ internal class VMOperationHostCommand : VMOperationCommand
{
public delegate Host GetHostForVM(VM vm);

private readonly static log4net.ILog log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
private static readonly log4net.ILog log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
private readonly Dictionary<VM, string> _cantBootReasons = new Dictionary<VM, string>();
private readonly bool _noneCanBoot = true;
private readonly string _text;
Expand All @@ -65,9 +65,7 @@ public VMOperationHostCommand(IMainWindow mainWindow, IEnumerable<SelectedItem>
{
VM vm = (VM)item.XenObject;

string reason = GetVmCannotBootOnHostReason(vm, GetHost(vm), session, operation);

if (reason == null)
if (VmCanBootOnHost(vm, GetHost(vm), session, operation, out var reason))
_noneCanBoot = false;
else
_cantBootReasons[vm] = reason;
Expand Down Expand Up @@ -107,26 +105,38 @@ protected override bool CanRun(VM vm)
return vm != null && !_cantBootReasons.ContainsKey(vm);
}

internal static string GetVmCannotBootOnHostReason(VM vm, Host host, Session session, vm_operations operation)
internal static bool VmCanBootOnHost(VM vm, Host host, Session session, vm_operations operation, out string cannotBootReason)
{
Host residentHost = vm.Connection.Resolve(vm.resident_on);

if (host == null)
return Messages.NO_HOME_SERVER;
{
cannotBootReason = Messages.NO_HOME_SERVER;
return false;
}

if (vm.power_state == vm_power_state.Running && residentHost != null
&& Helpers.ProductVersionCompare(Helpers.HostProductVersion(host), Helpers.HostProductVersion(residentHost)) < 0)
if (vm.power_state == vm_power_state.Running)
{
// This will be a migrate menu if powerstate if running
return Messages.OLDER_THAN_CURRENT_SERVER;
var residentHost = vm.Connection.Resolve(vm.resident_on);

if (residentHost != null)
{
if (host.opaque_ref == residentHost.opaque_ref)
{
cannotBootReason = Messages.HOST_MENU_CURRENT_SERVER;
return false;
}

if (Helpers.ProductVersionCompare(Helpers.HostProductVersion(host), Helpers.HostProductVersion(residentHost)) < 0)
{
cannotBootReason = Messages.OLDER_THAN_CURRENT_SERVER;
return false;
}
}
}

if (vm.power_state == vm_power_state.Running && residentHost != null && host.opaque_ref == residentHost.opaque_ref)
return Messages.HOST_MENU_CURRENT_SERVER;

if ((operation == vm_operations.pool_migrate || operation == vm_operations.resume_on) && VmCpuIncompatibleWithHost(host, vm))
{
return FriendlyErrorNames.VM_INCOMPATIBLE_WITH_THIS_HOST;
cannotBootReason = FriendlyErrorNames.VM_INCOMPATIBLE_WITH_THIS_HOST;
return false;
}

try
Expand All @@ -137,20 +147,27 @@ internal static string GetVmCannotBootOnHostReason(VM vm, Host host, Session ses
{
if (f.ErrorDescription.Count > 2 && f.ErrorDescription[0] == Failure.VM_REQUIRES_SR)
{
SR sr = host.Connection.Resolve((new XenRef<SR>(f.ErrorDescription[2])));
SR sr = host.Connection.Resolve(new XenRef<SR>(f.ErrorDescription[2]));

if (sr != null && sr.content_type == SR.Content_Type_ISO)
return Messages.MIGRATE_PLEASE_EJECT_YOUR_CD;
{
cannotBootReason = Messages.MIGRATE_PLEASE_EJECT_YOUR_CD;
return false;
}
}
return f.ShortMessage;

cannotBootReason = f.ShortMessage;
return false;
}
catch (Exception e)
{
log.ErrorFormat("There was an error calling assert_can_boot_here on host {0}: {1}", host.Name(), e.Message);
return Messages.HOST_MENU_UNKNOWN_ERROR;
cannotBootReason = Messages.HOST_MENU_UNKNOWN_ERROR;
return false;
}

return null;
cannotBootReason = null;
return true;
}

protected override CommandErrorDialog GetErrorDialogCore(IDictionary<IXenObject, string> cantRunReasons)
Expand All @@ -160,8 +177,7 @@ protected override CommandErrorDialog GetErrorDialogCore(IDictionary<IXenObject,

protected override string GetCantRunReasonCore(IXenObject item)
{
VM vm = item as VM;
if (vm != null && _cantBootReasons.ContainsKey(vm))
if (item is VM vm && _cantBootReasons.ContainsKey(vm))
return _cantBootReasons[vm];

return base.GetCantRunReasonCore(item);
Expand Down
22 changes: 11 additions & 11 deletions XenAdmin/ConsoleView/VNCTabView.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 6 additions & 4 deletions XenAdmin/ConsoleView/VNCTabView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1291,10 +1291,12 @@ internal void VMPowerOff()
{
toggleConsoleButton.Enabled = false;

VBD cddrive = source.FindVMCDROM();
bool allowEject = cddrive != null ? cddrive.allowed_operations.Contains(vbd_operations.eject) : false;
bool allowInsert = cddrive != null ? cddrive.allowed_operations.Contains(vbd_operations.insert) : false;
multipleDvdIsoList1.Enabled = (source.power_state == vm_power_state.Halted) && (allowEject || allowInsert);
VBD cdDrive = source.FindVMCDROM();

multipleDvdIsoList1.Enabled = cdDrive == null ||
source.power_state == vm_power_state.Halted &&
(cdDrive.allowed_operations.Contains(vbd_operations.eject) ||
cdDrive.allowed_operations.Contains(vbd_operations.insert));

sendCAD.Enabled = false;
}
Expand Down
Loading

0 comments on commit d03d9a2

Please sign in to comment.