Add qerror message if the 'change' target filename can't be opened

Currently when using the change command to switch the file in the cd drive
the command doesn't complain if the file doesn't exit or can't be opened
and the drive keeps the existing image.  This patch adds a qerror_report
call to print a message out indicating the failure.  This error message
can be used to catch failures.

Current behavior:

QEMU 0.12.50 monitor - type 'help' for more information
(qemu) info block
ide0-hd0: type=hd removable=0 file=/dev/null ro=0 drv=host_device encrypted=0
ide1-cd0: type=cdrom removable=1 locked=0 [not inserted]
floppy0: type=floppy removable=1 locked=0 [not inserted]
sd0: type=floppy removable=1 locked=0 [not inserted]
(qemu) change ide1-cd0 /home/rharper/work/isos/Fedora-9-i386-DVD.iso
(qemu) info block
ide0-hd0: type=hd removable=0 file=/dev/null ro=0 drv=host_device encrypted=0
ide1-cd0: type=cdrom removable=1 locked=0
file=/home/rharper/work/isos/Fedora-9-i386-DVD.iso ro=0 drv=raw encrypted=0
floppy0: type=floppy removable=1 locked=0 [not inserted]
sd0: type=floppy removable=1 locked=0 [not inserted]
(qemu) change ide1-cd0 /tmp/non_existent_file.iso
(qemu) info block
ide0-hd0: type=hd removable=0 file=/dev/null ro=0 drv=host_device encrypted=0
ide1-cd0: type=cdrom removable=1 locked=0 [not inserted]
floppy0: type=floppy removable=1 locked=0 [not inserted]
sd0: type=floppy removable=1 locked=0 [not inserted]
(qemu)

With patch:
QEMU 0.12.50 monitor - type 'help' for more information
(qemu) change ide1-cd0 /tmp/non_existent_file.iso
Could not open '/tmp/non_existent_file.iso'
(qemu)

Signed-off-by: Ryan Harper <ryanh@us.ibm.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
1 file changed
tree: d6ed4f542a48dd79ebd39b2b78b7999f23ce90da
  1. audio/
  2. block/
  3. bsd-user/
  4. darwin-user/
  5. default-configs/
  6. docs/
  7. fpu/
  8. gdb-xml/
  9. hw/
  10. linux-user/
  11. net/
  12. pc-bios/
  13. QMP/
  14. roms/
  15. slirp/
  16. sysconfigs/
  17. target-alpha/
  18. target-arm/
  19. target-cris/
  20. target-i386/
  21. target-m68k/
  22. target-microblaze/
  23. target-mips/
  24. target-ppc/
  25. target-s390x/
  26. target-sh4/
  27. target-sparc/
  28. tcg/
  29. tests/
  30. .gitignore
  31. .gitmodules
  32. a.out.h
  33. acl.c
  34. acl.h
  35. aes.c
  36. aes.h
  37. aio.c
  38. alpha-dis.c
  39. alpha.ld
  40. arch_init.c
  41. arch_init.h
  42. arm-dis.c
  43. arm-semi.c
  44. arm.ld
  45. async.c
  46. balloon.c
  47. balloon.h
  48. block-migration.c
  49. block-migration.h
  50. block.c
  51. block.h
  52. block_int.h
  53. bswap.h
  54. bt-host.c
  55. bt-host.h
  56. bt-vhci.c
  57. buffered_file.c
  58. buffered_file.h
  59. cache-utils.c
  60. cache-utils.h
  61. Changelog
  62. check-qdict.c
  63. check-qfloat.c
  64. check-qint.c
  65. check-qjson.c
  66. check-qlist.c
  67. check-qstring.c
  68. cmd.c
  69. cmd.h
  70. cocoa.m
  71. CODING_STYLE
  72. config.h
  73. configure
  74. console.c
  75. console.h
  76. COPYING
  77. COPYING.LIB
  78. cpu-all.h
  79. cpu-common.h
  80. cpu-defs.h
  81. cpu-exec.c
  82. cpus.c
  83. cpus.h
  84. create_config
  85. cris-dis.c
  86. curses.c
  87. curses_keys.h
  88. cutils.c
  89. d3des.c
  90. d3des.h
  91. def-helper.h
  92. device_tree.c
  93. device_tree.h
  94. dis-asm.h
  95. disas.c
  96. disas.h
  97. dma-helpers.c
  98. dma.h
  99. dyngen-exec.h
  100. elf.h
  101. envlist.c
  102. envlist.h
  103. exec-all.h
  104. exec.c
  105. feature_to_c.sh
  106. gdbstub.c
  107. gdbstub.h
  108. gen-icount.h
  109. host-utils.c
  110. host-utils.h
  111. hpet.h
  112. hppa-dis.c
  113. hppa.ld
  114. hxtool
  115. i386-dis.c
  116. i386.ld
  117. ia64-dis.c
  118. ia64.ld
  119. input.c
  120. ioport-user.c
  121. ioport.c
  122. ioport.h
  123. json-lexer.c
  124. json-lexer.h
  125. json-parser.c
  126. json-parser.h
  127. json-streamer.c
  128. json-streamer.h
  129. keymaps.c
  130. keymaps.h
  131. kvm-all.c
  132. kvm.h
  133. libfdt_env.h
  134. LICENSE
  135. linux-aio.c
  136. m68k-dis.c
  137. m68k-semi.c
  138. m68k.ld
  139. MAINTAINERS
  140. Makefile
  141. Makefile.dis
  142. Makefile.hw
  143. Makefile.objs
  144. Makefile.target
  145. Makefile.user
  146. microblaze-dis.c
  147. migration-exec.c
  148. migration-fd.c
  149. migration-tcp.c
  150. migration-unix.c
  151. migration.c
  152. migration.h
  153. mips-dis.c
  154. mips.ld
  155. module.c
  156. module.h
  157. monitor.c
  158. monitor.h
  159. nbd.c
  160. nbd.h
  161. net-checksum.c
  162. net.c
  163. net.h
  164. notify.c
  165. notify.h
  166. osdep.c
  167. osdep.h
  168. path.c
  169. pci-ids.txt
  170. poison.h
  171. posix-aio-compat.c
  172. ppc-dis.c
  173. ppc.ld
  174. ppc64.ld
  175. qbool.c
  176. qbool.h
  177. qdict-test-data.txt
  178. qdict.c
  179. qdict.h
  180. qemu-aio.h
  181. qemu-barrier.h
  182. qemu-binfmt-conf.sh
  183. qemu-char.c
  184. qemu-char.h
  185. qemu-common.h
  186. qemu-config.c
  187. qemu-config.h
  188. qemu-doc.texi
  189. qemu-error.c
  190. qemu-error.h
  191. qemu-img-cmds.hx
  192. qemu-img.c
  193. qemu-img.texi
  194. qemu-io.c
  195. qemu-lock.h
  196. qemu-log.h
  197. qemu-malloc.c
  198. qemu-monitor.hx
  199. qemu-nbd.c
  200. qemu-nbd.texi
  201. qemu-objects.h
  202. qemu-option.c
  203. qemu-option.h
  204. qemu-options.hx
  205. qemu-queue.h
  206. qemu-sockets.c
  207. qemu-tech.texi
  208. qemu-thread.c
  209. qemu-thread.h
  210. qemu-timer.c
  211. qemu-timer.h
  212. qemu-tool.c
  213. qemu-x509.h
  214. qemu.sasl
  215. qemu_socket.h
  216. qerror.c
  217. qerror.h
  218. qfloat.c
  219. qfloat.h
  220. qint.c
  221. qint.h
  222. qjson.c
  223. qjson.h
  224. qlist.c
  225. qlist.h
  226. qobject.h
  227. qstring.c
  228. qstring.h
  229. readline.c
  230. readline.h
  231. README
  232. rules.mak
  233. rwhandler.c
  234. rwhandler.h
  235. s390-dis.c
  236. s390.ld
  237. savevm.c
  238. sdl.c
  239. sdl_keysym.h
  240. sdl_zoom.c
  241. sdl_zoom.h
  242. sdl_zoom_template.h
  243. sh4-dis.c
  244. softmmu-semi.h
  245. softmmu_defs.h
  246. softmmu_exec.h
  247. softmmu_header.h
  248. softmmu_template.h
  249. sparc-dis.c
  250. sparc.ld
  251. sparc64.ld
  252. sysemu.h
  253. targphys.h
  254. tcg-runtime.c
  255. texi2pod.pl
  256. thunk.c
  257. thunk.h
  258. TODO
  259. translate-all.c
  260. uboot_image.h
  261. usb-bsd.c
  262. usb-linux.c
  263. usb-stub.c
  264. VERSION
  265. vgafont.h
  266. vl.c
  267. vnc-auth-sasl.c
  268. vnc-auth-sasl.h
  269. vnc-auth-vencrypt.c
  270. vnc-auth-vencrypt.h
  271. vnc-tls.c
  272. vnc-tls.h
  273. vnc.c
  274. vnc.h
  275. vnc_keysym.h
  276. vnchextile.h
  277. x86_64.ld
  278. x_keymap.c
  279. x_keymap.h