-
Notifications
You must be signed in to change notification settings - Fork 49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add the --dhcp option to the clone subcommand #8
Conversation
The second commit adds a convenient way to wait until the dhcp address is obtained. That makes it a lot easier on orchestration tools like ansible to use ezmomi to provision new virtual machines. I copied the code for finding all VMs and I really suspect there is a more optimized call to fetch a single one, so any guidance would be appreciated. |
Thanks @jctanner. I'm thrilled to have another contributor!
A few other things...
For me it seems to never get a dhcp ip. The VM boots up, but the NIC, hostname, etc.. isn't configured on the linux side. The adapter is created on the VMWare side though. I need to look at logs and what not - could be a difference in how our templates are... feel free to address the above points in the meantime. |
@v1gnesh that would be one scenario, yes. |
As to your VM not getting an IP on boot ...
|
Sounds good on the points. Per my dhcp issue:
I don't see /etc/sysconfig/network-scripts/ifcfg-eth0 (only ifcfg-lo). I see a bunch of these in /var/log/messages:
I could be running into this issue. I'll do some more research. |
…stroy subcommand" This reverts commit 3b407b6.
subcommands to allow for an empty config file. Also increase the verbosity for config parsing errors.
@snobear any updates? |
@jctanner Got busy the past week. I'm going to dig into it in a few minutes. Thanks for pinging me on it. |
@jctanner does your VM template have a network script e.g. ifcfg-eth0 already present? Mine does not. I'd want ezmomi to create them if needed, which is does for static IPs currently. Pretty sure we need the I can merge your pull request as-is and then add in the ability for dhcp to be customized appropriately on the guest. Or you can tackle it. Thoughts? |
@snobear yes i had an ifcfg-eth0 and the 70-persistent-net.rules for udev file was cleared out so that the cloned VM's NIC would be assigned to eth0. If we were to write out ifcfg-eth0, how would that play out for templates that are not RHEL based? I can work on this if you define the workflow you want (preferably not exclusive to RHEL). What aspects of the customizationspec are needed? This is something I wasn't sure of, so I bypassed it. |
AFAIK the customization spec is distro-agnostic. vSphere handles customizing the guest's network settings with all the OS particulars done behind the scenes, so we are basically abstracted from it and don't have to think about it. So I'm sure whatever distros are supported by VMWare will be able to have the guest customized. Basically, you'll need to change Rethinking this some, let's make dhcp operate similar as possible to how static Workflow:
would configure three NICs: two in MyNetwork and one in OtherNetworkName. Network settings are defined in config.yml. For now we only support dhcp OR static ips, and not mix both. Make it complain and exit if both are specified on command line.
As an idea or example, this loop where we get the network settings for each network device: If static ips, loop over Just set the ip to 'dhcp' wherever that field is set, e.g. here. That could be your check in the later loop that sets up the custom spec. This will set it up nicely to support mixed static and dhcp, whenever we add that later. Hope this is a decent workflow and not too micro-managed. Or macro-managed, if there is such a thing. Let me know if you have any questions. |
@jctanner - Hi, can you create a different branch for the folder option please ? I want to test this functionality if you don ´t mind. |
Hi @jctanner how goes it? Just checking in to see if you're still interested in working on the dhcp thing.. |
@jctanner Are you still interested in finishing this one out? |
Haven't heard from @jctanner so closing this. I appreciate the PR and will reference your changes when implementing the dhcp feature. |
I don't want to create a new issue for this, so I add my comments here. |
hi , any update? creating vm from template using dhcp |
If I have some time I can pull out the changes I did on my side. |
Addresses #3
This is my first foray into the vsphere api objects, so I did a bit of shooting in the dark on how to accomplish DHCP. Please let me know what you would like revised in this patch and I would be happy to do so.