Skip to content
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

Behavior boot xhyve #2

Closed

Conversation

zchee
Copy link

@zchee zchee commented Sep 17, 2015

@nathanleclaire
Finished behavior booting xhyve and first connection ssh!
but, So dirty, I would later rebase.

Issues and help!

For now, execute xhyve use gorutine.
If not use gorutine, stopped work at point of execute xhyve.

But, gorutine is closed along with the main thread.
Will need change to syscall fork or go execute external process myself or OS X launchd daemon or other daemonize method.
Also, @tiborvass said use reexec docker core package. https://github.com/tiborvass/xhyve-bindings#roadmap
If true, it should implement the vm control to xhyve...
Do you have any good or other ideas?

And, Shared folder issue.
Although I think that it is for the time being may be use the nfs.
However, technology that enables the shared folder does not know only libvirt.
Do you have knowledge of other shared folder method?

I will later commit for a little customized boot2docker.iso source.

Changed

I think you quickly understand that if you read the code, but I write for other guys saw repo.

Definitely exec xhyve

So far, Use os/execpackage, exec.Command func for execute xhyve binary.
but, cause I do not know, In fact xhyve does not seem to launch.
On the proof, /var/db/dhcpd_leases is not created.

So, I've embedded a tiborvass/xhyve-bindings that tiborvass developed. Thanks @tiborvass :)
Repository becomes larger, and will need cgo build, but the flexibility is handed Because xhyve source include.
Fork process, Daemonize, and more.

xhyve headless mode

Remove stdio flag in this kexec command.

-s 0:0,hostbridge -s 31,lpc -s 0:0,hostbridge -l com1,stdio
# to
-s 0:0,hostbridge -s 31,lpc -s 0:0,hostbridge -l com1

Then, xhyve will not output to stdin.
Together, it has disappeared login screen. Successful autologin docker user need not be input tcuser password.
but, May be need a customize boot2docker bootscript.sh. Does not yet verification.

Copy inside xhyve the including publicSSHKey userdata.tar

xhyve still does not implement a shared folder and vmware like CopyFileFromHostGuest runScriptInGuest commands.
So, mounting /dev/vdb use virtio-blk interface.

-s 5,virtio-blk, userdata.tar

-5 flag is mounting /dev/vdb.
Then, customized bootscript.sh will export to /var/lib/boot2docker/userdata.tar If /dev/vdb is not empty.
This hack is too bad. Is likely there are other ways.

Disable Blank diskimage overwride boot2docker.iso

generateBlankDiskImage() func is overwride boot2docker.iso.
boot2docker.iso is for pci cd boot image. Do not overwride.
It's what I wrote previous. Sorry :(

Disable tuntap

For now, Disable tuntap virtual network protocol for easy develop and debug.
The better performance, it will later enable.

Enable ACPI

xhyve supported ACPI interface now. So enable default.

Get Machine IP in dhcpd_leases from MAC address

xhyve is always outputing dhcp data in dhcpd_leases.
So, Get the IP of the machine that trying to launch now, use the uuid2mac written by @ailispaw.
See https://github.com/ailispaw/boot2docker-xhyve/tree/master/uuid2ip

I'm sorry a very incomprehensible English.
It is very better than of writing in English to write program... 😱

Signed-off-by: Koichi Shiraishi <[email protected]>
Signed-off-by: Koichi Shiraishi <[email protected]>
Does not overwrite boot2docker.iso

Signed-off-by: Koichi Shiraishi <[email protected]>
- Remove d.ISO type struct
- Get d.ISO path to func
- Get d.imgPath to func

Signed-off-by: Koichi Shiraishi <[email protected]>
Signed-off-by: Koichi Shiraishi <[email protected]>
Signed-off-by: Koichi Shiraishi <[email protected]>
- Missing userdata.tar path
- Remove duplicate debug log

Signed-off-by: Koichi Shiraishi <[email protected]>
Signed-off-by: Koichi Shiraishi <[email protected]>
Signed-off-by: Koichi Shiraishi <[email protected]>
@tiborvass
Copy link

Wow man thanks :D I'll let @nathanleclaire comment on the content

@zchee
Copy link
Author

zchee commented Sep 18, 2015

@tiborvass Thanks!
I had realized that xhyve is not able to exec, the xhyve-bindings it was very helped.
and, I've embedded without import. sorry.

Thanks again.

@nathanleclaire
Copy link
Owner

Whoa nice. It will take some time to take a look but I will when I get a chance.

@zchee
Copy link
Author

zchee commented Sep 19, 2015

@nathanleclaire thanks.
I pushed custom boot2docker.

Edit
Rename branch.
and, delete unnecessary hack
See https://github.com/zchee/boot2docker-legacy/tree/xhyve and please build.

@zchee zchee force-pushed the behavior-boot-xhyve branch 4 times, most recently from b41fc7c to 913f555 Compare September 20, 2015 09:24
Signed-off-by: Koichi Shiraishi <[email protected]>
Signed-off-by: Koichi Shiraishi <[email protected]>
- Separate kexec boot command with Start func. Destination to commandline flag variable
- Fix some output logs. Easy to view and recognizethe relavant variables.
- Change some helper func name
- Add some TODO comment
- Uncomment unused func
- Remove the create uuid file func

