mirror of
https://github.com/xcp-ng/xenadmin.git
synced 2025-01-20 07:19:18 +01:00
CP-9365: XenCenter work for HVM linux support
-changes following the code review Signed-off-by: Gabor Apati-Nagy <gabor.apati-nagy@citrix.com>
This commit is contained in:
parent
c458d16f7f
commit
c928fd71ec
@ -60,6 +60,7 @@ namespace XenAdmin.ConsoleView
|
|||||||
private readonly VNCView parentVNCView;
|
private readonly VNCView parentVNCView;
|
||||||
private readonly VM source;
|
private readonly VM source;
|
||||||
private readonly Host targetHost;
|
private readonly Host targetHost;
|
||||||
|
private VM_guest_metrics guestMetrics = null;
|
||||||
private Form fullscreenForm = null;
|
private Form fullscreenForm = null;
|
||||||
private Form fullscreenHint = null;
|
private Form fullscreenHint = null;
|
||||||
private Size LastDesktopSize;
|
private Size LastDesktopSize;
|
||||||
@ -75,6 +76,8 @@ namespace XenAdmin.ConsoleView
|
|||||||
|
|
||||||
internal readonly ConsoleKeyHandler KeyHandler = new ConsoleKeyHandler();
|
internal readonly ConsoleKeyHandler KeyHandler = new ConsoleKeyHandler();
|
||||||
|
|
||||||
|
private bool hasRDP { get { return source != null ? source.HasRDP : false; } }
|
||||||
|
|
||||||
public VNCTabView(VNCView parent, VM source, string elevatedUsername, string elevatedPassword)
|
public VNCTabView(VNCView parent, VM source, string elevatedUsername, string elevatedPassword)
|
||||||
{
|
{
|
||||||
Program.AssertOnEventThread();
|
Program.AssertOnEventThread();
|
||||||
@ -139,7 +142,7 @@ namespace XenAdmin.ConsoleView
|
|||||||
this.vncScreen = new XSVNCScreen(source, new EventHandler(RDPorVNCResizeHandler), this, elevatedUsername, elevatedPassword);
|
this.vncScreen = new XSVNCScreen(source, new EventHandler(RDPorVNCResizeHandler), this, elevatedUsername, elevatedPassword);
|
||||||
ShowGpuWarningIfRequired();
|
ShowGpuWarningIfRequired();
|
||||||
|
|
||||||
if (source.is_control_domain || source.IsHVM && !source.HasRDP) //Linux HVM guests should only have one console: the console switch button vanishes altogether.
|
if (source.is_control_domain || source.IsHVM && !hasRDP) //Linux HVM guests should only have one console: the console switch button vanishes altogether.
|
||||||
{
|
{
|
||||||
toggleConsoleButton.Visible = false;
|
toggleConsoleButton.Visible = false;
|
||||||
}
|
}
|
||||||
@ -470,12 +473,14 @@ namespace XenAdmin.ConsoleView
|
|||||||
}
|
}
|
||||||
else if (e.PropertyName == "guest_metrics")
|
else if (e.PropertyName == "guest_metrics")
|
||||||
{
|
{
|
||||||
var guestMetrics = source.Connection.Resolve(source.guest_metrics);
|
var newGuestMetrics = source.Connection.Resolve(source.guest_metrics);
|
||||||
if (guestMetrics != null)
|
|
||||||
{
|
//unsubscribing from the previous instance's event
|
||||||
guestMetrics.PropertyChanged -= guestMetrics_PropertyChanged;
|
if (this.guestMetrics != null)
|
||||||
|
this.guestMetrics.PropertyChanged -= guestMetrics_PropertyChanged;
|
||||||
|
|
||||||
|
this.guestMetrics = newGuestMetrics;
|
||||||
guestMetrics.PropertyChanged += guestMetrics_PropertyChanged;
|
guestMetrics.PropertyChanged += guestMetrics_PropertyChanged;
|
||||||
}
|
|
||||||
|
|
||||||
EnableRDPIfCapable();
|
EnableRDPIfCapable();
|
||||||
}
|
}
|
||||||
@ -498,7 +503,7 @@ namespace XenAdmin.ConsoleView
|
|||||||
|
|
||||||
private void EnableRDPIfCapable()
|
private void EnableRDPIfCapable()
|
||||||
{
|
{
|
||||||
if (!toggleConsoleButton.Visible && source.HasRDP)
|
if (!toggleConsoleButton.Visible && hasRDP)
|
||||||
{
|
{
|
||||||
// The toogle button is not visible now, because RDP had not been enabled on the VM when we started the console.
|
// The toogle button is not visible now, because RDP had not been enabled on the VM when we started the console.
|
||||||
// However, the current guest_metrics indicates that RDP is now supported (HasRDP==true). (eg. XenTools has been installed in the meantime.)
|
// However, the current guest_metrics indicates that RDP is now supported (HasRDP==true). (eg. XenTools has been installed in the meantime.)
|
||||||
|
@ -118,6 +118,8 @@ namespace XenAdmin.ConsoleView
|
|||||||
[DefaultValue(false)]
|
[DefaultValue(false)]
|
||||||
public bool UserWantsToSwitchProtocol { get; set; }
|
public bool UserWantsToSwitchProtocol { get; set; }
|
||||||
|
|
||||||
|
private bool hasRDP { get { return Source != null ? Source.HasRDP : false; } }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Whether we have tried to login without providing a password (covers the case where the user
|
/// Whether we have tried to login without providing a password (covers the case where the user
|
||||||
/// has configured VNC not to require a login password). If no password is saved, passwordless
|
/// has configured VNC not to require a login password). If no password is saved, passwordless
|
||||||
@ -285,7 +287,7 @@ namespace XenAdmin.ConsoleView
|
|||||||
|
|
||||||
private void PollRDPPort(Object Sender)
|
private void PollRDPPort(Object Sender)
|
||||||
{
|
{
|
||||||
if (sourceVM.HasRDP && !Properties.Settings.Default.EnableRDPPolling)
|
if (hasRDP && !Properties.Settings.Default.EnableRDPPolling)
|
||||||
{
|
{
|
||||||
if (connectionPoller != null)
|
if (connectionPoller != null)
|
||||||
connectionPoller.Change(Timeout.Infinite, Timeout.Infinite);
|
connectionPoller.Change(Timeout.Infinite, Timeout.Infinite);
|
||||||
@ -536,7 +538,7 @@ namespace XenAdmin.ConsoleView
|
|||||||
if (RemoteConsole != null && RemoteConsole.ConsoleControl != null)
|
if (RemoteConsole != null && RemoteConsole.ConsoleControl != null)
|
||||||
{
|
{
|
||||||
RemoteConsole.KeyHandler = this.KeyHandler;
|
RemoteConsole.KeyHandler = this.KeyHandler;
|
||||||
RemoteConsole.SendScanCodes = sourceVM.HasRDP;
|
RemoteConsole.SendScanCodes = hasRDP;
|
||||||
RemoteConsole.Scaling = Scaling;
|
RemoteConsole.Scaling = Scaling;
|
||||||
RemoteConsole.DisplayBorder = this.displayFocusRectangle;
|
RemoteConsole.DisplayBorder = this.displayFocusRectangle;
|
||||||
SetKeyboardAndMouseCapture(autoCaptureKeyboardAndMouse);
|
SetKeyboardAndMouseCapture(autoCaptureKeyboardAndMouse);
|
||||||
@ -689,11 +691,11 @@ namespace XenAdmin.ConsoleView
|
|||||||
//Start the polling again
|
//Start the polling again
|
||||||
if (Source != null && !Source.is_control_domain)
|
if (Source != null && !Source.is_control_domain)
|
||||||
{
|
{
|
||||||
if (!sourceVM.IsHVM)
|
if (!Source.IsHVM)
|
||||||
{
|
{
|
||||||
connectionPoller = new Timer(PollVNCPort, null, RETRY_SLEEP_TIME, RDP_POLL_INTERVAL);
|
connectionPoller = new Timer(PollVNCPort, null, RETRY_SLEEP_TIME, RDP_POLL_INTERVAL);
|
||||||
}
|
}
|
||||||
else if (sourceVM.HasRDP)
|
else if (hasRDP)
|
||||||
{
|
{
|
||||||
connectionPoller = new Timer(PollRDPPort, null, RETRY_SLEEP_TIME, RDP_POLL_INTERVAL);
|
connectionPoller = new Timer(PollRDPPort, null, RETRY_SLEEP_TIME, RDP_POLL_INTERVAL);
|
||||||
}
|
}
|
||||||
@ -1007,7 +1009,7 @@ namespace XenAdmin.ConsoleView
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
v.SendScanCodes = UseSource && sourceVM.HasRDP;
|
v.SendScanCodes = UseSource && hasRDP;
|
||||||
v.SourceVM = sourceVM;
|
v.SourceVM = sourceVM;
|
||||||
v.Console = console;
|
v.Console = console;
|
||||||
v.connect(stream, this.vncPassword);
|
v.connect(stream, this.vncPassword);
|
||||||
|
Loading…
Reference in New Issue
Block a user