On 2014/8/22 18:47, Maxime Leroy wrote:
+# util/virivshmemserver.h
+virStartIvshmemServer;
+virStopIvshmemServer;
I think function name virIvshmemStartServer is better.
So is the stop function.
@@ -5120,6 +5121,12 @@ qemuBuildIvshmemCommandLine(virCommandPtr
cmd,
return -1;
virCommandAddArg(cmd, devstr);
VIR_FREE(devstr);
+
+ if (ivshmem->server.start == VIR_TRISTATE_BOOL_YES) {
+ if (virStartIvshmemServer(dev->name, ivshmem->server.path,
+ ivshmem->size, ivshmem->msi.vectors))
+ return -1;
+ }
}
I'm not sure that calling virStartIvshmemServer in qemuBuildIvshmemCommandLine
is the best way. Maybe qemuBuild*CommandLine() usually only build commandline.
return 0;
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index baa866a..aaf03a3 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -67,6 +67,7 @@
#include "virstring.h"
#include "virhostdev.h"
#include "storage/storage_driver.h"
+#include "virivshmemserver.h"
#define VIR_FROM_THIS VIR_FROM_QEMU
@@ -4684,6 +4685,15 @@ void qemuProcessStop(virQEMUDriverPtr driver,
}
}
+ /* stop runnning ivshmem server */
+ for (i = 0; i < vm->def->nshmems; i++) {
+ virDomainShmemDefPtr shmem = vm->def->shmems[i];
+ if (shmem->model == VIR_DOMAIN_SHMEM_MODEL_IVSHMEM &&
You can use switch (for extension other shmem in future).