On 5/26/20 2:41 AM, Chen Hanxiao wrote:
Support downscript for booting vm,
and hotunplug interface device.
Signed-off-by: Chen Hanxiao <chen_han_xiao(a)126.com>
---
src/qemu/qemu_extdevice.c | 4 ++
src/qemu/qemu_hotplug.c | 3 ++
tests/qemuxml2argvdata/downscript.xml | 60 +++++++++++++++++++++++++
tests/qemuxml2xmloutdata/downscript.xml | 60 +++++++++++++++++++++++++
tests/qemuxml2xmltest.c | 1 +
5 files changed, 128 insertions(+)
create mode 100644 tests/qemuxml2argvdata/downscript.xml
create mode 100644 tests/qemuxml2xmloutdata/downscript.xml
diff --git a/src/qemu/qemu_extdevice.c b/src/qemu/qemu_extdevice.c
index 2096272761..4962521de4 100644
--- a/src/qemu/qemu_extdevice.c
+++ b/src/qemu/qemu_extdevice.c
@@ -213,6 +213,7 @@ qemuExtDevicesStop(virQEMUDriverPtr driver,
virDomainObjPtr vm)
{
virDomainDefPtr def = vm->def;
+ virDomainNetType actualType;
This can be defined in the for() loop in the below hunk.
size_t i;
if (qemuExtDevicesInitPaths(driver, def) < 0)
@@ -230,10 +231,13 @@ qemuExtDevicesStop(virQEMUDriverPtr driver,
for (i = 0; i < def->nnets; i++) {
virDomainNetDefPtr net = def->nets[i];
+ actualType = virDomainNetGetActualType(net);
qemuSlirpPtr slirp = QEMU_DOMAIN_NETWORK_PRIVATE(net)->slirp;
if (slirp)
qemuSlirpStop(slirp, vm, driver, net);
+ if (actualType == VIR_DOMAIN_NET_TYPE_ETHERNET && net->downscript)
+ virNetDevRunEthernetScript(net->ifname, net->downscript);
}
for (i = 0; i < def->nfss; i++) {
Michal