Renamed AsyncAction.RunExternal to AsyncAction.RunSync so it is more descriptive.

Signed-off-by: Konstantina Chremmou <konstantina.chremmou@citrix.com>
This commit is contained in:
Konstantina Chremmou 2022-04-05 11:52:32 +01:00
parent 84ad7054ea
commit dce02a2562
40 changed files with 61 additions and 61 deletions

View File

@ -430,7 +430,7 @@ namespace XenAdmin.Alerts
public override void Dismiss()
{
new DestroyMessageAction(Message).RunExternal(Connection.Session);
new DestroyMessageAction(Message).RunSync(Connection.Session);
RemoveAlert(this);
}

View File

@ -142,7 +142,7 @@ namespace XenAdmin.Core
}
else
{
action.RunExternal(action.Session);
action.RunSync(action.Session);
}
return action.Succeeded;

View File

@ -46,7 +46,7 @@ namespace XenAdmin.Diagnostics.Checks
try
{
action.RunExternal(action.Session);
action.RunSync(action.Session);
}
catch
{

View File

@ -69,7 +69,7 @@ namespace XenAdmin.Diagnostics.Checks
try
{
action.RunExternal(action.Session);
action.RunSync(action.Session);
}
catch
{

View File

@ -283,7 +283,7 @@ namespace XenAdmin.Diagnostics.Checks
: new GetDiskSpaceRequirementsAction(Host, Update.Name(), Update.installation_size, true);
try
{
action.RunExternal(action.Session);
action.RunSync(action.Session);
}
catch
{

View File

@ -75,10 +75,10 @@ namespace XenAdmin.Diagnostics.Hotfixing
var coordinator = Helpers.GetCoordinator(host.Connection);
var filePath = Path.Combine(Program.AssemblyDir, String.Format("{0}.{1}", Filename, BrandManager.ExtensionUpdate));
var action = new UploadPatchAction(coordinator.Connection, filePath, false, false);
action.RunExternal(session);
action.RunSync(session);
patch = action.Patch;
}
new ApplyPatchAction(patch, host).RunExternal(session);
new ApplyPatchAction(patch, host).RunSync(session);
}
private void UploadAndApplyUpdate(Host host, Session session)
@ -89,10 +89,10 @@ namespace XenAdmin.Diagnostics.Hotfixing
var coordinator = Helpers.GetCoordinator(host.Connection);
var filePath = Path.Combine(Program.AssemblyDir, string.Format("{0}.{1}", Filename, InvisibleMessages.ISO_UPDATE));
var action = new UploadSupplementalPackAction(coordinator.Connection, new List<Host> { coordinator }, filePath, false);
action.RunExternal(session);
action.RunSync(session);
update = action.PoolUpdate;
}
new ApplyUpdateAction(update, host, false).RunExternal(session);
new ApplyUpdateAction(update, host, false).RunSync(session);
}
public override bool ShouldBeAppliedTo(Host host)

View File

@ -63,7 +63,7 @@ namespace XenAdmin.Diagnostics.Problems.PoolProblem
ss =>
{
var action = new DisableWLBAction(Pool, false);
action.RunExternal(ss);
action.RunSync(ss);
int count = 0;
while (Helpers.WlbEnabled(Pool.Connection) && count < 10)
{

View File

@ -143,7 +143,7 @@ namespace XenAdmin.Dialogs
}
if (dialogResult != DialogResult.Yes)
return;
new HAUnprotectVMAction(TheVM).RunExternal(TheVM.Connection.Session);
new HAUnprotectVMAction(TheVM).RunSync(TheVM.Connection.Session);
}
VDI vdi = NewDisk();

View File

@ -313,7 +313,7 @@ namespace XenAdmin.Wizards.DRWizards
VdiOpenDatabaseAction action = new VdiOpenDatabaseAction(Connection,
((AssertCanBeRecoveredCheck
)checkGroup[0]).Vdi);
action.RunExternal(action.Session);
action.RunSync(action.Session);
if (action.Succeeded && action.MetadataSession != null)
metadataSession = action.MetadataSession;
}

View File

