-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
Replace boot command parser with PEG parser. #6129
Conversation
parallels done but it's very slow. May need to add the optimization I talk about in the comments |
#2855 talks about virtualbox not working when under heavy load because it sends one key to each invocation of vboxmanage. Updated code to group codes properly |
I think this is in a state where the checked off builders can start being tested. I'd like to solicit community help here, since i want to test a wide range of boot commands. I've been testing with the boxes on https://www.packer.io/community-tools.html#templates and they're working, but I don't think that's enough. @mcandre, I would greatly appreciate your help testing this patch if you feel obliged. I know you've been doing a lot of work in this area. |
wondering if I can break any of this with unicode. The |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some basic testing with Bento and everything seems fine, but the VNC driver seems like 3x slower than the PC-XT driver?
I think there is room for improvement on speed. My gut feeling is that the Parallels builder was faster before this change.
|
||
/* | ||
TODO: | ||
* pc-at abstraction |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pc-xt?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah missed this in a2cc17f, but since this is a todo comment I'll let it fall off when it gets done
|
||
func Test_parse(t *testing.T) { | ||
in := "<wait><wait20><wait3s><wait4m2ns>" | ||
in += "foo/bar > one 界" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
界 is it correct to handle UTF characters? To my knowledge there are no scan codes for non US character. All special character (such as the Swedish ÅÄÖ) are handled in a software key maps i.e. the OS translate the key code for the characters on that position on an US keyboard into the current used language (for the previous mentioned characters left curly bracket, double quote, and colon respectively).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah this is a good point. I don't know that actually sending a unicode key will work or make sense. I'm mostly doing this here to make sure I'm decoding utf8 correctly.
|
||
- `<waitXX>` - Add an arbitrary pause before sending any additional keys. The | ||
format of `XX` is a possibly signed sequence of decimal numbers, each with | ||
optional fraction and a unit suffix, such as `300ms`, `-1.5h` or `2h45m`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does <wait-1.5h>
do?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
copied and pasted this from the go docs and missed that. for sure we should only accept positive values.
that is started serving the directory specified by the `http_directory` | ||
configuration parameter. If `http_directory` isn't specified, these will be | ||
blank! | ||
* `Name` - The name of the VM. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/*/-/
This is a limitation of the VNC client and I think was the behavior before this patch. It unfortunately sends one key event at a time, waiting up to with patch:
1m35s without patch:
1m31s so a little slower, and perhaps within the margin of error. I think one reason why is that the existing code does not wait
I ran the below config with and without this patch applied. I just used the logs so I only had 1-second accuracy. Packer with this patch applied took 1 second longer to go from I suppose one improvement that could be made is to join the boot command array into a single string. That way the driver can decide how many keys to send at one time. I already do this in the hyper-v builder.
|
6e92906
to
e75a965
Compare
d3bf90a
to
2ff3881
Compare
7a77ebd
to
284de35
Compare
I think this is code complete. now just on to testing |
Replaces #5989
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further. |
This PR replaces the custom boot command parser with a PEG parser (https://github.com/mna/pigeon). This should make sure our parsing logic is correct and is consistent across the builders.
Closes #6034
Closes #2855
blocks on hashicorp/middleman-hashicorp#58
Still need to
<p>
tags in the docs partialPrepare()
.SendKey
andSendSpecial
. These operations might take some time and best to be allowed to bail out if we're stopping. Probably okay if this doesn't get done.common/boot_command
=>common/bootcommand