Re: [PATCH v1 2/3] conf: Check migration_host is localhost or not during restart

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 2014-09-22 at 15:34 +0200, Ján Tomko wrote: 
> On 09/12/2014 06:33 AM, Chen Fan wrote:
> > Signed-off-by: Chen Fan <chen.fan.fnst@xxxxxxxxxxxxxx>
> > ---
> >  src/qemu/qemu_conf.c | 11 +++++++++++
> >  1 file changed, 11 insertions(+)
> > 
> > diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c
> > index ac10b64..013f3de 100644
> > --- a/src/qemu/qemu_conf.c
> > +++ b/src/qemu/qemu_conf.c
> > @@ -707,6 +707,17 @@ int virQEMUDriverConfigLoadFile(virQEMUDriverConfigPtr cfg,
> >      GET_VALUE_LONG("seccomp_sandbox", cfg->seccompSandbox);
> >  
> >      GET_VALUE_STR("migration_host", cfg->migrateHost);
> > +    if (cfg->migrateHost) {
> > +        if (STRPREFIX(cfg->migrateHost, "localhost") ||
> > +            STREQ(cfg->migrateHost, "127.0.0.1") ||
> > +            STREQ(cfg->migrateHost, "::1") ||
> > +            STREQ(cfg->migrateHost, "[::1]")) {\
> 
> I think we need a 'virSocketAddrIsLocalhost' function similar to
> virSocketAddrIsWildcard, which would check any numeric represnation of the
> address:
> 
> if (STRPREFIX(cfg->migrateHost, "localhost") ||
>     virSocketAddrIsLocalhost(cfg->migrateHost))

It's a good point.


> 
> > +            virReportError(VIR_ERR_CONF_SYNTAX, "%s",
> > +                           _("migration_host must be a valid address or hostname"));
> 
> Something more specific, like: "migration_host must not be localhost" is more
> user-friendly.
I will update the output.


Thanks,
Chen

> 
> Jan
> 
> > +            goto cleanup;
> > +        }
> > +    }
> > +
> >      GET_VALUE_STR("migration_address", cfg->migrationAddress);
> >  
> >      GET_VALUE_BOOL("log_timestamp", cfg->logTimestamp);
> > 
> 
> 


--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list





[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]