-
Notifications
You must be signed in to change notification settings - Fork 50
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
cloning "Uncustomizable Guest" gives a nasty exception and leaves NICs disconnected #33
Comments
@snobear, I'd like some input on this since I don't want to take things a direction you don't agree with. I've implemented locally, a simple exception handler for when customization fails. It then reconfigures the VM to ensure the NICs are enabled and powers on the VM. The more I think about it, I don't think this should be default behavior. Reason, if you aren't PLANNING to have customization fail for unsupported OSes, then you could very well have VMs booting up, using IPs which you didn't plan for. With this line of reasoning, I'd probably enable this behavior behind a '--unsupportedGuest' CLI param. Or maybe "--customGuest". Naming is hard here, since we are talking about "Unsupported Guest Customization". All big words. :) What I'd really like to do is take this a step further, and if unsupportedGuest support is enabled, implement vmrun type functionality to run a custom guest customization script on the VM. It would need some extra configuration:
Hmm... really, maybe this would be "customClone" instead of the default "clone" option, and could use a script for network configuration instead of even attempting the standard customization stuff. Obviously, the driving factor here is I want to run some non-customizable OSes, eg, Debian and FreeBSD. I figure I could provide at least a sample customization script that does simple network config that more-or-less matches what ezmomi already does by default. But all this clearly will require extra config since the user will need to at least place said config script onto their template. There's some thoughts, I'd love some feedback. :-) |
My instinct would be to go with two new optional params, one for a fallback script and another for an optional script to run for guests that are customizable. I like your more specific naming thoughts on that though. Hmm let me sleep on it. Awesome comments and suggestions all around. Thanks for prodding me on it, we'll get it movin! |
As a side note, let's name parameters with dash-delimited words as opposed to camelCase. The camel case works well on the subcommands like powerOn, so that's all good. Dash-delimited seems standard on many tools I use. The java world probably does the opposite though :). Alright, so the proposal is that if the "uncustomizable guest" exception is caught, ezmomi would fire off a script as specified by Alternatively, what if we just had a generic Whats your thoughts on the alternative approach? We can then think about the other parameters needed like values and credentials. |
If you don't supply
I like 2 or 3. I use to just clone VMs and handle the networking setup manually, so there may be other users that do the same so thus wouldn't care to run a script. |
Lots of good ideas here. I'm inclined to have a single I think this gives the user clean messaging about about the unsupported guest with suggested next steps, but it does not change expected behavior. Let me summarize the workflow I'll plan to implement if we agree:
I feel pretty good about this workflow. What's left to be defined is how we configure params, credentials, etc. I'm inclined to have a section in the yaml config file which defines an array of scripts, their names, paths and the associated params for each. Then, either At the moment, I'm assuming we stage scripts on the ezmomi host, which would require copying the file from local host to guest, but I think we can pull that off. Worst case scenario, we have to pre-stage the script on the guest, which means we'd still maybe name the scripts or define a template name as having a script with certain params. |
Yes, I agree on that summary, way to distill it all down into a nice list. I feel good about that workflow as well. I like the idea of a section in the yaml file with an array of scripts, their params, and settings. It sounds like how the travis.yml file works for Travis, so I like the familiarity of that approach. Let me think about what we will actually be able to pass to |
Here's a first pass at the yaml config for the run script. The ezmomi call would look like
I'm thinking you'll still define static IPs with the One question is how should params be specified to the guest script? I'm assuming the script language could be anything, e.g. bash, python, ruby, perl, etc... so it'd have to be a standard, generic, and flexible. I'm thinking positional arguments, and you can adjust the position they are passed in by changing the order of params as they show up for the script under Let me know your thoughts on this. |
YAML looks pretty good to me. The one missing thing is guest credentials. For vmrun functionality to execute/copy things on the guest, credentials need to be provided that are valid on the guest VM itself. Also, I agree positional arguments is the right thing. It's not awesome, but the simplest path would be force the user to know whether they are handling multiple IPs or not. We'll always pass the IP arguments first, so if we only are using one IP in maybe something like:
I'm also open to keyword params. If we want to go that way, I'll make sure we have a decent example, because those aren't as common in the bash world. |
That looks good. I think we're pretty close, so go ahead and start implementing and we'll get our hands on it to see how it plays out. For
so you'd have a script being called like:
I think it'd be easy enough to make a bash script flexible enough to "stuff all parameters after the second one into its own array". |
Sometimes we need to clone templates that don't support guest customization. This results in:
This alone is ugly, but even worse is the newly created NIC devices are left disconnected and the VM is left powered off.
A common workaround for unsupported guests is to use vmrun capabilities to run a customization script on the machine, but that fails to work when NICs are not connected. Of course the script won't run while VM is powered off, too.
I propose to check if the VirtualMachineGuestOsIdentifier supports customization and only try supported operations, if so. I'm assuming we'd still nuke existing NIC devices and add the number of devices requested by --ips. Memory, CPU would of course configure the biggest problem I'm seeing is the disconnected NICs, but I should point out, VMware is certainly failing to configure networking on them, too.
An alternative is to catch the exception and then make sure we have the NICs connected on the target VM, and then power it on, but that still leaves a failed clone operation in vcenter which is pretty ugly.
The text was updated successfully, but these errors were encountered: