Skip to content

Instantly share code, notes, and snippets.

@boris-42
Last active August 29, 2015 14:04
Show Gist options
  • Save boris-42/260f11e8383969822b89 to your computer and use it in GitHub Desktop.
Save boris-42/260f11e8383969822b89 to your computer and use it in GitHub Desktop.
# This should be in context/vm/base.py
class VMBenchmarkImagePrepare(base.Context):
def _prepare(self):
pass
def setup(self):
# run VM with image
# wait unit it starts
self._prepare()
# make snapshot and store in context info
# delete VM
def cleanup(self):
# delete created snapshot
# This should be scenario/vm/base.py
class BenchamrkInVM(base.Scenario):
def benchmark(*args, **kwargs):
# if we have a standard way of triggering benchmark and fetching
# results, that should be provided by _prepare() then we can have here
# one method that can be reused.
# create VM from snapshot that is provided by benchmark in vm context
# trigger it
# wait unit it is finished
# fetch results
# delete VM
# return results
# this should be done in scenario/vm/blogbench.py
class BlogBenchContext(VMBenchmarkImagePrepare):
def _prepare(self):
# DO all operations with VM that are required
# here you have SSH access to it, and guarantee of access to it.
class BlogBenchScenario(BenchamrkInVM)
@validation.requied_context("BlogBenchContext")
@scenario(context={"keypair": {}, "secgroup": {}})
def benchamrk(*args, **kwargs):
super(self).benchmark(*args, **kwargs)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment