Merge pull request #304 from stephen-turner/CP-10204

Merge CP-10204 branch
This commit is contained in:
Stephen Turner 2015-01-29 15:47:02 +00:00
commit 84a5f0f47b
8 changed files with 29 additions and 13 deletions

View File

@ -82,6 +82,10 @@ namespace XenAdmin.ConsoleView
private bool RDPEnabled { get { return source != null ? source.RDPEnabled : false; } }
private bool RDPControlEnabled { get { return source != null ? source.RDPControlEnabled : false; } }
public bool IsRDPControlEnabled() { return RDPControlEnabled; }
public VNCTabView(VNCView parent, VM source, string elevatedUsername, string elevatedPassword)
{
Program.AssertOnEventThread();
@ -541,7 +545,7 @@ namespace XenAdmin.ConsoleView
{
log.DebugFormat("'{0}' console: Starting RDP polling. (RDP polling is enabled in settings.)", source);
toggleConsoleButton.Visible = true;
if(Helpers.CreamOrGreater(source.Connection))
if(Helpers.CreamOrGreater(source.Connection) && RDPControlEnabled)
toggleConsoleButton.Enabled = true;
else
toggleConsoleButton.Enabled = false;
@ -766,9 +770,9 @@ namespace XenAdmin.ConsoleView
vncScreen.Unpause();
}
private bool RDPDisabledOnCreamOrGreater(IXenConnection conn)
private bool CanEnableRDPOnCreamOrGreater(IXenConnection conn)
{
return (!RDPEnabled && Helpers.CreamOrGreater(conn));
return (RDPControlEnabled && !RDPEnabled && Helpers.CreamOrGreater(conn));
}
// Make the 'enable RDP' button show something sensible if we can...
@ -798,7 +802,7 @@ namespace XenAdmin.ConsoleView
if (osString != null)
{
if (osString.Contains("Microsoft"))
label = (RDPDisabledOnCreamOrGreater(source.Connection)) ? enableRDP : UseRDP;
label = (CanEnableRDPOnCreamOrGreater(source.Connection)) ? enableRDP : UseRDP;
else
label = UseXVNC;
}
@ -1112,7 +1116,7 @@ namespace XenAdmin.ConsoleView
log.DebugFormat("RDP detected for VM '{0}'", source == null ? "unknown/null" : source.name_label);
this.toggleToXVNCorRDP = RDP;
if (vncScreen.UseVNC)
if (RDPDisabledOnCreamOrGreater(source.Connection))
if (CanEnableRDPOnCreamOrGreater(source.Connection))
this.toggleConsoleButton.Text = enableRDP;
else
this.toggleConsoleButton.Text = UseRDP;
@ -1174,7 +1178,7 @@ namespace XenAdmin.ConsoleView
vncScreen.UseVNC = !vncScreen.UseVNC;
vncScreen.UserWantsToSwitchProtocol = true;
if (RDPDisabledOnCreamOrGreater(source.Connection))
if (CanEnableRDPOnCreamOrGreater(source.Connection))
{
ThreeButtonDialog d = new ThreeButtonDialog(
new ThreeButtonDialog.Details(System.Drawing.SystemIcons.Question, Messages.FORCE_ENABLE_RDP),
@ -1190,7 +1194,7 @@ namespace XenAdmin.ConsoleView
}
}
if (vncScreen.rdpIP == null && vncScreen.UseVNC && Properties.Settings.Default.EnableRDPPolling)
if (vncScreen.rdpIP == null && vncScreen.UseVNC && Properties.Settings.Default.EnableRDPPolling && (!(Helpers.CreamOrGreater(source.Connection) && RDPControlEnabled) || tryToConnectRDP))
{
toggleConsoleButton.Enabled = false;
}
@ -1225,7 +1229,7 @@ namespace XenAdmin.ConsoleView
{
bool rdp = (toggleToXVNCorRDP == RDP);
if (rdp)
toggleConsoleButton.Text = vncScreen.UseVNC ? (RDPDisabledOnCreamOrGreater(source.Connection) ? enableRDP : UseRDP) : UseStandardDesktop;
toggleConsoleButton.Text = vncScreen.UseVNC ? (CanEnableRDPOnCreamOrGreater(source.Connection) ? enableRDP : UseRDP) : UseStandardDesktop;
else
toggleConsoleButton.Text = vncScreen.UseSource ? UseXVNC : UseVNC;
scaleCheckBox.Visible = !rdp || vncScreen.UseVNC;

View File

@ -686,7 +686,7 @@ namespace XenAdmin.ConsoleView
private void startPolling()
{
//Disable the button first, but only if in text/default console (to allow user to return to the text console - ref. CA-70314)
if (Helpers.CreamOrGreater(Source.Connection))
if (Helpers.CreamOrGreater(Source.Connection) && parentVNCTabView.IsRDPControlEnabled())
{
parentVNCTabView.EnableToggleVNCButton();
}

View File

@ -13808,7 +13808,7 @@ namespace XenAdmin {
}
/// <summary>
/// Looks up a localized string similar to Would you like to turn on Remote Desktop in this VM, and then connect to it over Remote Desktop?.
/// Looks up a localized string similar to Would you like to configure this VM to accept Remote Desktop connections, and then connect to it over Remote Desktop?.
/// </summary>
public static string FORCE_ENABLE_RDP {
get {

View File

@ -4837,7 +4837,7 @@ CD をイジェクトしてから再試行してください。</value>
<value>プラグイン {0} がキャンセル要求に応答していません。プロセスを強制終了するか、バックグラウンドでの続行を許可するかを選択してください。</value>
</data>
<data name="FORCE_ENABLE_RDP" xml:space="preserve">
<value>Would you like to turn on Remote Desktop in this VM, and then connect to it over Remote Desktop?</value>
<value>Would you like to configure this VM to accept Remote Desktop connections, and then connect to it over Remote Desktop?</value>
</data>
<data name="FORCE_REBOOT" xml:space="preserve">
<value>強制再起動</value>

View File

@ -4843,7 +4843,7 @@ Would you like to eject these ISOs before continuing?</value>
<value>Plugin {0} has not yet responded to your cancel request. Would you like to force close the process or allow it to continue to run in the background?</value>
</data>
<data name="FORCE_ENABLE_RDP" xml:space="preserve">
<value>Would you like to turn on Remote Desktop in this VM, and then connect to it over Remote Desktop?</value>
<value>Would you like to configure this VM to accept Remote Desktop connections, and then connect to it over Remote Desktop?</value>
</data>
<data name="FORCE_REBOOT" xml:space="preserve">
<value>Force Reboot</value>

View File

@ -4836,7 +4836,7 @@ XenServer 可以重新启动服务器并将服务器的 CPU 级别降至池中
<value>插件 {0} 尚未对您的取消请求作出响应。是强制关闭进程还是允许其继续在后台运行?</value>
</data>
<data name="FORCE_ENABLE_RDP" xml:space="preserve">
<value>Would you like to turn on Remote Desktop in this VM, and then connect to it over Remote Desktop?</value>
<value>Would you like to configure this VM to accept Remote Desktop connections, and then connect to it over Remote Desktop?</value>
</data>
<data name="FORCE_REBOOT" xml:space="preserve">
<value>强制重启</value>

0
XenModel/Utils/Helpers.cs Normal file → Executable file
View File

View File

@ -443,6 +443,18 @@ namespace XenAPI
}
}
public bool RDPControlEnabled
{
get
{
var metrics = Connection.Resolve(this.guest_metrics);
if (metrics == null)
return false;
return 0 != IntKey(metrics.other, "feature-ts2", 0);
}
}
/// <summary>Returns true if
/// 1) the guest is HVM and
/// 2a) the allow-gpu-passthrough restriction is absent or