migration (outgoing): add error propagation for all protocols

Error propagation is already there for socket backends.  Add it to other
protocols, simplifying code that tests for errors that will never happen.
With all protocols understanding Error, the code can be simplified
further by removing the return value.

Unfortunately, the quality of error messages varies depending
on where the error is detected, because no Error is passed to the
NonBlockingConnectHandler.  Thus, the exact error message still cannot
be sent to the user if the OS reports it asynchronously via SO_ERROR.
If NonBlockingConnectHandler received an Error**, we could for
example report the error class and/or message via a new field of the
query-migration command even if it is reported asynchronously.

Before:

    (qemu) migrate fd:ffff
    migrate: An undefined error has occurred
    (qemu) info migrate
    (qemu)

After:

    (qemu) migrate fd:ffff
    migrate: File descriptor named 'ffff' has not been found
    (qemu) info migrate
    capabilities: xbzrle: off
    Migration status: failed
    total time: 0 milliseconds

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
6 files changed
tree: 19e1c5119272e95f86a51180997532ec37ba3ab8
  1. audio/
  2. block/
  3. bsd-user/
  4. default-configs/
  5. docs/
  6. fpu/
  7. fsdev/
  8. gdb-xml/
  9. hw/
  10. include/
  11. libcacard/
  12. linux-headers/
  13. linux-user/
  14. net/
  15. pc-bios/
  16. qapi/
  17. qga/
  18. QMP/
  19. qom/
  20. roms/
  21. scripts/
  22. slirp/
  23. sysconfigs/
  24. target-alpha/
  25. target-arm/
  26. target-cris/
  27. target-i386/
  28. target-lm32/
  29. target-m68k/
  30. target-microblaze/
  31. target-mips/
  32. target-openrisc/
  33. target-ppc/
  34. target-s390x/
  35. target-sh4/
  36. target-sparc/
  37. target-unicore32/
  38. target-xtensa/
  39. tcg/
  40. tests/
  41. trace/
  42. ui/
  43. .exrc
  44. .gitignore
  45. .gitmodules
  46. .mailmap
  47. a.out.h
  48. acl.c
  49. acl.h
  50. aes.c
  51. aes.h
  52. aio.c
  53. alpha-dis.c
  54. alpha.ld
  55. arch_init.c
  56. arch_init.h
  57. arm-dis.c
  58. arm.ld
  59. async.c
  60. balloon.c
  61. balloon.h
  62. bitmap.c
  63. bitmap.h
  64. bitops.c
  65. bitops.h
  66. block-migration.c
  67. block-migration.h
  68. block.c
  69. block.h
  70. block_int.h
  71. blockdev.c
  72. blockdev.h
  73. blockjob.c
  74. blockjob.h
  75. bswap.h
  76. bt-host.c
  77. bt-host.h
  78. bt-vhci.c
  79. buffered_file.c
  80. buffered_file.h
  81. cache-utils.c
  82. cache-utils.h
  83. Changelog
  84. cmd.c
  85. cmd.h
  86. CODING_STYLE
  87. compatfd.c
  88. compatfd.h
  89. compiler.h
  90. config.h
  91. configure
  92. console.c
  93. console.h
  94. COPYING
  95. COPYING.LIB
  96. coroutine-gthread.c
  97. coroutine-sigaltstack.c
  98. coroutine-ucontext.c
  99. coroutine-win32.c
  100. cpu-all.h
  101. cpu-common.h
  102. cpu-defs.h
  103. cpu-exec.c
  104. cpus.c
  105. cpus.h
  106. cputlb.c
  107. cputlb.h
  108. cris-dis.c
  109. cursor.c
  110. cursor_hidden.xpm
  111. cursor_left_ptr.xpm
  112. cutils.c
  113. def-helper.h
  114. device_tree.c
  115. device_tree.h
  116. dis-asm.h
  117. disas.c
  118. disas.h
  119. dma-helpers.c
  120. dma.h
  121. dump-stub.c
  122. dump.c
  123. dump.h
  124. elf.h
  125. envlist.c
  126. envlist.h
  127. error.c
  128. error.h
  129. event_notifier.c
  130. event_notifier.h
  131. exec-all.h
  132. exec-memory.h
  133. exec.c
  134. gdbstub.c
  135. gdbstub.h
  136. gen-icount.h
  137. HACKING
  138. hmp-commands.hx
  139. hmp.c
  140. hmp.h
  141. host-utils.c
  142. host-utils.h
  143. hppa-dis.c
  144. hppa.ld
  145. i386-dis.c
  146. i386.ld
  147. ia64-dis.c
  148. ia64.ld
  149. input.c
  150. int128.h
  151. iohandler.c
  152. ioport.c
  153. ioport.h
  154. iorange.h
  155. iov.c
  156. iov.h
  157. json-lexer.c
  158. json-lexer.h
  159. json-parser.c
  160. json-parser.h
  161. json-streamer.c
  162. json-streamer.h
  163. kvm-all.c
  164. kvm-stub.c
  165. kvm.h
  166. libfdt_env.h
  167. LICENSE
  168. linux-aio.c
  169. lm32-dis.c
  170. m68k-dis.c
  171. m68k.ld
  172. main-loop.c
  173. main-loop.h
  174. MAINTAINERS
  175. Makefile
  176. Makefile.dis
  177. Makefile.objs
  178. Makefile.target
  179. Makefile.user
  180. memory-internal.h
  181. memory.c
  182. memory.h
  183. memory_mapping-stub.c
  184. memory_mapping.c
  185. memory_mapping.h
  186. microblaze-dis.c
  187. migration-exec.c
  188. migration-fd.c
  189. migration-tcp.c
  190. migration-unix.c
  191. migration.c
  192. migration.h
  193. mips-dis.c
  194. mips.ld
  195. module.c
  196. module.h
  197. monitor.c
  198. monitor.h
  199. nbd.c
  200. nbd.h
  201. net.c
  202. net.h
  203. notify.c
  204. notify.h
  205. os-posix.c
  206. os-win32.c
  207. osdep.c
  208. osdep.h
  209. oslib-posix.c
  210. oslib-win32.c
  211. page_cache.c
  212. path.c
  213. pci-ids.txt
  214. pflib.c
  215. pflib.h
  216. poison.h
  217. posix-aio-compat.c
  218. ppc-dis.c
  219. ppc.ld
  220. ppc64.ld
  221. qapi-schema-guest.json
  222. qapi-schema-test.json
  223. qapi-schema.json
  224. qbool.c
  225. qbool.h
  226. qdict-test-data.txt
  227. qdict.c
  228. qdict.h
  229. qemu-aio.h
  230. qemu-barrier.h
  231. qemu-bridge-helper.c
  232. qemu-char.c
  233. qemu-char.h
  234. qemu-common.h
  235. qemu-config.c
  236. qemu-config.h
  237. qemu-coroutine-int.h
  238. qemu-coroutine-io.c
  239. qemu-coroutine-lock.c
  240. qemu-coroutine-sleep.c
  241. qemu-coroutine.c
  242. qemu-coroutine.h
  243. qemu-doc.texi
  244. qemu-error.c
  245. qemu-error.h
  246. qemu-file.h
  247. qemu-ga.c
  248. qemu-img-cmds.hx
  249. qemu-img.c
  250. qemu-img.texi
  251. qemu-io.c
  252. qemu-lock.h
  253. qemu-log.c
  254. qemu-log.h
  255. qemu-nbd.c
  256. qemu-nbd.texi
  257. qemu-objects.h
  258. qemu-option-internal.h
  259. qemu-option.c
  260. qemu-option.h
  261. qemu-options-wrapper.h
  262. qemu-options.h
  263. qemu-options.hx
  264. qemu-os-posix.h
  265. qemu-os-win32.h
  266. qemu-progress.c
  267. qemu-queue.h
  268. qemu-seccomp.c
  269. qemu-seccomp.h
  270. qemu-sockets.c
  271. qemu-tech.texi
  272. qemu-thread-posix.c
  273. qemu-thread-posix.h
  274. qemu-thread-win32.c
  275. qemu-thread-win32.h
  276. qemu-thread.h
  277. qemu-timer-common.c
  278. qemu-timer.c
  279. qemu-timer.h
  280. qemu-tls.h
  281. qemu-tool.c
  282. qemu-user.c
  283. qemu-x509.h
  284. qemu-xattr.h
  285. qemu.sasl
  286. qemu_socket.h
  287. qerror.c
  288. qerror.h
  289. qfloat.c
  290. qfloat.h
  291. qint.c
  292. qint.h
  293. qjson.c
  294. qjson.h
  295. qlist.c
  296. qlist.h
  297. qmp-commands.hx
  298. qmp.c
  299. qobject.h
  300. qstring.c
  301. qstring.h
  302. qtest.c
  303. qtest.h
  304. range.h
  305. readline.c
  306. readline.h
  307. README
  308. rules.mak
  309. s390-dis.c
  310. s390.ld
  311. savevm.c
  312. sh4-dis.c
  313. softmmu-semi.h
  314. softmmu_defs.h
  315. softmmu_exec.h
  316. softmmu_header.h
  317. softmmu_template.h
  318. sparc-dis.c
  319. sparc.ld
  320. sparc64.ld
  321. spice-qemu-char.c
  322. sysemu.h
  323. targphys.h
  324. tcg-runtime.c
  325. tci-dis.c
  326. tci.c
  327. thunk.c
  328. thunk.h
  329. TODO
  330. trace-events
  331. translate-all.c
  332. uboot_image.h
  333. uri.c
  334. uri.h
  335. user-exec.c
  336. VERSION
  337. version.rc
  338. vgafont.h
  339. vl.c
  340. vmstate.h
  341. x86_64.ld
  342. xen-all.c
  343. xen-mapcache.c
  344. xen-mapcache.h
  345. xen-stub.c