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

Adding support to ContainerizedVM #333

Merged
merged 4 commits into from
Jun 26, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 17 additions & 6 deletions perfkitbenchmarker/benchmark_spec.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
from perfkitbenchmarker.digitalocean import digitalocean_network
from perfkitbenchmarker.digitalocean import digitalocean_virtual_machine
from perfkitbenchmarker.gcp import gce_network
from perfkitbenchmarker.gcp import gce_virtual_machine
from perfkitbenchmarker.gcp import gce_virtual_machine as gce_vm

GCP = 'GCP'
AZURE = 'Azure'
Expand All @@ -42,6 +42,7 @@
DEBIAN = 'debian'
RHEL = 'rhel'
WINDOWS = 'windows'
UBUNTU_CONTAINER = 'ubuntu_container'
IMAGE = 'image'
WINDOWS_IMAGE = 'windows_image'
MACHINE_TYPE = 'machine_type'
Expand All @@ -52,9 +53,10 @@
CLASSES = {
GCP: {
VIRTUAL_MACHINE: {
DEBIAN: gce_virtual_machine.DebianBasedGceVirtualMachine,
RHEL: gce_virtual_machine.RhelBasedGceVirtualMachine,
WINDOWS: gce_virtual_machine.WindowsGceVirtualMachine
DEBIAN: gce_vm.DebianBasedGceVirtualMachine,
RHEL: gce_vm.RhelBasedGceVirtualMachine,
UBUNTU_CONTAINER: gce_vm.ContainerizedGceVirtualMachine,
WINDOWS: gce_vm.WindowsGceVirtualMachine
},
FIREWALL: gce_network.GceFirewall
},
Expand Down Expand Up @@ -88,12 +90,16 @@
flags.DEFINE_enum('cloud', GCP, [GCP, AZURE, AWS, DIGITALOCEAN],
'Name of the cloud to use.')
flags.DEFINE_enum(
'os_type', DEBIAN, [DEBIAN, RHEL, WINDOWS],
'os_type', DEBIAN, [DEBIAN, RHEL, UBUNTU_CONTAINER, WINDOWS],
'The VM\'s OS type. Ubuntu\'s os_type is "debian" because it is largely '
'built on Debian and uses the same package manager. Likewise, CentOS\'s '
'os_type is "rhel". In general if two OS\'s use the same package manager, '
'and are otherwise very similar, the same os_type should work on both of '
'them.')
flags.DEFINE_string('scratch_dir', '/scratch',
'Base name for all scratch disk directories in the VM.'
'Upon creation, these directories will have numbers'
'appended to them (for example /scratch0, /scratch1, etc).')


class BenchmarkSpec(object):
Expand Down Expand Up @@ -160,9 +166,10 @@ def __init__(self, benchmark_info):
else:
num_striped_disks = FLAGS.num_striped_disks
for i in range(benchmark_info['scratch_disk']):
mount_point = '%s%d' % (FLAGS.scratch_dir, i)
disk_spec = disk.BaseDiskSpec(
self.scratch_disk_size, self.scratch_disk_type,
'/scratch%d' % i, self.scratch_disk_iops,
mount_point, self.scratch_disk_iops,
num_striped_disks)
vm.disk_specs.append(disk_spec)

Expand Down Expand Up @@ -294,6 +301,10 @@ def PrepareVm(self, vm, firewall):
for disk_spec in vm.disk_specs:
vm.CreateScratchDisk(disk_spec)

# This must come after Scratch Disk creation to support the
# Containerized VM case
vm.PrepareVMEnvironment()

def DeleteVm(self, vm):
"""Deletes a single vm and scratch disk if required.

Expand Down
5 changes: 4 additions & 1 deletion perfkitbenchmarker/benchmarks/bonnie_benchmark.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,10 @@
FLAGS = flags.FLAGS

BENCHMARK_INFO = {'name': 'bonnie++',
'description': 'Runs Bonnie++.',
'description': 'Runs Bonnie++. Running this benchmark inside '
'a container is currently not supported, '
'since Docker tries to run it as root, which '
'is not recommended.',
'scratch_disk': True,
'num_machines': 1}

Expand Down
3 changes: 2 additions & 1 deletion perfkitbenchmarker/benchmarks/cassandra_stress_benchmark.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,11 @@ def Prepare(benchmark_spec):
'1 loader node, 3 data nodes')
vm_dict[LOADER_NODE] = [vm_dict['default'][-1]]
vm_dict[DATA_NODE] = vm_dict['default'][:3]
mount_point = os.path.join(vm_util.VM_TMP_DIR, 'cassandra_data')
disk_spec = disk.BaseDiskSpec(
FLAGS.scratch_disk_size,
FLAGS.scratch_disk_type,
'/cassandra_data')
mount_point)
for vm in vm_dict[DATA_NODE]:
vm.CreateScratchDisk(disk_spec)

Expand Down
11 changes: 8 additions & 3 deletions perfkitbenchmarker/gcp/gce_virtual_machine.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
from perfkitbenchmarker import disk
from perfkitbenchmarker import errors
from perfkitbenchmarker import flags
from perfkitbenchmarker import linux_virtual_machine
from perfkitbenchmarker import linux_virtual_machine as linux_vm
from perfkitbenchmarker import virtual_machine
from perfkitbenchmarker import vm_util
from perfkitbenchmarker import windows_virtual_machine
Expand Down Expand Up @@ -223,13 +223,18 @@ def AddMetadata(self, **kwargs):
vm_util.IssueCommand(cmd)


class ContainerizedGceVirtualMachine(GceVirtualMachine,
linux_vm.ContainerizedDebianMixin):
DEFAULT_IMAGE = UBUNTU_IMAGE


class DebianBasedGceVirtualMachine(GceVirtualMachine,
linux_virtual_machine.DebianMixin):
linux_vm.DebianMixin):
DEFAULT_IMAGE = UBUNTU_IMAGE


class RhelBasedGceVirtualMachine(GceVirtualMachine,
linux_virtual_machine.RhelMixin):
linux_vm.RhelMixin):
DEFAULT_IMAGE = RHEL_IMAGE


Expand Down
Loading