[lago-devel] 'Persistent' IP addresses for the hosts

Yaniv Kaul ykaul at redhat.com
Wed Mar 30 19:31:18 UTC 2016


On Wed, Mar 30, 2016 at 5:33 PM, Barak Korren <bkorren at redhat.com> wrote:

>
> >
> >
> > Keeping the IP fixed should be an option, not mandatory.
> > The reason I need it is that I have an input file that needs the IP
> addresses of the hosts I'm running.
> > Theoretically it should have  supported host names, practically, it
> doesn't seem to work well with it :(
> > Y.
> >
> Maybe we can live-generate the file from the lago status output?
>

Indeed...

<ugly-hack-not-tested-yet>
with open('../robo.conf.in') as f:
        robo_conf_in = f.read()

    replacements = {
        '@HOST0@': prefix.virt_env.get_vm(_get_prefixed_name('host0').ip(),
        '@HOST1@': prefix.virt_env.get_vm(_get_prefixed_name('host1').ip(),
        '@HOST2@': prefix.virt_env.get_vm(_get_prefixed_name('host2').ip(),
    }
    for k, v in replacements.items():
        robo_conf_out = robo_conf_in.replace(k, v, 1)

    with open('../robo.conf', 'w') as out:
        out.write(robo_conf_out)
        out.close()

</ugly-hack-not-tested-yet>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ovirt.org/pipermail/lago-devel/attachments/20160330/6d95749f/attachment-0001.html>


More information about the lago-devel mailing list