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

Basic Qemu driver implementation #24

Merged
merged 8 commits into from
Sep 10, 2015
Merged

Basic Qemu driver implementation #24

merged 8 commits into from
Sep 10, 2015

Conversation

catsby
Copy link
Contributor

@catsby catsby commented Sep 8, 2015

This is a basic implementation of a Qemu driver. It's pretty bare bones, don't doing much more than basic lifecycle management. It's modeled after the exec driver (meaning it used exec.Command and friends), and borrowed heavily from Ryan Uber's prior art.

The Qemu driver accepts a source image and attempts to download it from the internet and run it.

Limitations:

  • We run qemu-system-x86_64 here. Conceivably we could support other emulation types (qemu-system-i386)
  • Requires publicly accessible source file
  • Test file is in my dropbox; need to extract into a fixture and retrieve with httptestserver
  • Only allows the forwarding of a single port on the host, but could later expose more
  • Requires you have something like init.d to start any services you're expecting to run
  • The only networking currently working is user, which may be slower. tap is possible, given the correct permissions for Nomad to run as root/privileged

Future knobs:

  • Emulation: kvm should work now but isn't really tested
  • ssh start / stop commands
  • additional ports to open/map
  • Caching – the base image should be cacheable somewhere (wasn't sure where to put it so that it's cacheable)

Links: http://qemu.weilnetz.de/qemu-doc.html

* upstream/master:
  Removed debug logging
  Added tests for docker, improved logging, and fixed a few bugs
  Added initial implementation for the docker driver; tests pending
* master: (66 commits)
  Use a single implementation of GenerateUUID
  scheduler: use update strategy for rolling updates
  nomad: adding helper structs
  scheduler: Adding CreateEval to Planner
  nomad: worker supports create eval
  nomad: guard eval creation based on parent eval
  nomad: adding Eval.Create endpoint
  nomad: support time wait for evaluations
  nomad: adding fields to cause an evaluation to 'wait'
  scheduler: support in-place allocation updates
  scheduler: util method to diff task groups
  nomad: helper struct func
  nomad: PopUpdate should minimize plan size
  nomad: adding helper to manipulate plans
  scheduler: share context and stack
  scheduler: allow updating the base nodes
  scheduler: allow StaticIterator to update base set
  scheduler: pull node shuffle into util
  nomad: adding node GC
  nomad: using Raft StartAsLeader to make tests faster
  ...
}

// compute and check checksum
if check, ok := task.Config["checksum"]; ok {
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice! This looks like a great piece we could reuse as a generic downloader.

@cbednarski
Copy link
Contributor

Looks awesome! 👍 for merge.

resp, err := http.Get(source)
if err != nil {
return nil, fmt.Errorf("Error downloading source for Qemu driver: %s", err)
}
Copy link
Member

Choose a reason for hiding this comment

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

I think we need a defer resp.Body.Close() here. If we don't explicitly close the body reader, we end up leaking file handles and eventually exhausting the OS of them.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Great catch, thanks!

end up leaking file handles and eventually exhausting the OS of them

Been there, not the most fun of times 😄

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed in 12903f7

@cbednarski
Copy link
Contributor

Merging so I can sync with this in some other updates. Nice job @catsby !

cbednarski added a commit that referenced this pull request Sep 10, 2015
Basic Qemu driver implementation
@cbednarski cbednarski merged commit e227e15 into master Sep 10, 2015
@armon armon deleted the qemu-driver branch September 18, 2015 04:32
schmichael pushed a commit that referenced this pull request Oct 12, 2017
benbuzbee pushed a commit to benbuzbee/nomad that referenced this pull request Jul 21, 2022
Clarify how Persist() is supposed to work.
@github-actions
Copy link

I'm going to lock this pull request because it has been closed for 120 days ⏳. This helps our maintainers find and focus on the active contributions.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 10, 2023
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.

3 participants