On Mon, Sep 28, 2009 at 02:23:05PM +0100, Mark McLoughlin wrote: > On Thu, 2009-09-24 at 16:00 +0100, Daniel P. Berrange wrote: > > * src/qemu/qemu_monitor.c, src/qemu/qemu_monitor.h: Add new > > qemuMonitorCloseFileHandle and qemuMonitorSendFileHandle > > APIs for processing file handles > > * src/qemu/qemu_driver.c: Convert NIC hotplug method over to > > use qemuMonitorCloseFileHandle and qemuMonitorSendFileHandle > > --- > > src/qemu/qemu_driver.c | 40 +++------------------ > > src/qemu/qemu_monitor_text.c | 78 ++++++++++++++++++++++++++++++++++++++++++ > > src/qemu/qemu_monitor_text.h | 6 +++ > > 3 files changed, 90 insertions(+), 34 deletions(-) > > > > diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c > > index b447a87..f8710a6 100644 > > --- a/src/qemu/qemu_driver.c > > +++ b/src/qemu/qemu_driver.c > > @@ -4619,7 +4619,7 @@ static int qemudDomainAttachNetDevice(virConnectPtr conn, > > { > > virDomainNetDefPtr net = dev->data.net; > > char *cmd = NULL, *reply = NULL, *remove_cmd = NULL; > > - char *tapfd_name = NULL, *tapfd_close = NULL; > > + char *tapfd_name = NULL; > > int i, tapfd = -1; > > unsigned domain, bus, slot; > > > > @@ -4662,32 +4662,8 @@ static int qemudDomainAttachNetDevice(virConnectPtr conn, > > if (virAsprintf(&tapfd_name, "fd-%s", net->hostnet_name) < 0) > > goto no_memory; > > > > - if (virAsprintf(&tapfd_close, "closefd %s", tapfd_name) < 0) > > - goto no_memory; > > You're dropping the pre-allocation of the closefd command meaning the > code is less likely to actually work under OOM, but we're fantasising if > we think our OOM handling is that good anyway :-) I observed that the 'qemudMonitorCommandWithHandler' method which we then invoke, has several calls to VIR_REALLOC, ergo pre-allocating the command string won't save us in an OOM scenario. Regards, Daniel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :| -- Libvir-list mailing list Libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list