Skip to content
This repository was archived by the owner on Feb 27, 2018. It is now read-only.

Refactor: separate go-virtualbox package#70

Merged
SvenDowideit merged 32 commits into
boot2docker:masterfrom
riobard:refactor/vbx
Mar 24, 2014
Merged

Refactor: separate go-virtualbox package#70
SvenDowideit merged 32 commits into
boot2docker:masterfrom
riobard:refactor/vbx

Conversation

@riobard
Copy link
Copy Markdown
Contributor

@riobard riobard commented Mar 15, 2014

I factored out interactions with VirtualBox into a separate package (https://github.com/riobard/go-virtualbox). Hopefully the code for boot2docker-cli is nice, clean and type-safe now.

Additionally, this could be the first step to allow another VM solution to be used (Hyper-V on Windows?) by hooking in another package (e.g. go-hyperv)

riobard added 3 commits March 14, 2014 21:45
Make verbose and vbm pointers so we can do late binding and pass them to
other packages.
Comment thread cmds.go Outdated
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this package be part of this project? It is difficult to review when it is elsewhere.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I usually use git-subtree to include 3rd-party dependency. I'm not sure how I'm supposed to do it here. Any suggestions?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was thinking of just making a subdirectory within this project, something like:

vbx "github.com/boot2docker/boot2docker-cli/go-virtualbox"

That way we can keep all the dependencies within the same project.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, that's exactly what you get with git-subtree :)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please, don't use git subtrees for this, follow the example that the docker project uses for dependencies.

given that the virtualbox module is the important sauce for boot2docker-cli, please do not move it out of this repository - otherwise we'll have to fork it to maintaine it.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was hoping that by separating the go-virtualbox package out into its own repo, other people can use and improve it too, and we benefit as a result. The Docker approach seems to be put external dependencies into a vendor directory. Do you want me to add the dep into a similar folder?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if we separate out all the important parts of boot2docker-cli, then we have no way to maintain the code we're using. Please keep the important stuff - and go-virtualbox is important, here. Other people can use and improve it here too.

Its way too early to make it hard for the b2d-cli contributors to refactor the code.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, I'll move it here in a moment.

riobard added 13 commits March 15, 2014 10:11
Reuse the flag package to parse the configuration profile so we do not
need to use a separate pacakge. The trick is to transform the key=value
pairs in the profile into string slice of the form --key=value, then
insert the string slice between os.Args[0] and os.Args[1:]. The
flag.Parse() will take care of the rest. Less work to do and more
consistent results. Win-win!

Additionally, changed the type of some flags to reflect its nature.
This is to wait for the VM to properly boot. Initial booting will take a
bit longer due to the need to format disk and configure other settings,
during which time the SSH daemon might not be reachable.
Comment thread main.go Outdated
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are you forking this library, and then into your own repo?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are changes to the pflag package I made that hasn't been merged to the upstream yet. See ogier/pflag#4

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in that case, please put the modified version into this repo - else b2d will have to do it all again if you're busy.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you want to make the pflag package part of the repo in the same way as the go-virtualbox package, or do you want it to be part of the 3rd-party vendor directory?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would hope that the pflag PR gets merged (or fixed until it does..) and its not really core to what boot2docker is, so I'd vendor that

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense. I'm not very sure how Docker manages the vendor directory. Could you explain a little bit what I should do to vendor it?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The pflag PR has been merged.

@riobard
Copy link
Copy Markdown
Contributor Author

riobard commented Mar 17, 2014

For the included virtualbox package, do we use absolute import path? e.g.

import vbx "github.com/boot2docker/boot2docker-cli/virtualbox"

I'm wondering where do you guys put your forked repo? Do you put it under $GOPATH/src/github.com/boot2docker/boot2docker-cli or do you put it under $GOPATH/src/github.com/{YOUR_USERNAME}/boot2docker-cli? I ran in to a problem in the latter case where I cannot import the included package (because the username is different) and wanted to know how you solve this problem. Thanks!

Comment thread virtualbox/natnet.go Outdated
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

// A NATNet defines a network.

@gmlewis
Copy link
Copy Markdown
Contributor

gmlewis commented Mar 22, 2014

After addressing my comments as you see fit, LGTM.

@SvenDowideit
Copy link
Copy Markdown
Contributor

LGTM

SvenDowideit added a commit that referenced this pull request Mar 24, 2014
Refactor: separate go-virtualbox package
@SvenDowideit SvenDowideit merged commit 0fbe0f7 into boot2docker:master Mar 24, 2014
SvenDowideit added a commit to SvenDowideit/boot2docker-cli that referenced this pull request Mar 24, 2014
SvenDowideit added a commit that referenced this pull request Mar 24, 2014
Revert "Merge pull request #70 from riobard/refactor/vbx"
@SvenDowideit
Copy link
Copy Markdown
Contributor

@riobard I don't know what went wrong - I suspect you will need to make a new PR, as github is a little primitive when things go bad

riobard added a commit that referenced this pull request Mar 31, 2014
Revert "Revert "Merge pull request #70 from riobard/refactor/vbx""
SvenDowideit pushed a commit to SvenDowideit/boot2docker-cli that referenced this pull request Nov 10, 2014
…k-not-UTC

virtual box / set hwclock in VM to not beeing UTC
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants