mirror of
https://github.com/xcp-ng/xenadmin.git
synced 2024-11-23 20:36:33 +01:00
CP-10204: Rework comments
Signed-off-by: Cheng Zhang <cheng.zhang@citrix.com>
This commit is contained in:
parent
6b6b515fe7
commit
98992d3bd2
@ -48,7 +48,7 @@ namespace XenAdmin.ConsoleView
|
||||
public partial class VNCTabView : UserControl
|
||||
{
|
||||
private static readonly string UseRDP = Messages.VNC_RDESKTOP;
|
||||
private static readonly string enableRDP = Messages.VNC_RDESKTOP_TRUN_ON;
|
||||
private static readonly string enableRDP = Messages.VNC_RDESKTOP_TURN_ON;
|
||||
// public only for the automated tests.
|
||||
public static readonly string UseVNC = Messages.VNC_VIRTUAL_CONSOLE;
|
||||
public static readonly string UseXVNC = Messages.VNC_X_CONSOLE;
|
||||
@ -508,6 +508,15 @@ namespace XenAdmin.ConsoleView
|
||||
{
|
||||
if (e.PropertyName == "other")
|
||||
{
|
||||
if (RDPEnabled)
|
||||
{
|
||||
if (vncScreen.UseVNC && (tryToConnectRDP || (!vncScreen.UserWantsToSwitchProtocol && Properties.Settings.Default.AutoSwitchToRDP)))
|
||||
{
|
||||
tryToConnectRDP = false;
|
||||
ThreadPool.QueueUserWorkItem(TryToConnectRDP);
|
||||
}
|
||||
}
|
||||
else
|
||||
EnableRDPIfCapable();
|
||||
UpdateButtons();
|
||||
}
|
||||
@ -527,7 +536,7 @@ namespace XenAdmin.ConsoleView
|
||||
{
|
||||
log.DebugFormat("'{0}' console: Starting RDP polling. (RDP polling is enabled in settings.)", source);
|
||||
toggleConsoleButton.Visible = true;
|
||||
if(Helpers.CreedenceOrGreater(targetHost))
|
||||
if(Helpers.CreamOrGreater(source.Connection))
|
||||
toggleConsoleButton.Enabled = true;
|
||||
else
|
||||
toggleConsoleButton.Enabled = false;
|
||||
@ -752,6 +761,11 @@ namespace XenAdmin.ConsoleView
|
||||
vncScreen.Unpause();
|
||||
}
|
||||
|
||||
private bool RDPDiabledOnCreamOrGreater(IXenConnection conn)
|
||||
{
|
||||
return (!RDPEnabled && Helpers.CreamOrGreater(conn));
|
||||
}
|
||||
|
||||
// Make the 'enable RDP' button show something sensible if we can...
|
||||
private string GuessNativeConsoleLabel(VM source)
|
||||
{
|
||||
@ -779,7 +793,7 @@ namespace XenAdmin.ConsoleView
|
||||
if (osString != null)
|
||||
{
|
||||
if (osString.Contains("Microsoft"))
|
||||
label = (Helpers.CreedenceOrGreater(targetHost) && !RDPEnabled) ? enableRDP : UseRDP;
|
||||
label = (RDPDiabledOnCreamOrGreater(source.Connection)) ? enableRDP : UseRDP;
|
||||
else
|
||||
label = UseXVNC;
|
||||
}
|
||||
@ -1093,7 +1107,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(Helpers.CreedenceOrGreater(targetHost) && !RDPEnabled)
|
||||
if (RDPDiabledOnCreamOrGreater(source.Connection))
|
||||
this.toggleConsoleButton.Text = enableRDP;
|
||||
else
|
||||
this.toggleConsoleButton.Text = UseRDP;
|
||||
@ -1136,6 +1150,7 @@ namespace XenAdmin.ConsoleView
|
||||
|
||||
private bool firstTime = true;
|
||||
private bool oldScaleValue = false;
|
||||
private bool tryToConnectRDP = false; // This parameter will be set after click "TURN ON Rremote Desktop" and will connect RDP when RDP status changed.
|
||||
|
||||
/// <summary>
|
||||
/// Switch between graphical and text consoles.
|
||||
@ -1154,21 +1169,19 @@ namespace XenAdmin.ConsoleView
|
||||
vncScreen.UseVNC = !vncScreen.UseVNC;
|
||||
vncScreen.UserWantsToSwitchProtocol = true;
|
||||
|
||||
if (Helpers.CreedenceOrGreater(targetHost))
|
||||
if (RDPDiabledOnCreamOrGreater(source.Connection))
|
||||
{
|
||||
if (!RDPEnabled)
|
||||
ThreeButtonDialog d = new ThreeButtonDialog(
|
||||
new ThreeButtonDialog.Details(System.Drawing.SystemIcons.Question, Messages.FORCE_ENABLE_RDP),
|
||||
"EnableRDPonVM",
|
||||
new ThreeButtonDialog.TBDButton(Messages.YES, DialogResult.Yes),
|
||||
new ThreeButtonDialog.TBDButton(Messages.NO, DialogResult.No));
|
||||
if (d.ShowDialog(Program.MainWindow) == DialogResult.Yes)
|
||||
{
|
||||
ThreeButtonDialog d = new ThreeButtonDialog(
|
||||
new ThreeButtonDialog.Details(System.Drawing.SystemIcons.Warning, Messages.FORCE_ENABLE_RDP),
|
||||
"EnableRDPonVM",
|
||||
new ThreeButtonDialog.TBDButton(Messages.YES, DialogResult.Yes),
|
||||
new ThreeButtonDialog.TBDButton(Messages.NO, DialogResult.No));
|
||||
if (d.ShowDialog(Program.MainWindow) == DialogResult.Yes)
|
||||
{
|
||||
Session session = source.Connection.DuplicateSession();
|
||||
Dictionary<string, string> _arguments = new Dictionary<string, string>();
|
||||
XenAPI.VM.call_plugin(session, source.opaque_ref, "guest-agent-operation", "request-rdp-on", _arguments);
|
||||
}
|
||||
Session session = source.Connection.DuplicateSession();
|
||||
Dictionary<string, string> _arguments = new Dictionary<string, string>();
|
||||
XenAPI.VM.call_plugin(session, source.opaque_ref, "guest-agent-operation", "request-rdp-on", _arguments);
|
||||
tryToConnectRDP = true;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1207,7 +1220,7 @@ namespace XenAdmin.ConsoleView
|
||||
{
|
||||
bool rdp = (toggleToXVNCorRDP == RDP);
|
||||
if (rdp)
|
||||
toggleConsoleButton.Text = vncScreen.UseVNC ? ((Helpers.CreedenceOrGreater(targetHost) && !RDPEnabled) ? enableRDP : UseRDP) : UseStandardDesktop;
|
||||
toggleConsoleButton.Text = vncScreen.UseVNC ? (RDPDiabledOnCreamOrGreater(source.Connection) ? enableRDP : UseRDP) : UseStandardDesktop;
|
||||
else
|
||||
toggleConsoleButton.Text = vncScreen.UseSource ? UseXVNC : UseVNC;
|
||||
scaleCheckBox.Visible = !rdp || vncScreen.UseVNC;
|
||||
|
@ -686,28 +686,31 @@ 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.CreedenceOrGreater(Source.Connection))
|
||||
if (Helpers.CreamOrGreater(Source.Connection))
|
||||
{
|
||||
parentVNCTabView.EnableToggleVNCButton();
|
||||
}
|
||||
else if (InDefaultConsole())
|
||||
else
|
||||
{
|
||||
parentVNCTabView.DisableToggleVNCButton();
|
||||
}
|
||||
if (InDefaultConsole())
|
||||
{
|
||||
parentVNCTabView.DisableToggleVNCButton();
|
||||
}
|
||||
|
||||
|
||||
//Start the polling again
|
||||
if (Source != null && !Source.is_control_domain)
|
||||
{
|
||||
if (!Source.IsHVM)
|
||||
//Start the polling again
|
||||
if (Source != null && !Source.is_control_domain)
|
||||
{
|
||||
connectionPoller = new Timer(PollVNCPort, null, RETRY_SLEEP_TIME, RDP_POLL_INTERVAL);
|
||||
if (!Source.IsHVM)
|
||||
{
|
||||
connectionPoller = new Timer(PollVNCPort, null, RETRY_SLEEP_TIME, RDP_POLL_INTERVAL);
|
||||
}
|
||||
else if (hasRDP)
|
||||
{
|
||||
connectionPoller = new Timer(PollRDPPort, null, RETRY_SLEEP_TIME, RDP_POLL_INTERVAL);
|
||||
}
|
||||
}
|
||||
else if (hasRDP)
|
||||
{
|
||||
connectionPoller = new Timer(PollRDPPort, null, RETRY_SLEEP_TIME, RDP_POLL_INTERVAL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void VM_PropertyChanged(object sender, PropertyChangedEventArgs e)
|
||||
|
@ -160,6 +160,5 @@
|
||||
<call name="secret_set_value" />
|
||||
<call name="secret_get_all" />
|
||||
<call name="secret_get_all_records" />
|
||||
<call name="vm_call_plugin" />
|
||||
</version>
|
||||
</ApiVersionTool>
|
@ -262,7 +262,6 @@ vm_appliance_assert_can_be_recovered,boston
|
||||
async_vm_appliance_assert_can_be_recovered,boston
|
||||
vm_appliance_recover,boston
|
||||
async_vm_appliance_recover,boston
|
||||
vm_call_plugin,creedence
|
||||
dr_task_create,boston
|
||||
async_dr_task_create,boston
|
||||
dr_task_destroy,boston
|
||||
|
|
4
XenModel/Messages.Designer.cs
generated
4
XenModel/Messages.Designer.cs
generated
@ -32972,9 +32972,9 @@ namespace XenAdmin {
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Turn &on Remote Desktop.
|
||||
/// </summary>
|
||||
public static string VNC_RDESKTOP_TRUN_ON {
|
||||
public static string VNC_RDESKTOP_TURN_ON {
|
||||
get {
|
||||
return ResourceManager.GetString("VNC_RDESKTOP_TRUN_ON", resourceCulture);
|
||||
return ResourceManager.GetString("VNC_RDESKTOP_TURN_ON", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -11406,7 +11406,7 @@ StorageLink Gateway を使用する VM の XenServer 6.0 へのアップグレ
|
||||
<data name="VNC_RDESKTOP" xml:space="preserve">
|
||||
<value>リモート デスクトップに切り替える(&I)</value>
|
||||
</data>
|
||||
<data name="VNC_RDESKTOP_TRUN_ON" xml:space="preserve">
|
||||
<data name="VNC_RDESKTOP_TURN_ON" xml:space="preserve">
|
||||
<value>Turn &on Remote Desktop</value>
|
||||
</data>
|
||||
<data name="VNC_REDOCK" xml:space="preserve">
|
||||
|
@ -11409,7 +11409,7 @@ To learn more about the XenServer Dynamic Workload Balancing feature or to start
|
||||
<data name="VNC_RDESKTOP" xml:space="preserve">
|
||||
<value>Sw&itch to Remote Desktop</value>
|
||||
</data>
|
||||
<data name="VNC_RDESKTOP_TRUN_ON" xml:space="preserve">
|
||||
<data name="VNC_RDESKTOP_TURN_ON" xml:space="preserve">
|
||||
<value>Turn &on Remote Desktop</value>
|
||||
</data>
|
||||
<data name="VNC_REDOCK" xml:space="preserve">
|
||||
|
@ -11408,7 +11408,7 @@ XenServer 可以重新启动服务器并将其 CPU 降至主服务器的级别
|
||||
<data name="VNC_RDESKTOP" xml:space="preserve">
|
||||
<value>切换到远程桌面(&I)</value>
|
||||
</data>
|
||||
<data name="VNC_RDESKTOP_TRUN_ON" xml:space="preserve">
|
||||
<data name="VNC_RDESKTOP_TURN_ON" xml:space="preserve">
|
||||
<value>启用远程桌面(&o)</value>
|
||||
</data>
|
||||
<data name="VNC_REDOCK" xml:space="preserve">
|
||||
|
@ -438,6 +438,25 @@ namespace XenAdmin.Core
|
||||
HostBuildNumber(host) == CUSTOM_BUILD_NUMBER;
|
||||
}
|
||||
|
||||
/// Creedence is ver. 2.0.0
|
||||
/// <param name="host">May be null, in which case true is returned.</param>
|
||||
public static bool CreamOrGreater(Host host)
|
||||
{
|
||||
if (host == null)
|
||||
return true;
|
||||
|
||||
string platform_version = HostPlatformVersion(host);
|
||||
return
|
||||
platform_version != null && productVersionCompare(platform_version, "1.9.90") > 0 ||
|
||||
HostBuildNumber(host) == CUSTOM_BUILD_NUMBER;
|
||||
}
|
||||
|
||||
/// <param name="conn">May be null, in which case true is returned.</param>
|
||||
public static bool CreamOrGreater(IXenConnection conn)
|
||||
{
|
||||
return conn == null ? true : CreamOrGreater(Helpers.GetMaster(conn));
|
||||
}
|
||||
|
||||
/// Clearwater is ver. 1.7.0
|
||||
/// <param name="conn">May be null, in which case true is returned.</param>
|
||||
public static bool IsClearwater(IXenConnection conn)
|
||||
|
7322
XenModel/XenAPI-Extensions/Proxy.cs
Executable file
7322
XenModel/XenAPI-Extensions/Proxy.cs
Executable file
File diff suppressed because it is too large
Load Diff
@ -404,6 +404,10 @@ namespace XenAPI
|
||||
Response<string []>
|
||||
task_get_subtasks(string session, string _task);
|
||||
|
||||
[XmlRpcMethod("task.get_backtrace")]
|
||||
Response<string>
|
||||
task_get_backtrace(string session, string _task);
|
||||
|
||||
[XmlRpcMethod("task.set_other_config")]
|
||||
Response<string>
|
||||
task_set_other_config(string session, string _task, Object _other_config);
|
||||
@ -2056,6 +2060,14 @@ namespace XenAPI
|
||||
Response<string>
|
||||
async_vm_query_services(string session, string _vm);
|
||||
|
||||
[XmlRpcMethod("VM.call_plugin")]
|
||||
Response<string>
|
||||
vm_call_plugin(string session, string _vm, string _plugin, string _fn, Object _args);
|
||||
|
||||
[XmlRpcMethod("Async.VM.call_plugin")]
|
||||
Response<string>
|
||||
async_vm_call_plugin(string session, string _vm, string _plugin, string _fn, Object _args);
|
||||
|
||||
[XmlRpcMethod("VM.get_all")]
|
||||
Response<string []>
|
||||
vm_get_all(string session);
|
||||
@ -2556,10 +2568,6 @@ namespace XenAPI
|
||||
Response<Object>
|
||||
vm_appliance_get_all_records(string session);
|
||||
|
||||
[XmlRpcMethod("VM.call_plugin")]
|
||||
Response<string>
|
||||
vm_call_plugin(string session, string _vm, string _plugin, string _fn, Object _args);
|
||||
|
||||
[XmlRpcMethod("DR_task.get_record")]
|
||||
Response<Proxy_DR_task>
|
||||
dr_task_get_record(string session, string _dr_task);
|
||||
@ -6591,6 +6599,7 @@ namespace XenAPI
|
||||
public Object other_config;
|
||||
public string subtask_of;
|
||||
public string [] subtasks;
|
||||
public string backtrace;
|
||||
}
|
||||
|
||||
[XmlRpcMissingMapping(MappingAction.Ignore)]
|
||||
|
@ -3581,7 +3581,7 @@ namespace XenAPI
|
||||
|
||||
/// <summary>
|
||||
/// List all the SR's that are required for the VM to be recovered
|
||||
/// First published in XenServer Creedence.
|
||||
/// First published in .
|
||||
/// </summary>
|
||||
/// <param name="session">The session</param>
|
||||
/// <param name="_vm">The opaque_ref of the given vm</param>
|
||||
@ -3593,7 +3593,7 @@ namespace XenAPI
|
||||
|
||||
/// <summary>
|
||||
/// List all the SR's that are required for the VM to be recovered
|
||||
/// First published in XenServer Creedence.
|
||||
/// First published in .
|
||||
/// </summary>
|
||||
/// <param name="session">The session</param>
|
||||
/// <param name="_vm">The opaque_ref of the given vm</param>
|
||||
@ -3705,6 +3705,34 @@ namespace XenAPI
|
||||
return XenRef<Task>.Create(session.proxy.async_vm_query_services(session.uuid, (_vm != null) ? _vm : "").parse());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Call a XenAPI plugin on this vm
|
||||
/// First published in Unreleased.
|
||||
/// </summary>
|
||||
/// <param name="session">The session</param>
|
||||
/// <param name="_vm">The opaque_ref of the given vm</param>
|
||||
/// <param name="_plugin">The name of the plugin</param>
|
||||
/// <param name="_fn">The name of the function within the plugin</param>
|
||||
/// <param name="_args">Arguments for the function</param>
|
||||
public static string call_plugin(Session session, string _vm, string _plugin, string _fn, Dictionary<string, string> _args)
|
||||
{
|
||||
return (string)session.proxy.vm_call_plugin(session.uuid, (_vm != null) ? _vm : "", (_plugin != null) ? _plugin : "", (_fn != null) ? _fn : "", Maps.convert_to_proxy_string_string(_args)).parse();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Call a XenAPI plugin on this vm
|
||||
/// First published in Unreleased.
|
||||
/// </summary>
|
||||
/// <param name="session">The session</param>
|
||||
/// <param name="_vm">The opaque_ref of the given vm</param>
|
||||
/// <param name="_plugin">The name of the plugin</param>
|
||||
/// <param name="_fn">The name of the function within the plugin</param>
|
||||
/// <param name="_args">Arguments for the function</param>
|
||||
public static XenRef<Task> async_call_plugin(Session session, string _vm, string _plugin, string _fn, Dictionary<string, string> _args)
|
||||
{
|
||||
return XenRef<Task>.Create(session.proxy.async_vm_call_plugin(session.uuid, (_vm != null) ? _vm : "", (_plugin != null) ? _plugin : "", (_fn != null) ? _fn : "", Maps.convert_to_proxy_string_string(_args)).parse());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Return a list of all the VMs known to the system.
|
||||
/// First published in XenServer 4.0.
|
||||
@ -3797,20 +3825,6 @@ namespace XenAPI
|
||||
}
|
||||
private vm_power_state _power_state;
|
||||
|
||||
/// <summary>
|
||||
/// Call a XenAPI plugin on this vm
|
||||
/// First published in XenServer 6.6.
|
||||
/// </summary>
|
||||
/// <param name="session">The session</param>
|
||||
/// <param name="_vm">The opaque_ref of the given vm</param>
|
||||
/// <param name="_plugin">The name of the plugin</param>
|
||||
/// <param name="_fn">The name of the function within the plugin</param>
|
||||
/// <param name="_args">Arguments for the function</param>
|
||||
public static string call_plugin(Session session, string _vm, string _plugin, string _fn, Dictionary<string, string> _args)
|
||||
{
|
||||
return (string)session.proxy.vm_call_plugin(session.uuid, (_vm != null) ? _vm : "", (_plugin != null) ? _plugin : "", (_fn != null) ? _fn : "", Maps.convert_to_proxy_string_string(_args)).parse();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// a human-readable name
|
||||
/// </summary>
|
||||
|
Loading…
Reference in New Issue
Block a user