44
55from autotest .client .shared import error
66
7+ from avocado .utils import process
8+
79from virttest import data_dir
810from virttest import virsh
911from virttest import utils_test
@@ -91,28 +93,28 @@ def _is_stress_running():
9193
9294 result = virsh .qemu_monitor_command (vm_name , attach_cmd , options = options )
9395 if result .exit_status :
94- raise error .CmdError (result .command , result )
96+ raise process .CmdError (result .command , result )
9597 if keyboard :
9698 attach_cmd = "device_add"
9799 attach_cmd += " usb-kdb,bus=usb1.0,id=kdb"
98100
99101 result = virsh .qemu_monitor_command (vm_name , attach_cmd , options = options )
100102 if result .exit_status :
101- raise error .CmdError (result .command , result )
103+ raise process .CmdError (result .command , result )
102104 if mouse :
103105 attach_cmd = "device_add"
104106 attach_cmd += " usb-mouse,bus=usb1.0,id=mouse"
105107
106108 result = virsh .qemu_monitor_command (vm_name , attach_cmd , options = options )
107109 if result .exit_status :
108- raise error .CmdError (result .command , result )
110+ raise process .CmdError (result .command , result )
109111 if tablet :
110112 attach_cmd = "device_add"
111113 attach_cmd += " usb-tablet,bus=usb1.0,id=tablet"
112114
113115 result = virsh .qemu_monitor_command (vm_name , attach_cmd , options = options )
114116 if result .exit_status :
115- raise error .CmdError (result .command , result )
117+ raise process .CmdError (result .command , result )
116118 else :
117119 if disk :
118120 utils_test .libvirt .create_local_disk ("file" , path , size = "1M" )
@@ -128,7 +130,7 @@ def _is_stress_running():
128130
129131 result = virsh .attach_device (vm_name , disk_xml .xml )
130132 if result .exit_status :
131- raise error .CmdError (result .command , result )
133+ raise process .CmdError (result .command , result )
132134 if mouse :
133135 mouse_xml = Input ("mouse" )
134136 mouse_xml .input_bus = "usb"
@@ -137,7 +139,7 @@ def _is_stress_running():
137139
138140 result = virsh .attach_device (vm_name , mouse_xml .xml )
139141 if result .exit_status :
140- raise error .CmdError (result .command , result )
142+ raise process .CmdError (result .command , result )
141143 if tablet :
142144 tablet_xml = Input ("tablet" )
143145 tablet_xml .input_bus = "usb"
@@ -146,7 +148,7 @@ def _is_stress_running():
146148
147149 result = virsh .attach_device (vm_name , tablet_xml .xml )
148150 if result .exit_status :
149- raise error .CmdError (result .command , result )
151+ raise process .CmdError (result .command , result )
150152 if keyboard :
151153 kbd_xml = Input ("keyboard" )
152154 kbd_xml .input_bus = "usb"
@@ -155,7 +157,7 @@ def _is_stress_running():
155157
156158 result = virsh .attach_device (vm_name , kbd_xml .xml )
157159 if result .exit_status :
158- raise error .CmdError (result .command , result )
160+ raise process .CmdError (result .command , result )
159161
160162 if attach_type == "qemu_monitor" :
161163 options = "--hmp"
@@ -165,46 +167,46 @@ def _is_stress_running():
165167
166168 result = virsh .qemu_monitor_command (vm_name , attach_cmd , options = options )
167169 if result .exit_status :
168- raise error .CmdError (result .command , result )
170+ raise process .CmdError (result .command , result )
169171 if mouse :
170172 attach_cmd = "device_del"
171173 attach_cmd += (" mouse" )
172174
173175 result = virsh .qemu_monitor_command (vm_name , attach_cmd , options = options )
174176 if result .exit_status :
175- raise error .CmdError (result .command , result )
177+ raise process .CmdError (result .command , result )
176178 if keyboard :
177179 attach_cmd = "device_del"
178180 attach_cmd += (" keyboard" )
179181
180182 result = virsh .qemu_monitor_command (vm_name , attach_cmd , options = options )
181183 if result .exit_status :
182- raise error .CmdError (result .command , result )
184+ raise process .CmdError (result .command , result )
183185 if tablet :
184186 attach_cmd = "device_del"
185187 attach_cmd += (" tablet" )
186188
187189 result = virsh .qemu_monitor_command (vm_name , attach_cmd , options = options )
188190 if result .exit_status :
189- raise error .CmdError (result .command , result )
191+ raise process .CmdError (result .command , result )
190192 else :
191193 if disk :
192194 result = virsh .detach_device (vm_name , disk_xml .xml )
193195 if result .exit_status :
194- raise error .CmdError (result .command , result )
196+ raise process .CmdError (result .command , result )
195197 if mouse :
196198 result = virsh .detach_device (vm_name , mouse_xml .xml )
197199 if result .exit_status :
198- raise error .CmdError (result .command , result )
200+ raise process .CmdError (result .command , result )
199201 if keyboard :
200202 result = virsh .detach_device (vm_name , kbd_xml .xml )
201203 if result .exit_status :
202- raise error .CmdError (result .command , result )
204+ raise process .CmdError (result .command , result )
203205 if tablet :
204206 result = virsh .detach_device (vm_name , tablet_xml .xml )
205207 if result .exit_status :
206- raise error .CmdError (result .command , result )
207- except error .CmdError , e :
208+ raise process .CmdError (result .command , result )
209+ except process .CmdError , e :
208210 if not status_error :
209211 raise error .TestFail ("failed to attach device.\n "
210212 "Detail: %s." % result )
0 commit comments