66
65
job = wmi.WMI(moniker=job_wmi_path)
67
66
if job.JobState != constants.WMI_JOB_STATE_COMPLETED:
68
LOG.debug(_("WMI job failed: %(ErrorSummaryDescription)s - "
69
"%(ErrorDescription)s - %(ErrorCode)s") % job)
67
job_state = job.JobState
68
if job.path().Class == "Msvm_ConcreteJob":
69
err_sum_desc = job.ErrorSummaryDescription
70
err_desc = job.ErrorDescription
71
err_code = job.ErrorCode
72
LOG.debug(_("WMI job failed with status %(job_state)d. "
73
"Error details: %(err_sum_desc)s - %(err_desc)s - "
74
"Error code: %(err_code)d") % locals())
76
(error, ret_val) = job.GetError()
77
if not ret_val and error:
78
LOG.debug(_("WMI job failed with status %(job_state)d. "
79
"Error details: %(error)s") % locals())
81
LOG.debug(_("WMI job failed with status %(job_state)d. "
82
"No error description available") % locals())
71
84
desc = job.Description
72
85
elap = job.ElapsedTime
73
LOG.debug(_("WMI job succeeded: %(desc)s, Elapsed=%(elap)s ")
86
LOG.debug(_("WMI job succeeded: %(desc)s, Elapsed=%(elap)s")
90
def get_instance_path(self, instance_name):
91
instance_path = os.path.join(CONF.instances_path, instance_name)
92
if not os.path.exists(instance_path):
93
LOG.debug(_('Creating folder %s '), instance_path)
94
os.makedirs(instance_path)
77
97
def get_vhd_path(self, instance_name):
78
base_vhd_folder = os.path.join(FLAGS.instances_path, instance_name)
79
if not os.path.exists(base_vhd_folder):
80
LOG.debug(_('Creating folder %s '), base_vhd_folder)
81
os.makedirs(base_vhd_folder)
82
return os.path.join(base_vhd_folder, instance_name + ".vhd")
98
instance_path = self.get_instance_path(instance_name)
99
return os.path.join(instance_path, instance_name + ".vhd")
84
101
def get_base_vhd_path(self, image_name):
85
base_dir = os.path.join(FLAGS.instances_path, '_base')
102
base_dir = os.path.join(CONF.instances_path, '_base')
86
103
if not os.path.exists(base_dir):
87
104
os.makedirs(base_dir)
88
105
return os.path.join(base_dir, image_name + ".vhd")
90
107
def make_export_path(self, instance_name):
91
export_folder = os.path.join(FLAGS.instances_path, "export",
108
export_folder = os.path.join(CONF.instances_path, "export",
93
110
if os.path.isdir(export_folder):
94
111
LOG.debug(_('Removing existing folder %s '), export_folder)