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

Conversation

@bergwolf
Copy link
Member

@bergwolf bergwolf commented Jun 1, 2016

This is based on top of #117 and adds local volume initialisation support.
User can use hyper run -v /local/dir:/container/dir to map a local file or directory to container.

NOTE: this will be broken with the incoming port mapping support. That is the reason I pushed this local volume support PR separate from original #117

Test results:

[lear@hyper-private]$zenlayer run -d -v /home/bergwolf/workplace/golang/src/github.com/bergwolf:/data busybox
0afc562a68be2a0cc8c5c9f18cfce3472cb8f7581d4cc33360611662b53b1f55
[lear@hyper-private]$zenlayer exec 0afc562a68be2a0cc8c5c9f18cfce3472cb8f7581d4cc33360611662b53b1f55 df
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/sda              10190100     38080   9611348   0% /
devtmpfs                252088         0    252088   0% /dev
tmpfs                   253560         0    253560   0% /dev/shm
/dev/sdb              10190100     37272   9612156   0% /data
share_dir                 1024         4      1020   0% /etc/hosts
[lear@hyper-private]$zenlayer exec 0afc562a68be2a0cc8c5c9f18cfce3472cb8f7581d4cc33360611662b53b1f55 ls -LR /data
/data:
data
goftp
main.go

/data/data:
main.go

/data/goftp:
LICENSE
README.md
doc.go
ftp.go
ftp_test.go
upload.go

execJobs []string
execID string
errCh chan error
execCount uint32
Copy link
Contributor

@laijs laijs Jun 15, 2016

Choose a reason for hiding this comment

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

sync.WaitGroup seems better.

Copy link
Contributor

Choose a reason for hiding this comment

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

chan error can pass error, but sync.WaitGroup can't.

Copy link
Member Author

Choose a reason for hiding this comment

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

WaitGroup has to wait for all ExecCmd goroutines to stop before checking results, while current implementation can check for results as it goes and returns failure as soon as any command fails.

Copy link
Member Author

Choose a reason for hiding this comment

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

chan error has to stay even if execCount is changed to sync.WaitGroup.

Copy link
Contributor

Choose a reason for hiding this comment

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

in the code before this patch, the execs are running parallel.
only the requests are sent in order. it is more efficient to send the requests parallel, but the changelog is confusing.

Copy link
Member Author

Choose a reason for hiding this comment

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

It is more about waiting in parallel rather than issuing requests in parallel. I'll fix up the changelog.

bergwolf added 5 commits June 15, 2016 13:35
It is more effecient than waiting in order, and can
be reused for local volume init/wait implementation.

Signed-off-by: Peng Tao <bergwolf@gmail.com>
Signed-off-by: Peng Tao <bergwolf@gmail.com>
Signed-off-by: Peng Tao <bergwolf@gmail.com>
Upload local files/directories in initSpecialVolumes if it is a local
volume that starts with a leading "/".

Signed-off-by: Peng Tao <bergwolf@gmail.com>
Signed-off-by: Peng Tao <bergwolf@gmail.com>
@bergwolf
Copy link
Member Author

updated to address @laijs's comments and rebase to latest master.

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.

2 participants