Code Monkey home page Code Monkey logo

Comments (7)

edigaryev avatar edigaryev commented on June 22, 2024

I don't see how this could work, as the host will not get to the point of obtaining and setting an IP address until it has fully booted.

It will get the IP if running macOS (even when running with--recovery), but in the case of automated Linux installation I guess you're right. Is this what you're trying to do?

The reason we retrieve the VM's IP-address first is that it's the most reliable way to find out the bridge interface that the vmnet.framework is using. And from that bridged interface it's easy to derive the gateway IP.

from packer-plugin-tart.

edigaryev avatar edigaryev commented on June 22, 2024

On a second thought, even if we skip the tart ip ... part, how would a VM connect to the HTTP server running on host without obtaining the IP address for itself from the DHCP server first?

Packer plugin for Tart only officially supports shared (NAT) network, and that implies the DHCP usage by the guest.

from packer-plugin-tart.

nferch avatar nferch commented on June 22, 2024

Yes, automated Linux Ubuntu installation is what I'm trying to do. Had totally forgotten about macOS, makes so much more sense now. :/

The HTTP server's address is needed to pass as a parameter to the GRUB bootloader. It isn't actually used until networking is up and an IP address is obtained from DHCP.

It should be safe to assume that shared (NAT) network is being used, so I guess the question is how to reliably determine what interface is used for that. Could try and mirror what tart is doing with VZNetworkDeviceAttachment and get the address through that somehow. Alternatively, a config option to set it manually would be fine for my purposes.

from packer-plugin-tart.

edigaryev avatar edigaryev commented on June 22, 2024

The HTTP server's address is needed to pass as a parameter to the GRUB bootloader. It isn't actually used until networking is up and an IP address is obtained from DHCP.

I've just tried running Ubuntu Server and preventing it from going past GRUB (by pressing Esc) and it turns out that the Virtualization.Framework didn't even create a bridge* interface that we use to determine the {{ .HTTPIP }}.

Anyway, I think you can already accomplish this:

Alternatively, a config option to set it manually would be fine for my purposes.

...by setting the http_bind_address option to a value other than 0.0.0.0 in your Packer template for Tart plugin, see:

if config.HTTPAddress != "" {
return config.HTTPAddress, nil
}

(yes, we currently bypass the guest IP/interface resolution logic if this option if not empty as opposed to not equal to 0.0.0.0, but that's subject to change)

from packer-plugin-tart.

nferch avatar nferch commented on June 22, 2024

The HTTP server's address is needed to pass as a parameter to the GRUB bootloader. It isn't actually used until networking is up and an IP address is obtained from DHCP.

I've just tried running Ubuntu Server and preventing it from going past GRUB (by pressing Esc) and it turns out that the Virtualization.Framework didn't even create a bridge* interface that we use to determine the {{ .HTTPIP }}.

Good catch, I either didn't notice that or had something holding bridge100 open.

Anyway, I think you can already accomplish this:

Alternatively, a config option to set it manually would be fine for my purposes.

...by setting the http_bind_address option to a value other than 0.0.0.0 in your Packer template for Tart plugin, see:

if config.HTTPAddress != "" {
return config.HTTPAddress, nil
}

(yes, we currently bypass the guest IP/interface resolution logic if this option if not empty as opposed to not equal to 0.0.0.0, but that's subject to change)

That doesn't quite work for me, I had to move the commonsteps.HTTPServerFromHTTPConfig before stepCreateLinuxVM, I'm guessing because of the port number selection?

from packer-plugin-tart.

edigaryev avatar edigaryev commented on June 22, 2024

That doesn't quite work for me, I had to move the commonsteps.HTTPServerFromHTTPConfig before stepCreateLinuxVM, I'm guessing because of the port number selection?

Good catch! This should be fixed as a part of the new 1.3.0 release, the HTTP server is now started before the installation takes place.

from packer-plugin-tart.

nferch avatar nferch commented on June 22, 2024

Thanks so much, confirmed it is working with the workaround.

Longer term a better option might be to dynamically create an ISO or floppy similar to QEMU builder but this works for my manual invocations. Would require some sort of hack to get it working with CI though, I'd guess.

from packer-plugin-tart.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.