[libvirt] [PATCH 5/6] qemu: Use virNetSocket for tunneled migration

Jiri Denemark jdenemar at redhat.com
Mon Aug 15 12:40:35 UTC 2011


On Mon, Aug 15, 2011 at 17:55:33 +0800, Daniel Veillard wrote:
> On Mon, Aug 15, 2011 at 09:58:15AM +0200, Jiri Denemark wrote:
> > ---
> >  src/qemu/qemu_migration.c |   50 +++++++-------------------------------------
> >  1 files changed, 8 insertions(+), 42 deletions(-)
> > 
> > diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
> > index 1cabbe0..c29ea9e 100644
> > --- a/src/qemu/qemu_migration.c
> > +++ b/src/qemu/qemu_migration.c
> > @@ -42,6 +42,7 @@
...
> > -    qemu_sock = socket(AF_UNIX, SOCK_STREAM, 0);
> > -    if (qemu_sock < 0) {
> > -        virReportSystemError(errno, "%s",
> > -                             _("cannot open tunnelled migration socket"));
> > -        goto cleanup;
> > -    }
> > -    memset(&sa_qemu, 0, sizeof(sa_qemu));
> > -    sa_qemu.sun_family = AF_UNIX;
> > -    if (virStrcpy(sa_qemu.sun_path, unixfile,
> > -                  sizeof(sa_qemu.sun_path)) == NULL) {
> > -        qemuReportError(VIR_ERR_INTERNAL_ERROR,
> > -                        _("Unix socket '%s' too big for destination"),
> > -                        unixfile);
> > +    if (virNetSocketNewListenUNIX(unixfile, 0700,
> > +                                  driver->user, driver->group, &sock) < 0 ||
> > +        virNetSocketListen(sock, 1) < 0)
> 
>   If we are sure the errors will be properly reported back in called
>   functions, okay

Yep, both virNetSocketNewListenUNIX and virNetSocketListen report the errors
themselves.

>   Looks lovely except that a code removing so many lines on migration
>   code souds too good to be true <grin/>

:-P

Jirka




More information about the libvir-list mailing list