4
4
5
5
from autotest .client .shared import error
6
6
7
+ from avocado .utils import process
8
+
7
9
from virttest import data_dir
8
10
from virttest import virsh
9
11
from virttest import utils_test
@@ -91,28 +93,28 @@ def _is_stress_running():
91
93
92
94
result = virsh .qemu_monitor_command (vm_name , attach_cmd , options = options )
93
95
if result .exit_status :
94
- raise error .CmdError (result .command , result )
96
+ raise process .CmdError (result .command , result )
95
97
if keyboard :
96
98
attach_cmd = "device_add"
97
99
attach_cmd += " usb-kdb,bus=usb1.0,id=kdb"
98
100
99
101
result = virsh .qemu_monitor_command (vm_name , attach_cmd , options = options )
100
102
if result .exit_status :
101
- raise error .CmdError (result .command , result )
103
+ raise process .CmdError (result .command , result )
102
104
if mouse :
103
105
attach_cmd = "device_add"
104
106
attach_cmd += " usb-mouse,bus=usb1.0,id=mouse"
105
107
106
108
result = virsh .qemu_monitor_command (vm_name , attach_cmd , options = options )
107
109
if result .exit_status :
108
- raise error .CmdError (result .command , result )
110
+ raise process .CmdError (result .command , result )
109
111
if tablet :
110
112
attach_cmd = "device_add"
111
113
attach_cmd += " usb-tablet,bus=usb1.0,id=tablet"
112
114
113
115
result = virsh .qemu_monitor_command (vm_name , attach_cmd , options = options )
114
116
if result .exit_status :
115
- raise error .CmdError (result .command , result )
117
+ raise process .CmdError (result .command , result )
116
118
else :
117
119
if disk :
118
120
utils_test .libvirt .create_local_disk ("file" , path , size = "1M" )
@@ -128,7 +130,7 @@ def _is_stress_running():
128
130
129
131
result = virsh .attach_device (vm_name , disk_xml .xml )
130
132
if result .exit_status :
131
- raise error .CmdError (result .command , result )
133
+ raise process .CmdError (result .command , result )
132
134
if mouse :
133
135
mouse_xml = Input ("mouse" )
134
136
mouse_xml .input_bus = "usb"
@@ -137,7 +139,7 @@ def _is_stress_running():
137
139
138
140
result = virsh .attach_device (vm_name , mouse_xml .xml )
139
141
if result .exit_status :
140
- raise error .CmdError (result .command , result )
142
+ raise process .CmdError (result .command , result )
141
143
if tablet :
142
144
tablet_xml = Input ("tablet" )
143
145
tablet_xml .input_bus = "usb"
@@ -146,7 +148,7 @@ def _is_stress_running():
146
148
147
149
result = virsh .attach_device (vm_name , tablet_xml .xml )
148
150
if result .exit_status :
149
- raise error .CmdError (result .command , result )
151
+ raise process .CmdError (result .command , result )
150
152
if keyboard :
151
153
kbd_xml = Input ("keyboard" )
152
154
kbd_xml .input_bus = "usb"
@@ -155,7 +157,7 @@ def _is_stress_running():
155
157
156
158
result = virsh .attach_device (vm_name , kbd_xml .xml )
157
159
if result .exit_status :
158
- raise error .CmdError (result .command , result )
160
+ raise process .CmdError (result .command , result )
159
161
160
162
if attach_type == "qemu_monitor" :
161
163
options = "--hmp"
@@ -165,46 +167,46 @@ def _is_stress_running():
165
167
166
168
result = virsh .qemu_monitor_command (vm_name , attach_cmd , options = options )
167
169
if result .exit_status :
168
- raise error .CmdError (result .command , result )
170
+ raise process .CmdError (result .command , result )
169
171
if mouse :
170
172
attach_cmd = "device_del"
171
173
attach_cmd += (" mouse" )
172
174
173
175
result = virsh .qemu_monitor_command (vm_name , attach_cmd , options = options )
174
176
if result .exit_status :
175
- raise error .CmdError (result .command , result )
177
+ raise process .CmdError (result .command , result )
176
178
if keyboard :
177
179
attach_cmd = "device_del"
178
180
attach_cmd += (" keyboard" )
179
181
180
182
result = virsh .qemu_monitor_command (vm_name , attach_cmd , options = options )
181
183
if result .exit_status :
182
- raise error .CmdError (result .command , result )
184
+ raise process .CmdError (result .command , result )
183
185
if tablet :
184
186
attach_cmd = "device_del"
185
187
attach_cmd += (" tablet" )
186
188
187
189
result = virsh .qemu_monitor_command (vm_name , attach_cmd , options = options )
188
190
if result .exit_status :
189
- raise error .CmdError (result .command , result )
191
+ raise process .CmdError (result .command , result )
190
192
else :
191
193
if disk :
192
194
result = virsh .detach_device (vm_name , disk_xml .xml )
193
195
if result .exit_status :
194
- raise error .CmdError (result .command , result )
196
+ raise process .CmdError (result .command , result )
195
197
if mouse :
196
198
result = virsh .detach_device (vm_name , mouse_xml .xml )
197
199
if result .exit_status :
198
- raise error .CmdError (result .command , result )
200
+ raise process .CmdError (result .command , result )
199
201
if keyboard :
200
202
result = virsh .detach_device (vm_name , kbd_xml .xml )
201
203
if result .exit_status :
202
- raise error .CmdError (result .command , result )
204
+ raise process .CmdError (result .command , result )
203
205
if tablet :
204
206
result = virsh .detach_device (vm_name , tablet_xml .xml )
205
207
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 :
208
210
if not status_error :
209
211
raise error .TestFail ("failed to attach device.\n "
210
212
"Detail: %s." % result )
0 commit comments