Signed-off-by: Koichi Shiraishi <[email protected]>
@zchee zchee force-pushed the behavior-boot-xhyve branch 2 times, most recently from 7c10f4c to e829e04 Compare September 20, 2015 19:18
- Reducing uselessness point on uuidgen func
- Fix uuid2mac to execute under the sudo

Signed-off-by: Koichi Shiraishi <[email protected]>
- Improvement hardcode vmlinuz64 and initrd.img path

- More readable several filepath on kexec protocol

- Add userdata.tar to /dev/vdb(-s 5,virtio-blk) mount point.
  Send without a shell command, use linux filesystem.
  Need custom boot2docker iso (github.com/zchee/boot2docker-legacy xhyve branch)

- Add convert MAC address from generated UUID func use uuid2mac binary.
  This variable used parse IP in /var/db/dhcpd_leases

Signed-off-by: Koichi Shiraishi <[email protected]>
Signed-off-by: Koichi Shiraishi <[email protected]>
Signed-off-by: Koichi Shiraishi <[email protected]>
Signed-off-by: Koichi Shiraishi <[email protected]>
Signed-off-by: Koichi Shiraishi <[email protected]>
- Required sudo for vmnet. Avoid the sudo use set root id

Signed-off-by: Koichi Shiraishi <[email protected]>
@zchee zchee force-pushed the behavior-boot-xhyve branch from b12004e to a26df39 Compare September 21, 2015 01:43
@zchee
Copy link
Author

zchee commented Sep 21, 2015

Update

Get Machine IP use embedded vmnet packages instead of execute uuid2mac binary
Thanks for advice and vmnet packages @ailispaw

Resolve daemonizes issue

For now, successful docker-machine create command. Also, ssh, env.
However, it is not a good feel.
Very dirty, it is not pretty.

Use...

embedded way is better, or separate way is good, I want advice.

Since now was supposed to work, wait for your advice.

Notice

When the docker-machine-xhyve was os.exec the xhyve-bindings, it did not work in the same way that does not work os.exec xhyve binary.
but, xhyve-bindings are execute itself using gorutine, it worked.
https://github.com/zchee/xhyve-bindings/blob/daemonize/main/main.go#L45-L52

- Required sudo for vmnet. Avoid the sudo use set root id

Signed-off-by: Koichi Shiraishi <[email protected]>
@zchee zchee force-pushed the behavior-boot-xhyve branch from e75e6b0 to 505b13e Compare September 21, 2015 12:57
Signed-off-by: Koichi Shiraishi <[email protected]>
@zchee zchee mentioned this pull request Sep 21, 2015
7 tasks
@nathanleclaire
Copy link
Owner

@zchee Would you like to carry this in the master branch of your repository? I am unable to devote any real attention to it at the moment.

@tiborvass
Copy link

@zchee as far as xhyve-bindings is concerned, feel free to send PRs to my repo.

@zchee
Copy link
Author

zchee commented Sep 22, 2015

@nathanleclaire OK!!
You are busy with other work, I knew.
Thiis PR are carry to my repository. will Close PR.

So, If it's alright with you, that it is easy to understand the other person, also In order to prevent the unnecessary issue post to your repo, I am glad when willing to write encourage to my repo a short infomation in the README :)
I guess because not been attention lol

@tiborvass OK. I will send PR to your repository.
Now, I Implemented a simple daemon, but there is little more improvement plan.
Whether it is better to have sent at once? Or it is better that sent small?

Signed-off-by: Koichi Shiraishi <[email protected]>
@nathanleclaire
Copy link
Owner

So, If it's alright with you, that it is easy to understand the other person, also In order to prevent the unnecessary issue post to your repo, I am glad when willing to write encourage to my repo a short infomation in the README :)
I guess because not been attention lol

If I'm understanding you correctly (writing some documentation for the plugin in your repository?), then go for it! :)

@nathanleclaire
Copy link
Owner

@zchee If/when you are ready to assume primary responsibility in your repo, let me know and I will link to it from mine.

zchee referenced this pull request in machine-drivers/docker-machine-driver-xhyve Sep 23, 2015
Merge pull request #1 from zchee/behavior-boot-xhyve

See this commmet nathanleclaire#2 (comment)
@nathanleclaire busy with other work.
So, Move master branch to my repository.
@zchee
Copy link
Author

zchee commented Sep 23, 2015

@nathanleclaire

If/when you are ready to assume primary responsibility in your repo, let me know and I will link to it from mine.

Yes, correct. Thanks:)
and Now, merge to my master branch.
Ready!

@zchee
Copy link
Author

zchee commented Sep 23, 2015

@nathanleclaire

If/when you are ready to assume primary responsibility in your repo, let me know and I will link to it from mine.

When you have finished, Could you close PR?

@nathanleclaire
Copy link
Owner

Yep

@zchee zchee deleted the behavior-boot-xhyve branch October 22, 2015 18:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants