[libvirt] [PATCH 11/12] qemu: Implement random number generator hotplug
Peter Krempa
pkrempa at redhat.com
Tue Feb 10 10:32:55 UTC 2015
On Mon, Feb 09, 2015 at 16:57:17 +0100, Ján Tomko wrote:
> On Fri, Feb 06, 2015 at 04:32:25PM +0100, Peter Krempa wrote:
> > From: Luyao Huang <lhuang at redhat.com>
> >
> > Export the required helpers and add backend code to hotplug RNG devices.
> >
> > Signed-off-by: Luyao Huang <lhuang at redhat.com>
> > Signed-off-by: Peter Krempa <pkrempa at redhat.com>
> > ---
> > src/qemu/qemu_command.c | 2 +-
> > src/qemu/qemu_command.h | 4 ++
> > src/qemu/qemu_driver.c | 8 +++-
> > src/qemu/qemu_hotplug.c | 99 +++++++++++++++++++++++++++++++++++++++++++++++++
> > src/qemu/qemu_hotplug.h | 3 ++
> > 5 files changed, 114 insertions(+), 2 deletions(-)
> >
>
> -- 8< 8< 8< --
>
> > +
> > + /* attach the device - up to a 3 stage process */
> > + qemuDomainObjEnterMonitor(driver, vm);
> > +
> > + if (rng->backend == VIR_DOMAIN_RNG_BACKEND_EGD &&
> > + qemuMonitorAttachCharDev(priv->mon, charAlias,
> > + rng->source.chardev) < 0)
> > + goto failchardev;
> > +
> > + if (qemuMonitorAddObject(priv->mon, type, objAlias, props) < 0)
> > + goto failbackend;
> > +
> > + if (qemuMonitorAddDevice(priv->mon, devstr) < 0)
> > + goto failfrontend;
> > +
> > + if (qemuDomainObjExitMonitor(driver, vm) < 0) {
> > + vm = NULL;
> > + goto cleanup;
> > + }
>
> I know an OOM error at this exact location is not that likely, but
> it would be nicer to prealloc the space in vm->def before entering
> the monitor so that the operation below cannot fail, like we do
> when hotplugging other devices.
Sigh. Okay. I've switched to the preallocation approach as we do usually
in this case.
>
> Jan
Peter
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20150210/95535b2e/attachment-0001.sig>
More information about the libvir-list
mailing list