@ -151,7 +151,7 @@ namespace XenAdmin.Wizards.NewVMWizard
try
{
action.RunExternal(Connection.Session);
action.RunSync(Connection.Session);
var result = action.Result.Replace("\n", Environment.NewLine);
ConfigDriveTemplateTextBox.Text = result;
existingConfig = result;

View File

@ -56,7 +56,7 @@ namespace XenAdmin.Wizards.PatchingWizard.PlanActions
EvacuateHost(ref session);
AddProgressStep(string.Format(Messages.UPDATES_WIZARD_APPLYING_UPDATE, _poolUpdate.Name(), host.Name()));
new ApplyUpdateAction(_poolUpdate, host, true).RunExternal(session);
new ApplyUpdateAction(_poolUpdate, host, true).RunSync(session);
}
}
}

View File

@ -93,7 +93,7 @@ namespace XenAdmin.Wizards.PatchingWizard.PlanActions
downloadAction.Changed += downloadAndUnzipXenServerPatchAction_Changed;
downloadAction.Completed += downloadAndUnzipXenServerPatchAction_Completed;
downloadAction.RunExternal(session);
downloadAction.RunSync(session);
}
private void downloadAndUnzipXenServerPatchAction_Changed(ActionBase action)

View File

@ -52,7 +52,7 @@ namespace XenAdmin.Wizards.PatchingWizard.PlanActions
{
AddProgressStep(string.Format(Messages.UPDATES_WIZARD_APPLYING_UPDATE, vdi.Name(), host.Name()));
var suppPackVdis = new Dictionary<Host, VDI> { { host, vdi } };
new InstallSupplementalPackAction(suppPackVdis, true).RunExternal(session);
new InstallSupplementalPackAction(suppPackVdis, true).RunSync(session);
}
}
}

View File

@ -49,7 +49,7 @@ namespace XenAdmin.Wizards.PatchingWizard.PlanActions
protected override void RunWithSession(ref Session session)
{
AddProgressStep(string.Format(Messages.UPDATES_WIZARD_REMOVING_UPDATE, _patch.Name(), _pool.Name()));
new PoolPatchCleanAction(_pool, _patch, true).RunExternal(session);
new PoolPatchCleanAction(_pool, _patch, true).RunSync(session);
}
}
}

View File

@ -59,7 +59,7 @@ namespace XenAdmin.Wizards.PatchingWizard.PlanActions
{
var action = _problems[i].CreateUnwindChangesAction();
if (action != null && action.Connection != null && action.Connection.IsConnected)
action.RunExternal(null);
action.RunSync(null);
PercentComplete = i * 100 / _problems.Count;
}
}

View File

@ -177,7 +177,7 @@ namespace XenAdmin.Wizards.PatchingWizard.PlanActions
uploadIsoAction.Changed += uploadAction_Changed;
uploadIsoAction.Completed += uploadAction_Completed;
inProgressAction = uploadIsoAction;
uploadIsoAction.RunExternal(session);
uploadIsoAction.RunSync(session);
var poolUpdate = uploadIsoAction.PoolUpdate;
@ -205,7 +205,7 @@ namespace XenAdmin.Wizards.PatchingWizard.PlanActions
uploadPatchAction.Changed += uploadAction_Changed;
uploadPatchAction.Completed += uploadAction_Completed;
inProgressAction = uploadPatchAction;
uploadPatchAction.RunExternal(session);
uploadPatchAction.RunSync(session);
// this has to be run again to refresh poolPatches (to get the recently uploaded one as well)
var poolPatches = new List<Pool_patch>(conn.Cache.Pool_patches);
@ -248,7 +248,7 @@ namespace XenAdmin.Wizards.PatchingWizard.PlanActions
uploadIsoAction.Changed += uploadAction_Changed;
uploadIsoAction.Completed += uploadAction_Completed;
inProgressAction = uploadIsoAction;
uploadIsoAction.RunExternal(session);
uploadIsoAction.RunSync(session);
var poolUpdate = uploadIsoAction.PoolUpdate;
@ -274,7 +274,7 @@ namespace XenAdmin.Wizards.PatchingWizard.PlanActions
{
var checkSpaceForUpload = new CheckDiskSpaceForPatchUploadAction(Helpers.GetCoordinator(conn), path, true);
inProgressAction = checkSpaceForUpload;
checkSpaceForUpload.RunExternal(session);
checkSpaceForUpload.RunSync(session);
}
catch (NotEnoughSpaceException e)
{
@ -292,7 +292,7 @@ namespace XenAdmin.Wizards.PatchingWizard.PlanActions
), null);
if (dialogResult is DialogResult dr && dr == DialogResult.OK)
new CleanupDiskSpaceAction(e.DiskSpaceRequirements.Host, null, true).RunExternal(session);
new CleanupDiskSpaceAction(e.DiskSpaceRequirements.Host, null, true).RunSync(session);
else
throw;
}

View File

@ -134,7 +134,7 @@ namespace XenAdmin.Wizards.RollingUpgradeWizard.PlanActions
uploadIsoAction = new UploadSupplementalPackAction(connection, new List<Host> { coordinator }, suppPackPath, true);
uploadIsoAction.Changed += uploadAction_Changed;
uploadIsoAction.Completed += uploadAction_Completed;
uploadIsoAction.RunExternal(session);
uploadIsoAction.RunSync(session);
}
catch (Exception ex)
{

View File

@ -170,7 +170,7 @@ namespace XenAdmin.Actions
public void RunAsync(SudoElevationResult sudoElevationResult)
{
AuditLogStarted();
System.Threading.ThreadPool.QueueUserWorkItem(RunWorkerThread, sudoElevationResult);
ThreadPool.QueueUserWorkItem(RunWorkerThread, sudoElevationResult);
}
/// <summary>
@ -179,7 +179,7 @@ namespace XenAdmin.Actions
/// use that session for the action: it is then the responsibility of the calling function
/// to make sure the session has the appropriate privileges and tidy it up afterwards.
/// </summary>
public void RunExternal(Session session)
public void RunSync(Session session)
{
RunWorkerThread(session);
if (Exception != null)

View File

@ -88,7 +88,7 @@ namespace XenAdmin.Actions.DR
action = new VMStartAction(vm, _warningDialogHAInvalidConfig, _startDiagnosisForm);
Description = action.Title;
action.Changed += action_Changed;
action.RunExternal(Session);
action.RunSync(Session);
ActionCountCompleted++;
}
@ -97,7 +97,7 @@ namespace XenAdmin.Actions.DR
var action = new StartApplianceAction(vmAppliance, paused);
Description = action.Title;
action.Changed += action_Changed;
action.RunExternal(Session);
action.RunSync(Session);
ActionCountCompleted++;
}
}

View File

@ -112,7 +112,7 @@ namespace XenAdmin.Actions
{
try
{
new HostPowerOnAction(toHost).RunExternal(Session);
new HostPowerOnAction(toHost).RunSync(Session);
}
catch (Exception)
{

View File

@ -121,7 +121,7 @@ namespace XenAdmin.Actions.HostActions
if (null != pool)
{
SendWlbConfigurationAction action = new SendWlbConfigurationAction(pool, hostConfig.ToDictionary(), SendWlbConfigurationKind.SetHostConfiguration);
action.RunExternal(Session);
action.RunSync(Session);
}
else
{

View File

@ -93,7 +93,7 @@ namespace XenAdmin.Actions
var wlbAction = new SendWlbConfigurationAction(pool, hostConfig.ToDictionary(),
SendWlbConfigurationKind.SetHostConfiguration);
wlbAction.RunExternal(Session);
wlbAction.RunSync(Session);
}
}
catch

View File

@ -156,7 +156,7 @@ namespace XenAdmin.Actions
try
{
SubActionTitle = subAction.Title;
subAction.RunExternal(Session);
subAction.RunSync(Session);
}
catch (Exception e)
{

View File

@ -139,7 +139,7 @@ namespace XenAdmin.Actions
return;
try
{
action.RunExternal(action.Session);
action.RunSync(action.Session);
}
catch (Exception e)
{

View File

@ -170,7 +170,7 @@ namespace XenAdmin.Actions
new RunPluginAction(host.Connection, host,
XenServerPlugins.PLUGIN_PERFMON_PLUGIN,
XenServerPlugins.PLUGIN_PERFMON_FUNCTION_REFRESH,
new Dictionary<string, string>(), true).RunExternal(Session);
new Dictionary<string, string>(), true).RunSync(Session);
}
catch (Exception e)
{
@ -183,12 +183,12 @@ namespace XenAdmin.Actions
new RunPluginAction(host.Connection, host,
XenServerPlugins.PLUGIN_PERFMON_PLUGIN,
XenServerPlugins.PLUGIN_PERFMON_FUNCTION_START,
new Dictionary<string, string>(), true).RunExternal(Session);
new Dictionary<string, string>(), true).RunSync(Session);
new RunPluginAction(host.Connection, host,
XenServerPlugins.PLUGIN_PERFMON_PLUGIN,
XenServerPlugins.PLUGIN_PERFMON_FUNCTION_REFRESH,
new Dictionary<string, string>(), true).RunExternal(Session);
new Dictionary<string, string>(), true).RunSync(Session);
}
catch (Exception ex)
{

View File

@ -68,7 +68,7 @@ namespace XenAdmin.Actions
Host poolCoordinator = Helpers.GetCoordinator(pool);
AsyncAction action = new ApplyLicenseEditionAction(hostsToRelicense.ConvertAll(h=>h as IXenObject), Host.GetEdition(poolCoordinator.edition), poolCoordinator.license_server["address"], poolCoordinator.license_server["port"],
doOnLicensingFailure);
action.RunExternal(null);
action.RunSync(null);
}
/// <summary>
@ -167,7 +167,7 @@ namespace XenAdmin.Actions
action = new EnableAdAction(h.Connection, poolCoordinator.external_auth_service_name,
adUserAndPassword.Username, adUserAndPassword.Password)
{Host = h};
action.RunExternal(null);
action.RunSync(null);
}
}
catch (EnableAdAction.CredentialsFailure)

View File

@ -84,7 +84,7 @@ namespace XenAdmin.Actions
var getDiskSpaceRequirementsAction = new GetDiskSpaceRequirementsAction(Host, fileName, fileSize, true);
try
{
getDiskSpaceRequirementsAction.RunExternal(Session);
getDiskSpaceRequirementsAction.RunSync(Session);
diskSpaceRequirements = getDiskSpaceRequirementsAction.DiskSpaceRequirements;
}
catch (Failure failure)

View File

@ -132,7 +132,7 @@ namespace XenAdmin.Actions
throw new Failure(Failure.HANDLE_INVALID, "SR", Result);
// Set this SR to be the default
new SrAction(SrActionKind.SetAsDefault, new_sr).RunExternal(Session);
new SrAction(SrActionKind.SetAsDefault, new_sr).RunSync(Session);
}
Description = Messages.ACTION_SR_ATTACH_SUCCESSFUL;

View File

@ -211,7 +211,7 @@ namespace XenAdmin.Actions
throw new Failure(Failure.HANDLE_INVALID, "SR", Result);
// Set this SR to be the default
new SrAction(SrActionKind.SetAsDefault, new_sr).RunExternal(Session);
new SrAction(SrActionKind.SetAsDefault, new_sr).RunSync(Session);
}
Description = Messages.ACTION_SR_CREATE_SUCCESSFUL;

View File

@ -95,7 +95,7 @@ namespace XenAdmin.Actions
Helpers.GetName(vm).Ellipsise(20)));
}
DetachVirtualDiskAction action = new DetachVirtualDiskAction(Disk, vm, false);
action.RunExternal(Session);
action.RunSync(Session);
}
RelatedTask = XenAPI.VDI.async_destroy(Session, Disk.opaque_ref);

View File

@ -55,10 +55,10 @@ namespace XenAdmin.Actions
{
Description = Messages.ACTION_VIF_UPDATING;
new DeleteVIFAction(vif, true).RunExternal(Session);
new DeleteVIFAction(vif, true).RunSync(Session);
var createAction = new CreateVIFAction(VM, vifDescriptor, true);
createAction.RunExternal(Session);
createAction.RunSync(Session);
RebootRequired = createAction.RebootRequired;
Description = Messages.ACTION_VIF_UPDATED;

View File

@ -107,7 +107,7 @@ namespace XenAdmin.Actions
try
{
action.RunExternal(Session);
action.RunSync(Session);
}
catch
{
@ -146,7 +146,7 @@ namespace XenAdmin.Actions
else
action = new VMStartOnAction(VM, _vmHost, _warningDialogHaInvalidConfig, _startDiagnosticForm);
action.RunExternal(Session);
action.RunSync(Session);
}
}

View File

@ -87,7 +87,7 @@ namespace XenAdmin.Actions
var cdCreate = new VbdSaveAndPlugAction(VM, cdDrive, Messages.DVD_DRIVE, Session, true);
cdCreate.ShowUserInstruction += msg => ShowUserInstruction?.Invoke(msg);
cdCreate.RunExternal(Session);
cdCreate.RunSync(Session);
Description = Messages.NEW_DVD_DRIVE_DONE;
}
}

View File

@ -284,7 +284,7 @@ namespace XenAdmin.Actions.VMActions
parameters,
true); //hidefromlogs
action.RunExternal(Connection.Session);
action.RunSync(Connection.Session);
var result = action.Result.Replace("\n", Environment.NewLine);
}
}
@ -304,7 +304,7 @@ namespace XenAdmin.Actions.VMActions
});
}
var action = new GpuAssignAction(VM, newvGpus);
action.RunExternal(Session);
action.RunSync(Session);
}
}
@ -329,7 +329,7 @@ namespace XenAdmin.Actions.VMActions
XenAPI.VM.set_name_label(Session, VM.opaque_ref, NameLabel);
XenAPI.VM.set_name_description(Session, VM.opaque_ref, NameDescription);
ChangeVCPUSettingsAction vcpuAction = new ChangeVCPUSettingsAction(VM, VcpusMax, VcpusAtStartup);
vcpuAction.RunExternal(Session);
vcpuAction.RunSync(Session);
// set cores-per-socket
Dictionary<string, string> platform = VM.platform == null ?

View File

@ -75,7 +75,7 @@ namespace XenAdmin.Actions
try
{
SrRepairAction action = new SrRepairAction(sr.Connection, sr, false);
action.RunExternal(Session);
action.RunSync(Session);
}
catch (Failure f)
{

View File

@ -82,7 +82,7 @@ namespace XenAdmin.Actions.VMActions
action = new VMResumeAction(vm, _warningDialogHAInvalidConfig, _startDiagnosisForm);
action.Changed += action_Changed;
action.RunExternal(Session);
action.RunSync(Session);
ActionCountCompleted++;
}
@ -97,7 +97,7 @@ namespace XenAdmin.Actions.VMActions
action = new VMStartAction(vm, _warningDialogHAInvalidConfig, _startDiagnosisForm);
action.Changed += action_Changed;
action.RunExternal(Session);
action.RunSync(Session);
ActionCountCompleted++;
}
}

View File

@ -72,7 +72,7 @@ namespace XenAdmin.Actions.VMActions
Description = string.Format(Messages.SUSPENDING_VM_OUT_OF, ActionCountCompleted + 1, VmsToSuspend.Count);
var action = new VMSuspendAction(vm);
action.Changed += action_Changed;
action.RunExternal(Session);
action.RunSync(Session);
ActionCountCompleted++;
}
@ -81,7 +81,7 @@ namespace XenAdmin.Actions.VMActions
Description = string.Format(Messages.SHUTTING_DOWN_VM_OUT_OF, ActionCountCompleted - VmsToSuspend.Count + 1, VmsToShutdown.Count);
var action = new VMHardShutdown(vm);
action.Changed += action_Changed;
action.RunExternal(Session);
action.RunSync(Session);
ActionCountCompleted++;
}
}

View File

@ -85,7 +85,7 @@ namespace XenAdmin.Actions.VMActions
// Warn the user about this and ask if they want to fix it.
log.Debug("VM is not agile, but protected", exn);
_WarningDialogHAInvalidConfig(VM,IsStart);
new HAUnprotectVMAction(VM).RunExternal(Session);
new HAUnprotectVMAction(VM).RunSync(Session);
}
}

View File

@ -446,7 +446,7 @@ namespace XenAdmin.Model
if (session == null)
action.RunAsync();
else
action.RunExternal(session);
action.RunSync(session);
}
public static void Move(IXenObject ixmo, Folder target)
@ -477,7 +477,7 @@ namespace XenAdmin.Model
if (session == null)
action.RunAsync();
else
action.RunExternal(session);
action.RunSync(session);
}
public static void Unfolder(IXenObject ixmo)

View File

@ -94,7 +94,7 @@ namespace XenServerHealthCheck
foreach (Host host in connection.Cache.Hosts)
{
GetSystemStatusCapabilities action = new GetSystemStatusCapabilities(host);
action.RunExternal(session);
action.RunSync(session);
if (!action.Succeeded)
return;
@ -178,7 +178,7 @@ namespace XenServerHealthCheck
}
var statAction = new SingleHostStatusAction(host, 0, reportIncluded, filepath, timestring + "-" + ++i);
statAction.RunExternal(session);
statAction.RunSync(session);
}
// output the supporter/coordinator info
@ -193,7 +193,7 @@ namespace XenServerHealthCheck
// Finish the collection of logs with bugtool.
// Start to zip the files.
ZipStatusReportAction zipAction = new ZipStatusReportAction(filepath, outputFile);
zipAction.RunExternal(session);
zipAction.RunSync(session);
log.InfoFormat("Server Status Report is collected: {0}", outputFile);
}