diff options
| author | Jenkins <jenkins@review.openstack.org> | 2012-11-19 22:51:13 +0000 |
|---|---|---|
| committer | Gerrit Code Review <review@openstack.org> | 2012-11-19 22:51:13 +0000 |
| commit | a17723a6b02e9fabc852c9b650742fdb7aa93adb (patch) | |
| tree | c2deb72532766c7fcb3eb29f069c1da516253035 | |
| parent | fa18112538a61d71b60e08dca27af1b7ae30a6d4 (diff) | |
| parent | e0a25b83c63feac4752f623bb2715fffc825478b (diff) | |
| download | nova-a17723a6b02e9fabc852c9b650742fdb7aa93adb.tar.gz nova-a17723a6b02e9fabc852c9b650742fdb7aa93adb.tar.xz nova-a17723a6b02e9fabc852c9b650742fdb7aa93adb.zip | |
Merge "Fixes an error reporting bug on Hyper-V"
| -rw-r--r-- | nova/virt/hyperv/vmutils.py | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/nova/virt/hyperv/vmutils.py b/nova/virt/hyperv/vmutils.py index 15c03e613..8e509cd28 100644 --- a/nova/virt/hyperv/vmutils.py +++ b/nova/virt/hyperv/vmutils.py @@ -55,7 +55,6 @@ class VMUtils(object): else: return vms[0].ElementName - #TODO(alexpilotti): use the reactor to poll instead of sleep def check_job_status(self, jobpath): """Poll WMI job state for completion""" job_wmi_path = jobpath.replace('\\', '/') @@ -65,12 +64,26 @@ class VMUtils(object): time.sleep(0.1) job = wmi.WMI(moniker=job_wmi_path) if job.JobState != constants.WMI_JOB_STATE_COMPLETED: - LOG.debug(_("WMI job failed: %(ErrorSummaryDescription)s - " - "%(ErrorDescription)s - %(ErrorCode)s") % job) + job_state = job.JobState + if job.path().Class == "Msvm_ConcreteJob": + err_sum_desc = job.ErrorSummaryDescription + err_desc = job.ErrorDescription + err_code = job.ErrorCode + LOG.debug(_("WMI job failed with status %(job_state)d. " + "Error details: %(err_sum_desc)s - %(err_desc)s - " + "Error code: %(err_code)d") % locals()) + else: + (error, ret_val) = job.GetError() + if not ret_val and error: + LOG.debug(_("WMI job failed with status %(job_state)d. " + "Error details: %(error)s") % locals()) + else: + LOG.debug(_("WMI job failed with status %(job_state)d. " + "No error description available") % locals()) return False desc = job.Description elap = job.ElapsedTime - LOG.debug(_("WMI job succeeded: %(desc)s, Elapsed=%(elap)s ") + LOG.debug(_("WMI job succeeded: %(desc)s, Elapsed=%(elap)s") % locals()) return True |
