Skip to content

Commit 9456d00

Browse files
committed
CA-413432: convert variant select operation async mode
if variant select operation is in sync mode, it might take about one minute to complete Signed-off-by: Chunjie Zhu <[email protected]>
1 parent 6461c6b commit 9456d00

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

plugins-base/XSFeatureDMV.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,8 @@ def DoSelect(cls, inDMVHandle, variantRef):
6666
driver = HotAccessor().dmv[inDMVHandle]
6767
driverRef = driver.HotOpaqueRef().OpaqueRef()
6868

69-
# This is an immediate operation, cannot be executed in async mode.
70-
Task.Sync(lambda x: x.xenapi.Host_driver.select(driverRef, variantRef))
69+
task = Task.New(lambda x: x.xenapi.Async.Host_driver.select(driverRef, variantRef))
70+
return task
7171

7272
class DriverSelectDialogue(Dialogue):
7373
def __init__(self, inDMVHandle):
@@ -206,11 +206,11 @@ def Commit(self):
206206

207207
messagePrefix = Lang('Selecting variant ') + variantName + Lang(' for driver ') + driverName + Lang(' ')
208208
try:
209-
DMVUtils.DoSelect(self.dmvHandle, self.selectedVariantOpaqueRef)
209+
task = DMVUtils.DoSelect(self.dmvHandle, self.selectedVariantOpaqueRef)
210+
Layout.Inst().PushDialogue(ProgressDialogue(task, messagePrefix))
210211

211-
promptMessage = Lang('successful.\n\nPlease reboot host to enable the selected variant.')
212-
Layout.Inst().PushDialogue(InfoDialogue(messagePrefix + promptMessage))
213212
except Exception as e:
213+
self.ChangState('INITIAL')
214214
Layout.Inst().PushDialogue(InfoDialogue(messagePrefix + Lang("Failed."), Lang(e)))
215215

216216
class XSFeatureDMV:

0 commit comments

Comments
 (0)