-
Notifications
You must be signed in to change notification settings - Fork 4
/
libvirt-6.3.0.patch
419 lines (395 loc) · 27.5 KB
/
libvirt-6.3.0.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
From 4c6e876c92bf2e6d8098f95be1e2b061433740d4 Mon Sep 17 00:00:00 2001
From: Dongli Zhang <[email protected]>
Date: Sun, 14 Feb 2021 18:24:28 -0800
Subject: [PATCH 1/1] libvirt-6.3.0
Signed-off-by: Dongli Zhang <[email protected]>
---
src/qemu/qemu_command.c | 5 ++
src/qemu/qemu_hotplug.c | 34 ++++++++++++
src/qemu/qemu_monitor.c | 105 +++++++++++++++++++++++++++++++++++
src/qemu/qemu_monitor_json.c | 50 ++++++++++++++++-
src/rpc/virnetclient.c | 4 ++
src/rpc/virnetserverclient.c | 4 ++
src/rpc/virnetsocket.c | 5 ++
src/util/virfile.c | 19 +++++++
src/util/virsocket.c | 5 ++
9 files changed, 230 insertions(+), 1 deletion(-)
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 6acfc0b..9d5ba90 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -4877,6 +4877,11 @@ qemuBuildSCSIiSCSIHostdevDrvStr(virDomainHostdevDefPtr dev,
return virBufferContentAndReset(&buf);
}
+/*
+ * called by:
+ * - src/qemu/qemu_command.c|5462| <<qemuBuildHostdevCommandLine>> if (!(devstr = qemuBuildSCSIVHostHostdevDevStr(def,
+ * - src/qemu/qemu_hotplug.c|2773| <<qemuDomainAttachSCSIVHostDevice>> if (!(devstr = qemuBuildSCSIVHostHostdevDevStr(vm->def,
+ */
char *
qemuBuildSCSIVHostHostdevDevStr(const virDomainDef *def,
virDomainHostdevDefPtr dev,
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index 60d0729..0523a95 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -2681,6 +2681,37 @@ qemuDomainAttachHostSCSIDevice(virQEMUDriverPtr driver,
goto cleanup;
}
+/*
+ * (gdb) bt
+ * #0 qemuMonitorJSONSendFileHandle (mon=mon@entry=0x7fa67c00aa90, fdname=fdname@entry=0x7fa680001f50 "vhostfd-31", fd=fd@entry=31) at qemu/qemu_monitor_json.c:3805
+ * #1 0x00007fa69662d2c3 in qemuMonitorSendFileHandle (mon=mon@entry=0x7fa67c00aa90, fdname=fdname@entry=0x7fa680001f50 "vhostfd-31", fd=fd@entry=31) at qemu/qemu_monitor.c:2764
+ * #2 0x00007fa69662e3bf in qemuMonitorAddDeviceWithFd (mon=0x7fa67c00aa90, devicestr=0x7fa6800021d0 "vhost-scsi-pci,wwpn=naa.5001405324af0985,vhostfd=vhostfd-31,id=hostdev0,bus=pci.4,addr=0x0", fd=31,
+ * fdname=0x7fa680001f50 "vhostfd-31") at qemu/qemu_monitor.c:3005
+ * #3 0x00007fa6965f65a1 in qemuDomainAttachSCSIVHostDevice (hostdev=0x7fa680002f90, vm=0x7fa67c01e2c0, driver=0x7fa68c0f0110) at qemu/qemu_hotplug.c:2713
+ * #4 qemuDomainAttachHostDevice (driver=driver@entry=0x7fa68c0f0110, vm=vm@entry=0x7fa67c01e2c0, hostdev=<optimized out>) at qemu/qemu_hotplug.c:2873
+ * #5 0x00007fa696676e0f in qemuDomainAttachDeviceLive (driver=0x7fa68c0f0110, dev=0x7fa680002ec0, vm=0x7fa67c01e2c0) at qemu/qemu_driver.c:8975
+ * #6 qemuDomainAttachDeviceLiveAndConfig (flags=<optimized out>, xml=<optimized out>, driver=0x7fa68c0f0110, vm=0x7fa67c01e2c0) at qemu/qemu_driver.c:9836
+ * #7 qemuDomainAttachDeviceFlags (dom=<optimized out>, xml=<optimized out>, flags=1) at qemu/qemu_driver.c:9890
+ * #8 0x00007fa6c2a4f736 in virDomainAttachDevice (domain=domain@entry=0x7fa6800171d0,
+ * xml=0x7fa6800028e0 "<hostdev mode='subsystem' type='scsi_host'>\n <source protocol='vhost' wwpn='naa.5001405324af0985'/>\n</hostdev>\n") at libvirt-domain.c:8255
+ * #9 0x000055f075038d2f in remoteDispatchDomainAttachDevice (server=0x55f0771ee340, msg=0x55f0771ee260, args=0x7fa680002ac0, rerr=0x7fa6b180bc10, client=<optimized out>)
+ * at remote/remote_daemon_dispatch_stubs.h:3717
+ * #10 remoteDispatchDomainAttachDeviceHelper (server=0x55f0771ee340, client=<optimized out>, msg=0x55f0771ee260, rerr=0x7fa6b180bc10, args=0x7fa680002ac0, ret=0x7fa6800172d0)
+ * at remote/remote_daemon_dispatch_stubs.h:3696
+ * #11 0x00007fa6c296d225 in virNetServerProgramDispatchCall (msg=0x55f0771ee260, client=0x55f07720f950, server=0x55f0771ee340, prog=0x55f07720d1f0) at rpc/virnetserverprogram.c:435
+ * #12 virNetServerProgramDispatch (prog=0x55f07720d1f0, server=server@entry=0x55f0771ee340, client=0x55f07720f950, msg=0x55f0771ee260) at rpc/virnetserverprogram.c:302
+ * #13 0x00007fa6c297267d in virNetServerProcessMsg (msg=<optimized out>, prog=<optimized out>, client=<optimized out>, srv=0x55f0771ee340) at rpc/virnetserver.c:137
+ * #14 virNetServerHandleJob (jobOpaque=<optimized out>, opaque=0x55f0771ee340) at rpc/virnetserver.c:158
+ * #15 0x00007fa6c288fec1 in virThreadPoolWorker (opaque=opaque@entry=0x55f0771e19f0) at util/virthreadpool.c:163
+ * #16 0x00007fa6c288f248 in virThreadHelper (data=<optimized out>) at util/virthread.c:206
+ * #17 0x00007fa6bfe68ea5 in start_thread () from /lib64/libpthread.so.0
+ * #18 0x00007fa6bfb918cd in clone () from /lib64/libc.so.6
+ *
+ * "vhost-scsi-pci,wwpn=naa.5001405324af0985,vhostfd=vhostfd-31,id=hostdev0,bus=pci.4,addr=0x0"
+ *
+ * called by:
+ * - src/qemu/qemu_hotplug.c|2928| <<qemuDomainAttachHostDevice>> if (qemuDomainAttachSCSIVHostDevice(driver, vm, hostdev) < 0)
+ */
static int
qemuDomainAttachSCSIVHostDevice(virQEMUDriverPtr driver,
virDomainObjPtr vm,
@@ -2755,6 +2786,9 @@ qemuDomainAttachSCSIVHostDevice(virQEMUDriverPtr driver,
if ((ret = qemuDomainAttachExtensionDevice(priv->mon, hostdev->info)) < 0)
goto exit_monitor;
+ /*
+ * 这里进去调用的getfd!!
+ */
if ((ret = qemuMonitorAddDeviceWithFd(priv->mon, devstr, vhostfd,
vhostfdName)) < 0) {
ignore_value(qemuDomainDetachExtensionDevice(priv->mon, hostdev->info));
diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c
index a62fed8..7c0025f 100644
--- a/src/qemu/qemu_monitor.c
+++ b/src/qemu/qemu_monitor.c
@@ -363,6 +363,10 @@ qemuMonitorIOProcess(qemuMonitorPtr mon)
/* Call this function while holding the monitor lock. */
+/*
+ * called by:
+ * - src/qemu/qemu_monitor.c|427| <<qemuMonitorIOWrite>> done = qemuMonitorIOWriteWithFD(mon, buf, len, mon->msg->txFD);
+ */
static int
qemuMonitorIOWriteWithFD(qemuMonitorPtr mon,
const char *data,
@@ -408,6 +412,19 @@ qemuMonitorIOWriteWithFD(qemuMonitorPtr mon,
* Called when the monitor is able to write data
* Call this function while holding the monitor lock.
*/
+/*
+ * (gdb) bt
+ * #0 qemuMonitorIOWrite (mon=0x7fa4980170d0) at qemu/qemu_monitor.c:528
+ * #1 qemuMonitorIO (watch=watch@entry=53, fd=35, events=events@entry=2, opaque=opaque@entry=0x7fa4980170d0) at qemu/qemu_monitor.c:681
+ * #2 0x00007fa4d6478a1c in virEventPollDispatchHandles (fds=<optimized out>, nfds=11) at util/vireventpoll.c:503
+ * #3 virEventPollRunOnce () at util/vireventpoll.c:658
+ * #4 0x00007fa4d6476fb2 in virEventRunDefaultImpl () at util/virevent.c:322
+ * #5 0x00007fa4d65c0ebd in virNetDaemonRun (dmn=0x5642a6dc90c0) at rpc/virnetdaemon.c:836
+ * #6 0x00005642a5acc0e4 in main (argc=<optimized out>, argv=<optimized out>) at remote/remote_daemon.c:1427
+ *
+ * called by:
+ * - src/qemu/qemu_monitor.c|548| <<qemuMonitorIO>> if (qemuMonitorIOWrite(mon) < 0) {
+ */
static int
qemuMonitorIOWrite(qemuMonitorPtr mon)
{
@@ -421,11 +438,20 @@ qemuMonitorIOWrite(qemuMonitorPtr mon)
buf = mon->msg->txBuffer + mon->msg->txOffset;
len = mon->msg->txLength - mon->msg->txOffset;
+
+ /*
+ * buf = "{\"execute\":\"getfd\",\"arguments\":{\"fdname\":\"vhostfd-31\"},\"id\":\"libvirt-23\"}\r\n"
+ */
+
if (mon->msg->txFD == -1)
done = write(mon->fd, buf, len);
else
done = qemuMonitorIOWriteWithFD(mon, buf, len, mon->msg->txFD);
+ /*
+ * buf = "{\"execute\":\"getfd\",\"arguments\":{\"fdname\":\"vhostfd-31\"},\"id\":\"libvirt-23\"}\r\n"
+ * len = 75
+ */
PROBE(QEMU_MONITOR_IO_WRITE,
"mon=%p buf=%s len=%zu ret=%d errno=%d",
mon, buf, len, done, done < 0 ? errno : 0);
@@ -516,6 +542,10 @@ qemuMonitorUpdateWatch(qemuMonitorPtr mon)
}
+/*
+ * called by:
+ * - src/qemu/qemu_monitor.c|828| <<qemuMonitorRegister>> (GSourceFunc)qemuMonitorIO,
+ */
static gboolean
qemuMonitorIO(GSocket *socket G_GNUC_UNUSED,
GIOCondition cond,
@@ -913,6 +943,64 @@ qemuMonitorResetCommandID(qemuMonitorPtr mon)
}
+/*
+ * (gdb) bt
+ * #0 qemuMonitorSend (mon=mon@entry=0x7fa498017be0, msg=msg@entry=0x7fa4c645c4c0) at qemu/qemu_monitor.c:1056
+ * #1 0x00007fa4aa2877c8 in qemuMonitorJSONCommandWithFd (mon=0x7fa498017be0, cmd=cmd@entry=0x7fa4980174b0, scm_fd=scm_fd@entry=-1, reply=reply@entry=0x7fa4c645c550) at qemu/qemu_monitor_json.c:334
+ * #2 0x00007fa4aa2897ef in qemuMonitorJSONCommand (reply=0x7fa4c645c550, cmd=0x7fa4980174b0, mon=<optimized out>) at qemu/qemu_monitor_json.c:359
+ * #3 qemuMonitorJSONSetCapabilities (mon=<optimized out>) at qemu/qemu_monitor_json.c:1613
+ * #4 0x00007fa4aa2792c3 in qemuMonitorSetCapabilities (mon=<optimized out>) at qemu/qemu_monitor.c:1702
+ * #5 0x00007fa4aa256023 in qemuProcessInitMonitor (asyncJob=QEMU_ASYNC_JOB_START, vm=0x7fa4981031a0, driver=0x7fa4a00f2700) at qemu/qemu_process.c:1931
+ * #6 qemuConnectMonitor (driver=0x7fa4a00f2700, vm=0x7fa4981031a0, asyncJob=6, retry=<optimized out>, logCtxt=0x7fa498019e80) at qemu/qemu_process.c:2006
+ * #7 0x00007fa4aa25d30c in qemuProcessLaunch (conn=conn@entry=0x7fa47c000b00, driver=driver@entry=0x7fa4a00f2700, vm=vm@entry=0x7fa4981031a0, asyncJob=asyncJob@entry=QEMU_ASYNC_JOB_START,
+ * incoming=incoming@entry=0x0, snapshot=snapshot@entry=0x0, vmop=vmop@entry=VIR_NETDEV_VPORT_PROFILE_OP_CREATE, flags=flags@entry=17) at qemu/qemu_process.c:2416
+ * #8 0x00007fa4aa2617d2 in qemuProcessStart (conn=conn@entry=0x7fa47c000b00, driver=driver@entry=0x7fa4a00f2700, vm=0x7fa4981031a0, updatedCPU=updatedCPU@entry=0x0,
+ * asyncJob=asyncJob@entry=QEMU_ASYNC_JOB_START, migrateFrom=migrateFrom@entry=0x0, migrateFd=migrateFd@entry=-1, migratePath=migratePath@entry=0x0, snapshot=snapshot@entry=0x0,
+ * vmop=vmop@entry=VIR_NETDEV_VPORT_PROFILE_OP_CREATE, flags=17, flags@entry=1) at qemu/qemu_process.c:7555
+ * #9 0x00007fa4aa2b474b in qemuDomainCreateXML (conn=0x7fa47c000b00,
+ * xml=0x7fa49801fa40 "<!--\nWARNING: THIS IS AN AUTO-G\n"..., flags=0) at qemu/qemu_driver.c:2757
+ * #10 0x00007fa4d6685b24 in virDomainCreateXML (conn=0x7fa47c000b00, xmlDesc=0x7fa49801fa40 "<!--\nWARNING: TH\n"..., flags=0) at libvirt-domain.c:250
+ * #11 0x00005642a5af6ac9 in remoteDispatchDomainCreateXML (server=0x5642a6dc9340, msg=0x5642a6dea740, ret=0x7fa4980f5e90, args=0x7fa4980fc3b0, rerr=0x7fa4c645cc10, client=0x5642a6dea9a0)
+ * at remote/remote_daemon_dispatch_stubs.h:4979
+ * #12 remoteDispatchDomainCreateXMLHelper (server=0x5642a6dc9340, client=0x5642a6dea9a0, msg=0x5642a6dea740, rerr=0x7fa4c645cc10, args=0x7fa4980fc3b0, ret=0x7fa4980f5e90)
+ * at remote/remote_daemon_dispatch_stubs.h:4960
+ * #13 0x00007fa4d65bc225 in virNetServerProgramDispatchCall (msg=0x5642a6dea740, client=0x5642a6dea9a0, server=0x5642a6dc9340, prog=0x5642a6de81f0) at rpc/virnetserverprogram.c:435
+ * #14 virNetServerProgramDispatch (prog=0x5642a6de81f0, server=server@entry=0x5642a6dc9340, client=0x5642a6dea9a0, msg=0x5642a6dea740) at rpc/virnetserverprogram.c:302
+ * #15 0x00007fa4d65c167d in virNetServerProcessMsg (msg=<optimized out>, prog=<optimized out>, client=<optimized out>, srv=0x5642a6dc9340) at rpc/virnetserver.c:137
+ * #16 virNetServerHandleJob (jobOpaque=<optimized out>, opaque=0x5642a6dc9340) at rpc/virnetserver.c:158
+ * #17 0x00007fa4d64deec1 in virThreadPoolWorker (opaque=opaque@entry=0x5642a6dbcab0) at util/virthreadpool.c:163
+ * #18 0x00007fa4d64de248 in virThreadHelper (data=<optimized out>) at util/virthread.c:206
+ * #19 0x00007fa4d3ab7ea5 in start_thread () from /lib64/libpthread.so.0
+ * #20 0x00007fa4d37e08cd in clone () from /lib64/libc.so.6
+ *
+ * (gdb) bt
+ * #0 qemuMonitorSend (mon=mon@entry=0x7fa498017be0, msg=msg@entry=0x7fa4c5c5b740) at qemu/qemu_monitor.c:1056
+ * #1 0x00007fa4aa2877c8 in qemuMonitorJSONCommandWithFd (mon=mon@entry=0x7fa498017be0, cmd=cmd@entry=0x7fa490010e80, scm_fd=scm_fd@entry=31, reply=reply@entry=0x7fa4c5c5b7d0)
+ * at qemu/qemu_monitor_json.c:334
+ * #2 0x00007fa4aa28cf8c in qemuMonitorJSONSendFileHandle (mon=mon@entry=0x7fa498017be0, fdname=fdname@entry=0x7fa490016260 "vhostfd-31", fd=fd@entry=31) at qemu/qemu_monitor_json.c:3814
+ * #3 0x00007fa4aa27c2c3 in qemuMonitorSendFileHandle (mon=mon@entry=0x7fa498017be0, fdname=fdname@entry=0x7fa490016260 "vhostfd-31", fd=fd@entry=31) at qemu/qemu_monitor.c:2764
+ * #4 0x00007fa4aa27d3bf in qemuMonitorAddDeviceWithFd (mon=0x7fa498017be0, devicestr=0x7fa4900232d0 "vhost-scsi-pci,wwpn=naa.5001405324af0985,vhostfd=vhostfd-31,id=hostdev0,bus=pci.4,addr=0x0", fd=31,
+ * fdname=0x7fa490016260 "vhostfd-31") at qemu/qemu_monitor.c:3005
+ * #5 0x00007fa4aa2455a1 in qemuDomainAttachSCSIVHostDevice (hostdev=0x7fa490011060, vm=0x7fa4981031a0, driver=0x7fa4a00f2700) at qemu/qemu_hotplug.c:2713
+ * #6 qemuDomainAttachHostDevice (driver=driver@entry=0x7fa4a00f2700, vm=vm@entry=0x7fa4981031a0, hostdev=<optimized out>) at qemu/qemu_hotplug.c:2873
+ * #7 0x00007fa4aa2c5e0f in qemuDomainAttachDeviceLive (driver=0x7fa4a00f2700, dev=0x7fa490012b90, vm=0x7fa4981031a0) at qemu/qemu_driver.c:8975
+ * #8 qemuDomainAttachDeviceLiveAndConfig (flags=<optimized out>, xml=<optimized out>, driver=0x7fa4a00f2700, vm=0x7fa4981031a0) at qemu/qemu_driver.c:9836
+ * #9 qemuDomainAttachDeviceFlags (dom=<optimized out>, xml=<optimized out>, flags=1) at qemu/qemu_driver.c:9890
+ * #10 0x00007fa4d669e736 in virDomainAttachDevice (domain=domain@entry=0x7fa490010ec0,
+ * xml=0x7fa49001de90 "<hostdev mode='subsystem' type='scsi_host'>\n <source protocol='vhost' wwpn='naa.5001405324af0985'/>\n</hostdev>\n") at libvirt-domain.c:8255
+ * #11 0x00005642a5af6d2f in remoteDispatchDomainAttachDevice (server=0x5642a6dc9340, msg=0x5642a6deb0b0, args=0x7fa49001e050, rerr=0x7fa4c5c5bc10, client=<optimized out>)
+ * at remote/remote_daemon_dispatch_stubs.h:3717
+ * #12 remoteDispatchDomainAttachDeviceHelper (server=0x5642a6dc9340, client=<optimized out>, msg=0x5642a6deb0b0, rerr=0x7fa4c5c5bc10, args=0x7fa49001e050, ret=0x7fa490002bd0)
+ * at remote/remote_daemon_dispatch_stubs.h:3696
+ * #13 0x00007fa4d65bc225 in virNetServerProgramDispatchCall (msg=0x5642a6deb0b0, client=0x5642a6dc91b0, server=0x5642a6dc9340, prog=0x5642a6de81f0) at rpc/virnetserverprogram.c:435
+ * #14 virNetServerProgramDispatch (prog=0x5642a6de81f0, server=server@entry=0x5642a6dc9340, client=0x5642a6dc91b0, msg=0x5642a6deb0b0) at rpc/virnetserverprogram.c:302
+ * #15 0x00007fa4d65c167d in virNetServerProcessMsg (msg=<optimized out>, prog=<optimized out>, client=<optimized out>, srv=0x5642a6dc9340) at rpc/virnetserver.c:137
+ * #16 virNetServerHandleJob (jobOpaque=<optimized out>, opaque=0x5642a6dc9340) at rpc/virnetserver.c:158
+ * #17 0x00007fa4d64deec1 in virThreadPoolWorker (opaque=opaque@entry=0x5642a6dbc9f0) at util/virthreadpool.c:163
+ * #18 0x00007fa4d64de248 in virThreadHelper (data=<optimized out>) at util/virthread.c:206
+ * #19 0x00007fa4d3ab7ea5 in start_thread () from /lib64/libpthread.so.0
+ * #20 0x00007fa4d37e08cd in clone () from /lib64/libc.so.6
+ */
int
qemuMonitorSend(qemuMonitorPtr mon,
qemuMonitorMessagePtr msg)
@@ -2625,6 +2713,17 @@ qemuMonitorGraphicsRelocate(qemuMonitorPtr mon,
}
+/*
+ * called by:
+ * - src/qemu/qemu_monitor.c|2509| <<qemuMonitorMigrateToFd>> if (qemuMonitorSendFileHandle(mon, "migrate", fd) < 0)
+ * - src/qemu/qemu_monitor.c|2592| <<qemuMonitorDumpToFd>> if (qemuMonitorSendFileHandle(mon, "dump", fd) < 0)
+ * - src/qemu/qemu_monitor.c|2687| <<qemuMonitorAddNetdev>> if (qemuMonitorSendFileHandle(mon, tapfdName[i], tapfd[i]) < 0)
+ * - src/qemu/qemu_monitor.c|2691| <<qemuMonitorAddNetdev>> if (qemuMonitorSendFileHandle(mon, vhostfdName[j], vhostfd[j]) < 0)
+ * - src/qemu/qemu_monitor.c|2696| <<qemuMonitorAddNetdev>> qemuMonitorSendFileHandle(mon, slirpfdName, slirpfd) < 0)
+ * - src/qemu/qemu_monitor.c|2835| <<qemuMonitorAddDeviceWithFd>> if (fd >= 0 && qemuMonitorSendFileHandle(mon, fdname, fd) < 0)
+ * - src/qemu/qemu_monitor.c|3456| <<qemuMonitorOpenGraphics>> if (qemuMonitorSendFileHandle(mon, fdname, fd) < 0)
+ * - src/qemu/qemu_monitor.h|873| <<qemuMonitorBlockStatsUpdateCapacityBlockdev>> int qemuMonitorSendFileHandle(qemuMonitorPtr mon,
+ */
int
qemuMonitorSendFileHandle(qemuMonitorPtr mon,
const char *fdname,
@@ -2821,6 +2920,12 @@ qemuMonitorDelDevice(qemuMonitorPtr mon,
}
+/*
+ * called by:
+ * - src/qemu/qemu_hotplug.c|2758| <<qemuDomainAttachSCSIVHostDevice>> if ((ret = qemuMonitorAddDeviceWithFd(priv->mon, devstr, vhostfd,
+ * - src/qemu/qemu_hotplug.c|3276| <<qemuDomainAttachVsockDevice>> if (qemuMonitorAddDeviceWithFd(priv->mon, devstr, vsockPriv->vhostfd, fdname) < 0) {
+ * - src/qemu/qemu_monitor.c|2853| <<qemuMonitorAddDevice>> return qemuMonitorAddDeviceWithFd(mon, devicestr, -1, NULL);
+ */
int
qemuMonitorAddDeviceWithFd(qemuMonitorPtr mon,
const char *devicestr,
diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
index 619717e..6fa7ba4 100644
--- a/src/qemu/qemu_monitor_json.c
+++ b/src/qemu/qemu_monitor_json.c
@@ -1632,6 +1632,26 @@ qemuMonitorJSONSetCapabilities(qemuMonitorPtr mon)
}
+/*
+ * (gdb) bt
+ * #0 qemuMonitorJSONStartCPUs (mon=0x7fe9dc012930) at qemu/qemu_monitor_json.c:1629
+ * #1 0x00007fe9f2f72ba3 in qemuMonitorStartCPUs (mon=<optimized out>) at qemu/qemu_monitor.c:1711
+ * #2 0x00007fe9f2f512d1 in qemuProcessStartCPUs (driver=driver@entry=0x7fe9e811d9e0, vm=vm@entry=0x7fe9dc01ca00, reason=reason@entry=VIR_DOMAIN_RUNNING_BOOTED, asyncJob=asyncJob@entry=Q
+ * #3 0x00007fe9f2f53f45 in qemuProcessFinishStartup (driver=driver@entry=0x7fe9e811d9e0, vm=vm@entry=0x7fe9dc01ca00, asyncJob=asyncJob@entry=QEMU_ASYNC_JOB_STAR
+ * #4 0x00007fe9f2f59fe0 in qemuProcessStart (conn=conn@entry=0x7fe9dc01c1c0, driver=driver@entry=0x7fe9e811d9e0, vm=0x7fe9dc01ca00, updatedCPU=updatedCPU@entry=0x0,
+ * #5 0x00007fe9f2fadf8b in qemuDomainCreateXML (conn=0x7fe9dc01c1c0,
+ * #6 0x00007fea1f37fb94 in virDomainCreateXML (conn=0x7fe9dc01c1c0,
+ * #7 0x00005605a92d3ac9 in remoteDispatchDomainCreateXML (server=0x5605aadd7340, msg=0x5605aadf7990, ret=0x7fe9dc000960, args=0x7fe9dc0008e0, rerr=0x7fea0e154c10, client=0x5605aadf8c50)
+ * #8 remoteDispatchDomainCreateXMLHelper (server=0x5605aadd7340, client=0x5605aadf8c50, msg=0x5605aadf7990, rerr=0x7fea0e154c10, args=0x7fe9dc0008e0, ret=0x7fe9dc000960)
+ * #9 0x00007fea1f2b6295 in virNetServerProgramDispatchCall (msg=0x5605aadf7990, client=0x5605aadf8c50, server=0x5605aadd7340, prog=0x5605aadf61f0) at rpc/virnetserverprogram.c:435
+ * #10 virNetServerProgramDispatch (prog=0x5605aadf61f0, server=server@entry=0x5605aadd7340, client=0x5605aadf8c50, msg=0x5605aadf7990) at rpc/virnetserverprogram.c:302
+ * #11 0x00007fea1f2bb6ed in virNetServerProcessMsg (msg=<optimized out>, prog=<optimized out>, client=<optimized out>, srv=0x5605aadd7340) at rpc/virnetserver.c:137
+ * #12 virNetServerHandleJob (jobOpaque=<optimized out>, opaque=0x5605aadd7340) at rpc/virnetserver.c:158
+ * #13 0x00007fea1f1d8dc1 in virThreadPoolWorker (opaque=opaque@entry=0x5605aadca930) at util/virthreadpool.c:163
+ * #14 0x00007fea1f1d8148 in virThreadHelper (data=<optimized out>) at util/virthread.c:206
+ * #15 0x00007fea1c7b1ea5 in start_thread () from /lib64/libpthread.so.0
+ * #16 0x00007fea1c4da8cd in clone () from /lib64/libc.so.6
+ */
int
qemuMonitorJSONStartCPUs(qemuMonitorPtr mon)
{
@@ -3939,7 +3959,35 @@ int qemuMonitorJSONGraphicsRelocate(qemuMonitorPtr mon,
return ret;
}
-
+/*
+ * (gdb) bt
+ * #0 qemuMonitorJSONSendFileHandle (mon=mon@entry=0x7fa67c00aa90, fdname=fdname@entry=0x7fa680001f50 "vhostfd-31", fd=fd@entry=31) at qemu/qemu_monitor_json.c:3805
+ * #1 0x00007fa69662d2c3 in qemuMonitorSendFileHandle (mon=mon@entry=0x7fa67c00aa90, fdname=fdname@entry=0x7fa680001f50 "vhostfd-31", fd=fd@entry=31) at qemu/qemu_monitor.c:2764
+ * #2 0x00007fa69662e3bf in qemuMonitorAddDeviceWithFd (mon=0x7fa67c00aa90, devicestr=0x7fa6800021d0 "vhost-scsi-pci,wwpn=naa.5001405324af0985,vhostfd=vhostfd-31,id=hostdev0,bus=pci.4,addr=0x0", fd=31,
+ * fdname=0x7fa680001f50 "vhostfd-31") at qemu/qemu_monitor.c:3005
+ * #3 0x00007fa6965f65a1 in qemuDomainAttachSCSIVHostDevice (hostdev=0x7fa680002f90, vm=0x7fa67c01e2c0, driver=0x7fa68c0f0110) at qemu/qemu_hotplug.c:2713
+ * #4 qemuDomainAttachHostDevice (driver=driver@entry=0x7fa68c0f0110, vm=vm@entry=0x7fa67c01e2c0, hostdev=<optimized out>) at qemu/qemu_hotplug.c:2873
+ * #5 0x00007fa696676e0f in qemuDomainAttachDeviceLive (driver=0x7fa68c0f0110, dev=0x7fa680002ec0, vm=0x7fa67c01e2c0) at qemu/qemu_driver.c:8975
+ * #6 qemuDomainAttachDeviceLiveAndConfig (flags=<optimized out>, xml=<optimized out>, driver=0x7fa68c0f0110, vm=0x7fa67c01e2c0) at qemu/qemu_driver.c:9836
+ * #7 qemuDomainAttachDeviceFlags (dom=<optimized out>, xml=<optimized out>, flags=1) at qemu/qemu_driver.c:9890
+ * #8 0x00007fa6c2a4f736 in virDomainAttachDevice (domain=domain@entry=0x7fa6800171d0,
+ * xml=0x7fa6800028e0 "<hostdev mode='subsystem' type='scsi_host'>\n <source protocol='vhost' wwpn='naa.5001405324af0985'/>\n</hostdev>\n") at libvirt-domain.c:8255
+ * #9 0x000055f075038d2f in remoteDispatchDomainAttachDevice (server=0x55f0771ee340, msg=0x55f0771ee260, args=0x7fa680002ac0, rerr=0x7fa6b180bc10, client=<optimized out>)
+ * at remote/remote_daemon_dispatch_stubs.h:3717
+ * #10 remoteDispatchDomainAttachDeviceHelper (server=0x55f0771ee340, client=<optimized out>, msg=0x55f0771ee260, rerr=0x7fa6b180bc10, args=0x7fa680002ac0, ret=0x7fa6800172d0)
+ * at remote/remote_daemon_dispatch_stubs.h:3696
+ * #11 0x00007fa6c296d225 in virNetServerProgramDispatchCall (msg=0x55f0771ee260, client=0x55f07720f950, server=0x55f0771ee340, prog=0x55f07720d1f0) at rpc/virnetserverprogram.c:435
+ * #12 virNetServerProgramDispatch (prog=0x55f07720d1f0, server=server@entry=0x55f0771ee340, client=0x55f07720f950, msg=0x55f0771ee260) at rpc/virnetserverprogram.c:302
+ * #13 0x00007fa6c297267d in virNetServerProcessMsg (msg=<optimized out>, prog=<optimized out>, client=<optimized out>, srv=0x55f0771ee340) at rpc/virnetserver.c:137
+ * #14 virNetServerHandleJob (jobOpaque=<optimized out>, opaque=0x55f0771ee340) at rpc/virnetserver.c:158
+ * #15 0x00007fa6c288fec1 in virThreadPoolWorker (opaque=opaque@entry=0x55f0771e19f0) at util/virthreadpool.c:163
+ * #16 0x00007fa6c288f248 in virThreadHelper (data=<optimized out>) at util/virthread.c:206
+ * #17 0x00007fa6bfe68ea5 in start_thread () from /lib64/libpthread.so.0
+ * #18 0x00007fa6bfb918cd in clone () from /lib64/libc.so.6
+ *
+ * called by:
+ * - src/qemu/qemu_monitor.c|2643| <<qemuMonitorSendFileHandle>> return qemuMonitorJSONSendFileHandle(mon, fdname, fd);
+ */
int qemuMonitorJSONSendFileHandle(qemuMonitorPtr mon,
const char *fdname,
int fd)
diff --git a/src/rpc/virnetclient.c b/src/rpc/virnetclient.c
index 1c5bef8..0a6f933 100644
--- a/src/rpc/virnetclient.c
+++ b/src/rpc/virnetclient.c
@@ -1295,6 +1295,10 @@ virNetClientCallDispatch(virNetClientPtr client)
}
+/*
+ * called by:
+ * - src/rpc/virnetclient.c|1351| <<virNetClientIOHandleOutput>> ssize_t ret = virNetClientIOWriteMessage(client, thecall);
+ */
static ssize_t
virNetClientIOWriteMessage(virNetClientPtr client,
virNetClientCallPtr thecall)
diff --git a/src/rpc/virnetserverclient.c b/src/rpc/virnetserverclient.c
index 6571082..46ee79f 100644
--- a/src/rpc/virnetserverclient.c
+++ b/src/rpc/virnetserverclient.c
@@ -1359,6 +1359,10 @@ static ssize_t virNetServerClientWrite(virNetServerClientPtr client)
* Process all queued client->tx messages until
* we would block on I/O
*/
+/*
+ * called by:
+ * - src/rpc/virnetserverclient.c|1483| <<virNetServerClientDispatchEvent>> virNetServerClientDispatchWrite(client);
+ */
static void
virNetServerClientDispatchWrite(virNetServerClientPtr client)
{
diff --git a/src/rpc/virnetsocket.c b/src/rpc/virnetsocket.c
index 6c790cb..0d27c39 100644
--- a/src/rpc/virnetsocket.c
+++ b/src/rpc/virnetsocket.c
@@ -2019,6 +2019,11 @@ ssize_t virNetSocketWrite(virNetSocketPtr sock, const char *buf, size_t len)
/*
* Returns 1 if an FD was sent, 0 if it would block, -1 on error
*/
+/*
+ * called by:
+ * - src/rpc/virnetclient.c|1318| <<virNetClientIOWriteMessage>> if ((rv = virNetSocketSendFD(client->sock, thecall->msg->fds[i])) < 0)
+ * - src/rpc/virnetserverclient.c|1383| <<virNetServerClientDispatchWrite>> if ((rv = virNetSocketSendFD(client->sock, client->tx->fds[i])) < 0) {
+ */
int virNetSocketSendFD(virNetSocketPtr sock, int fd)
{
int ret = -1;
diff --git a/src/util/virfile.c b/src/util/virfile.c
index 20260a2..d19c03b 100644
--- a/src/util/virfile.c
+++ b/src/util/virfile.c
@@ -2217,6 +2217,10 @@ virFileOpenForceOwnerMode(const char *path, int fd, mode_t mode,
* creation, then perform the unlink of the file. The storage driver
* buildVol backend function expects the file to be deleted on error.
*/
+/*
+ * called by:
+ * - src/util/virfile.c|2445| <<virFileOpenAs>> if ((fd = virFileOpenForked(path, openflags, mode, uid, gid, flags)) < 0) {
+ */
static int
virFileOpenForked(const char *path, int openflags, mode_t mode,
uid_t uid, gid_t gid, unsigned int flags)
@@ -2384,6 +2388,21 @@ virFileOpenForked(const char *path, int openflags, mode_t mode,
* the unlink of the file. The storage driver buildVol backend function
* expects the file to be deleted on error.
*/
+/*
+ * called by:
+ * - src/libxl/libxl_domain.c|758| <<libxlDomainSaveImageOpen>> if ((fd = virFileOpenAs(from, O_RDONLY, 0, -1, -1, 0)) < 0) {
+ * - src/libxl/libxl_driver.c|1832| <<libxlDoDomainSave>> if ((fd = virFileOpenAs(to, O_CREAT|O_TRUNC|O_WRONLY, S_IRUSR|S_IWUSR,
+ * - src/qemu/qemu_driver.c|3109| <<qemuOpenFileAs>> if ((fd = virFileOpenAs(path, oflags, S_IRUSR | S_IWUSR, uid, gid,
+ * - src/qemu/qemu_driver.c|3157| <<qemuOpenFileAs>> if ((fd = virFileOpenAs(path, oflags,
+ * - src/qemu/qemu_process.c|4416| <<qemuPrepareNVRAM>> if ((srcFD = virFileOpenAs(master_nvram_path, O_RDONLY,
+ * - src/qemu/qemu_process.c|4423| <<qemuPrepareNVRAM>> if ((dstFD = virFileOpenAs(loader->nvram,
+ * - src/storage/storage_file_fs.c|93| <<virStorageFileBackendFileCreate>> if ((fd = virFileOpenAs(src->path, O_WRONLY | O_TRUNC | O_CREAT, mode,
+ * - src/storage/storage_file_fs.c|127| <<virStorageFileBackendFileRead>> if ((fd = virFileOpenAs(src->path, O_RDONLY, 0,
+ * - src/storage/storage_util.c|446| <<storageBackendCreateRaw>> if ((fd = virFileOpenAs(vol->target.path,
+ * - src/storage/storage_util.c|531| <<virStorageBackendCreateExecCommand>> if ((fd = virFileOpenAs(vol->target.path, O_RDWR, mode,
+ * - src/storage/storage_util.c|1574| <<virStorageBackendVolOpen>> if ((fd = virFileOpenAs(path, O_RDONLY|O_NONBLOCK|O_NOCTTY,
+ * - src/util/virstoragefile.c|1039| <<virStorageFileProbeFormat>> if ((fd = virFileOpenAs(path, O_RDONLY, 0, uid, gid, 0)) < 0) {
+ */
int
virFileOpenAs(const char *path, int openflags, mode_t mode,
uid_t uid, gid_t gid, unsigned int flags)
diff --git a/src/util/virsocket.c b/src/util/virsocket.c
index 9aa29f1..03356c2 100644
--- a/src/util/virsocket.c
+++ b/src/util/virsocket.c
@@ -383,6 +383,11 @@ vir_socket(int domain, int type, int protocol)
Return 0 on success, or -1 with errno set in case of error.
*/
+/*
+ * called by:
+ * - src/rpc/virnetsocket.c|2033| <<virNetSocketSendFD>> if (virSocketSendFD(sock->fd, fd) < 0) {
+ * - src/util/virfile.c|2286| <<virFileOpenForked>> ret = virSocketSendFD(pair[1], fd);
+ */
int
virSocketSendFD(int sock, int fd)
{
--
2.17.1