2014-03-04 02:08:51 +08:00
|
|
|
# -*- mode: ruby -*-
|
|
|
|
# vi: set ft=ruby :
|
|
|
|
|
2015-02-24 07:07:15 +08:00
|
|
|
require 'yaml'
|
2014-11-05 23:40:36 +08:00
|
|
|
VAGRANTFILE_API_VERSION = '2'
|
2014-03-04 02:08:51 +08:00
|
|
|
|
2015-02-24 07:07:15 +08:00
|
|
|
config_file=File.expand_path(File.join(File.dirname(__FILE__), 'vagrant_variables.yml'))
|
|
|
|
settings=YAML.load_file(config_file)
|
|
|
|
|
2016-07-12 18:15:22 +08:00
|
|
|
NMONS = settings['mon_vms']
|
|
|
|
NOSDS = settings['osd_vms']
|
|
|
|
NMDSS = settings['mds_vms']
|
|
|
|
NRGWS = settings['rgw_vms']
|
|
|
|
NNFSS = settings['nfs_vms']
|
|
|
|
RESTAPI = settings['restapi']
|
|
|
|
NRBD_MIRRORS = settings['rbd_mirror_vms']
|
|
|
|
CLIENTS = settings['client_vms']
|
2016-08-26 21:22:47 +08:00
|
|
|
NISCSI_GWS = settings['iscsi_gw_vms']
|
2016-07-12 18:15:22 +08:00
|
|
|
SUBNET = settings['subnet']
|
|
|
|
BOX = settings['vagrant_box']
|
|
|
|
BOX_URL = settings['vagrant_box_url']
|
2016-08-10 03:32:52 +08:00
|
|
|
SYNC_DIR = settings['vagrant_sync_dir']
|
2016-07-12 18:15:22 +08:00
|
|
|
MEMORY = settings['memory']
|
|
|
|
STORAGECTL = settings['vagrant_storagectl']
|
|
|
|
ETH = settings['eth']
|
|
|
|
DOCKER = settings['docker']
|
2014-05-11 09:52:26 +08:00
|
|
|
|
2016-01-26 03:28:10 +08:00
|
|
|
if BOX == 'openstack'
|
|
|
|
require 'vagrant-openstack-provider'
|
|
|
|
OSVM = true
|
|
|
|
USER = settings['os_ssh_username']
|
2016-05-24 07:30:27 +08:00
|
|
|
OSUSER = settings['os_username']
|
|
|
|
OSPREFIX = "#{OSUSER}-"
|
2016-01-26 03:28:10 +08:00
|
|
|
else
|
|
|
|
OSVM = false
|
2016-05-24 07:30:27 +08:00
|
|
|
OSPREFIX = ""
|
2016-01-26 03:28:10 +08:00
|
|
|
end
|
|
|
|
|
2014-11-05 23:40:36 +08:00
|
|
|
ansible_provision = proc do |ansible|
|
2016-02-08 05:30:32 +08:00
|
|
|
if DOCKER then
|
|
|
|
ansible.playbook = 'site-docker.yml'
|
2016-01-26 03:28:10 +08:00
|
|
|
if settings['skip_tags']
|
|
|
|
ansible.skip_tags = settings['skip_tags']
|
|
|
|
end
|
2016-02-08 05:30:32 +08:00
|
|
|
else
|
|
|
|
ansible.playbook = 'site.yml'
|
|
|
|
end
|
|
|
|
|
2014-05-11 09:52:26 +08:00
|
|
|
# Note: Can't do ranges like mon[0-2] in groups because
|
|
|
|
# these aren't supported by Vagrant, see
|
|
|
|
# https://github.com/mitchellh/vagrant/issues/3539
|
|
|
|
ansible.groups = {
|
2016-07-12 18:15:22 +08:00
|
|
|
'mons' => (0..NMONS - 1).map { |j| "#{OSPREFIX}mon#{j}" },
|
|
|
|
'osds' => (0..NOSDS - 1).map { |j| "#{OSPREFIX}osd#{j}" },
|
|
|
|
'mdss' => (0..NMDSS - 1).map { |j| "#{OSPREFIX}mds#{j}" },
|
|
|
|
'rgws' => (0..NRGWS - 1).map { |j| "#{OSPREFIX}rgw#{j}" },
|
|
|
|
'nfss' => (0..NNFSS - 1).map { |j| "#{OSPREFIX}nfs#{j}" },
|
|
|
|
'rbd_mirrors' => (0..NRBD_MIRRORS - 1).map { |j| "#{OSPREFIX}rbd_mirror#{j}" },
|
2016-08-26 21:22:47 +08:00
|
|
|
'clients' => (0..CLIENTS - 1).map { |j| "#{OSPREFIX}client#{j}" },
|
|
|
|
'iscsi_gw' => (0..NISCSI_GWS - 1).map { |j| "#{OSPREFIX}iscsi_gw#{j}" }
|
2014-05-11 09:52:26 +08:00
|
|
|
}
|
|
|
|
|
2016-04-29 22:07:10 +08:00
|
|
|
if RESTAPI then
|
2016-05-24 07:30:27 +08:00
|
|
|
ansible.groups['restapis'] = (0..NMONS - 1).map { |j| "#{OSPREFIX}mon#{j}" }
|
2016-04-29 22:07:10 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
|
2014-11-14 22:03:50 +08:00
|
|
|
# In a production deployment, these should be secret
|
2016-02-08 05:30:32 +08:00
|
|
|
if DOCKER then
|
|
|
|
ansible.extra_vars = {
|
|
|
|
mon_containerized_deployment: 'true',
|
|
|
|
osd_containerized_deployment: 'true',
|
|
|
|
mds_containerized_deployment: 'true',
|
|
|
|
rgw_containerized_deployment: 'true',
|
2016-05-06 02:20:03 +08:00
|
|
|
nfs_containerized_deployment: 'true',
|
2016-02-08 05:30:32 +08:00
|
|
|
restapi_containerized_deployment: 'true',
|
2016-07-12 18:15:22 +08:00
|
|
|
rbd_mirror_containerized_deployment: 'true',
|
2016-02-08 05:30:32 +08:00
|
|
|
ceph_mon_docker_interface: ETH,
|
|
|
|
ceph_mon_docker_subnet: "#{SUBNET}.0/24",
|
2016-08-23 23:24:40 +08:00
|
|
|
ceph_osd_docker_extra_env: "CEPH_DAEMON=OSD_CEPH_DISK_ACTIVATE,OSD_JOURNAL_SIZE=100",
|
2016-05-24 07:30:27 +08:00
|
|
|
cluster_network: "#{SUBNET}.0/24",
|
|
|
|
public_network: "#{SUBNET}.0/24",
|
2016-02-12 00:57:10 +08:00
|
|
|
ceph_osd_docker_devices: settings['disks'],
|
2016-04-26 23:20:02 +08:00
|
|
|
# Note that OSVM is defaulted to false above
|
|
|
|
ceph_docker_on_openstack: OSVM,
|
2016-08-23 21:35:54 +08:00
|
|
|
ceph_rgw_civetweb_port: 8080,
|
2016-08-23 23:24:40 +08:00
|
|
|
generate_fsid: 'true',
|
|
|
|
journal_size: 100,
|
2016-02-08 05:30:32 +08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
ansible.extra_vars = {
|
2016-03-07 21:05:01 +08:00
|
|
|
"ceph_#{settings['ceph_install_source']}"=> 'true',
|
2016-02-08 05:30:32 +08:00
|
|
|
journal_collocation: 'true',
|
2016-04-05 22:24:21 +08:00
|
|
|
pool_default_size: '2',
|
2016-02-08 05:30:32 +08:00
|
|
|
journal_size: 100,
|
|
|
|
monitor_interface: ETH,
|
|
|
|
cluster_network: "#{SUBNET}.0/24",
|
|
|
|
public_network: "#{SUBNET}.0/24",
|
|
|
|
devices: settings['disks'],
|
|
|
|
os_tuning_params: settings['os_tuning_params']
|
|
|
|
}
|
|
|
|
end
|
2014-05-11 09:52:26 +08:00
|
|
|
ansible.limit = 'all'
|
|
|
|
end
|
|
|
|
|
2014-08-16 17:03:16 +08:00
|
|
|
def create_vmdk(name, size)
|
|
|
|
dir = Pathname.new(__FILE__).expand_path.dirname
|
|
|
|
path = File.join(dir, '.vagrant', name + '.vmdk')
|
2014-11-10 20:33:21 +08:00
|
|
|
`vmware-vdiskmanager -c -s #{size} -t 0 -a scsi #{path} \
|
|
|
|
2>&1 > /dev/null` unless File.exist?(path)
|
2014-08-16 17:03:16 +08:00
|
|
|
end
|
2014-03-04 02:08:51 +08:00
|
|
|
|
2014-08-16 17:03:16 +08:00
|
|
|
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
|
2015-03-30 17:45:22 +08:00
|
|
|
config.vm.box = BOX
|
2016-06-21 03:07:37 +08:00
|
|
|
config.vm.box_url = BOX_URL
|
2015-01-06 23:23:43 +08:00
|
|
|
config.ssh.insert_key = false # workaround for https://github.com/mitchellh/vagrant/issues/5048
|
2014-05-11 09:52:26 +08:00
|
|
|
|
2015-12-03 06:59:52 +08:00
|
|
|
# Faster bootup. Disable if you need this for libvirt
|
|
|
|
config.vm.provider :libvirt do |v,override|
|
2016-08-10 03:32:52 +08:00
|
|
|
override.vm.synced_folder '.', SYNC_DIR, disabled: true
|
2015-12-03 06:59:52 +08:00
|
|
|
end
|
|
|
|
|
2016-01-26 03:28:10 +08:00
|
|
|
if BOX == 'openstack'
|
|
|
|
# OpenStack VMs
|
|
|
|
config.vm.provider :openstack do |os|
|
|
|
|
config.vm.synced_folder ".", "/home/#{USER}/vagrant", disabled: true
|
|
|
|
config.ssh.username = USER
|
|
|
|
config.ssh.private_key_path = settings['os_ssh_private_key_path']
|
|
|
|
config.ssh.pty = true
|
|
|
|
os.openstack_auth_url = settings['os_openstack_auth_url']
|
|
|
|
os.username = settings['os_username']
|
|
|
|
os.password = settings['os_password']
|
|
|
|
os.tenant_name = settings['os_tenant_name']
|
|
|
|
os.region = settings['os_region']
|
|
|
|
os.flavor = settings['os_flavor']
|
|
|
|
os.image = settings['os_image']
|
|
|
|
os.keypair_name = settings['os_keypair_name']
|
|
|
|
os.security_groups = ['default']
|
|
|
|
config.vm.provision "shell", inline: "true", upload_path: "/home/#{USER}/vagrant-shell"
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2014-11-20 04:27:56 +08:00
|
|
|
(0..CLIENTS - 1).each do |i|
|
2016-05-24 07:30:27 +08:00
|
|
|
config.vm.define "#{OSPREFIX}client#{i}" do |client|
|
|
|
|
client.vm.hostname = "#{OSPREFIX}ceph-client#{i}"
|
2016-01-26 03:28:10 +08:00
|
|
|
if !OSVM
|
|
|
|
client.vm.network :private_network, ip: "#{SUBNET}.4#{i}"
|
|
|
|
end
|
2015-12-03 06:59:52 +08:00
|
|
|
# Virtualbox
|
2014-11-20 04:27:56 +08:00
|
|
|
client.vm.provider :virtualbox do |vb|
|
2015-04-28 01:01:02 +08:00
|
|
|
vb.customize ['modifyvm', :id, '--memory', "#{MEMORY}"]
|
2014-11-20 04:27:56 +08:00
|
|
|
end
|
2015-12-03 06:59:52 +08:00
|
|
|
|
|
|
|
# VMware
|
2014-11-20 04:27:56 +08:00
|
|
|
client.vm.provider :vmware_fusion do |v|
|
2015-04-28 01:01:02 +08:00
|
|
|
v.vmx['memsize'] = "#{MEMORY}"
|
2014-11-20 04:27:56 +08:00
|
|
|
end
|
2015-12-03 06:59:52 +08:00
|
|
|
|
|
|
|
# Libvirt
|
|
|
|
client.vm.provider :libvirt do |lv|
|
|
|
|
lv.memory = MEMORY
|
|
|
|
end
|
2016-02-18 19:58:33 +08:00
|
|
|
|
|
|
|
# Parallels
|
|
|
|
client.vm.provider "parallels" do |prl|
|
|
|
|
prl.name = "ceph-client#{i}"
|
|
|
|
prl.memory = "#{MEMORY}"
|
|
|
|
end
|
2014-11-20 04:27:56 +08:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2014-11-06 19:15:25 +08:00
|
|
|
(0..NRGWS - 1).each do |i|
|
2016-05-24 07:30:27 +08:00
|
|
|
config.vm.define "#{OSPREFIX}rgw#{i}" do |rgw|
|
|
|
|
rgw.vm.hostname = "#{OSPREFIX}ceph-rgw#{i}"
|
2016-01-26 03:28:10 +08:00
|
|
|
if !OSVM
|
|
|
|
rgw.vm.network :private_network, ip: "#{SUBNET}.5#{i}"
|
|
|
|
end
|
2015-12-03 06:59:52 +08:00
|
|
|
|
|
|
|
# Virtualbox
|
2014-11-10 20:33:21 +08:00
|
|
|
rgw.vm.provider :virtualbox do |vb|
|
2015-04-28 01:01:02 +08:00
|
|
|
vb.customize ['modifyvm', :id, '--memory', "#{MEMORY}"]
|
2014-11-10 20:33:21 +08:00
|
|
|
end
|
2015-12-03 06:59:52 +08:00
|
|
|
|
|
|
|
# VMware
|
2014-11-10 20:33:21 +08:00
|
|
|
rgw.vm.provider :vmware_fusion do |v|
|
2015-04-28 01:01:02 +08:00
|
|
|
v.vmx['memsize'] = "#{MEMORY}"
|
2014-11-10 20:33:21 +08:00
|
|
|
end
|
2015-12-03 06:59:52 +08:00
|
|
|
|
|
|
|
# Libvirt
|
|
|
|
rgw.vm.provider :libvirt do |lv|
|
|
|
|
lv.memory = MEMORY
|
|
|
|
end
|
2016-02-18 19:58:33 +08:00
|
|
|
|
|
|
|
# Parallels
|
|
|
|
rgw.vm.provider "parallels" do |prl|
|
|
|
|
prl.name = "ceph-rgw#{i}"
|
|
|
|
prl.memory = "#{MEMORY}"
|
|
|
|
end
|
2014-11-10 20:33:21 +08:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2016-05-06 02:20:03 +08:00
|
|
|
(0..NNFSS - 1).each do |i|
|
|
|
|
config.vm.define "nfs#{i}" do |nfs|
|
|
|
|
nfs.vm.hostname = "ceph-nfs#{i}"
|
|
|
|
if !OSVM
|
|
|
|
nfs.vm.network :private_network, ip: "#{SUBNET}.6#{i}"
|
|
|
|
end
|
|
|
|
|
|
|
|
# Virtualbox
|
|
|
|
nfs.vm.provider :virtualbox do |vb|
|
|
|
|
vb.customize ['modifyvm', :id, '--memory', "#{MEMORY}"]
|
|
|
|
end
|
|
|
|
|
|
|
|
# VMware
|
|
|
|
nfs.vm.provider :vmware_fusion do |v|
|
|
|
|
v.vmx['memsize'] = "#{MEMORY}"
|
|
|
|
end
|
|
|
|
|
|
|
|
# Libvirt
|
|
|
|
nfs.vm.provider :libvirt do |lv|
|
|
|
|
lv.memory = MEMORY
|
|
|
|
end
|
|
|
|
|
|
|
|
# Parallels
|
|
|
|
nfs.vm.provider "parallels" do |prl|
|
|
|
|
prl.name = "ceph-nfs#{i}"
|
|
|
|
prl.memory = "#{MEMORY}"
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2014-11-10 20:33:21 +08:00
|
|
|
(0..NMDSS - 1).each do |i|
|
2016-05-24 07:30:27 +08:00
|
|
|
config.vm.define "#{OSPREFIX}mds#{i}" do |mds|
|
|
|
|
mds.vm.hostname = "#{OSPREFIX}ceph-mds#{i}"
|
2016-01-26 03:28:10 +08:00
|
|
|
if !OSVM
|
|
|
|
mds.vm.network :private_network, ip: "#{SUBNET}.7#{i}"
|
|
|
|
end
|
2015-12-03 06:59:52 +08:00
|
|
|
# Virtualbox
|
|
|
|
mds.vm.provider :virtualbox do |vb|
|
2015-04-28 01:01:02 +08:00
|
|
|
vb.customize ['modifyvm', :id, '--memory', "#{MEMORY}"]
|
2014-11-06 19:15:25 +08:00
|
|
|
end
|
2015-12-03 06:59:52 +08:00
|
|
|
|
|
|
|
# VMware
|
|
|
|
mds.vm.provider :vmware_fusion do |v|
|
2015-04-28 01:01:02 +08:00
|
|
|
v.vmx['memsize'] = "#{MEMORY}"
|
2014-11-06 19:15:25 +08:00
|
|
|
end
|
2015-12-03 06:59:52 +08:00
|
|
|
|
|
|
|
# Libvirt
|
|
|
|
mds.vm.provider :libvirt do |lv|
|
|
|
|
lv.memory = MEMORY
|
|
|
|
end
|
2016-02-18 19:58:33 +08:00
|
|
|
# Parallels
|
|
|
|
mds.vm.provider "parallels" do |prl|
|
|
|
|
prl.name = "ceph-mds#{i}"
|
|
|
|
prl.memory = "#{MEMORY}"
|
|
|
|
end
|
2014-08-16 17:03:16 +08:00
|
|
|
end
|
2014-03-06 20:54:37 +08:00
|
|
|
end
|
|
|
|
|
2016-07-12 18:15:22 +08:00
|
|
|
(0..NRBD_MIRRORS - 1).each do |i|
|
|
|
|
config.vm.define "#{OSPREFIX}rbd_mirror#{i}" do |rbd_mirror|
|
|
|
|
rbd_mirror.vm.hostname = "#{OSPREFIX}ceph-rbd-mirror#{i}"
|
|
|
|
if !OSVM
|
|
|
|
rbd_mirror.vm.network :private_network, ip: "#{SUBNET}.8#{i}"
|
|
|
|
end
|
|
|
|
# Virtualbox
|
|
|
|
rbd_mirror.vm.provider :virtualbox do |vb|
|
|
|
|
vb.customize ['modifyvm', :id, '--memory', "#{MEMORY}"]
|
|
|
|
end
|
|
|
|
|
|
|
|
# VMware
|
|
|
|
rbd_mirror.vm.provider :vmware_fusion do |v|
|
|
|
|
v.vmx['memsize'] = "#{MEMORY}"
|
|
|
|
end
|
|
|
|
|
|
|
|
# Libvirt
|
|
|
|
rbd_mirror.vm.provider :libvirt do |lv|
|
|
|
|
lv.memory = MEMORY
|
|
|
|
end
|
|
|
|
# Parallels
|
|
|
|
rbd_mirror.vm.provider "parallels" do |prl|
|
|
|
|
prl.name = "ceph-rbd-mirror#{i}"
|
|
|
|
prl.memory = "#{MEMORY}"
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2016-08-26 21:22:47 +08:00
|
|
|
(0..NISCSI_GWS - 1).each do |i|
|
|
|
|
config.vm.define "#{OSPREFIX}iscsi_gw#{i}" do |iscsi_gw|
|
|
|
|
iscsi_gw.vm.hostname = "#{OSPREFIX}ceph-iscsi-gw#{i}"
|
|
|
|
if !OSVM
|
|
|
|
iscsi_gw.vm.network :private_network, ip: "#{SUBNET}.9#{i}"
|
|
|
|
end
|
|
|
|
# Virtualbox
|
|
|
|
iscsi_gw.vm.provider :virtualbox do |vb|
|
|
|
|
vb.customize ['modifyvm', :id, '--memory', "#{MEMORY}"]
|
|
|
|
end
|
|
|
|
|
|
|
|
# VMware
|
|
|
|
iscsi_gw.vm.provider :vmware_fusion do |v|
|
|
|
|
v.vmx['memsize'] = "#{MEMORY}"
|
|
|
|
end
|
|
|
|
|
|
|
|
# Libvirt
|
|
|
|
iscsi_gw.vm.provider :libvirt do |lv|
|
|
|
|
lv.memory = MEMORY
|
|
|
|
end
|
|
|
|
# Parallels
|
|
|
|
iscsi_gw.vm.provider "parallels" do |prl|
|
|
|
|
prl.name = "ceph-iscsi-gw#{i}"
|
|
|
|
prl.memory = "#{MEMORY}"
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2014-11-05 23:40:36 +08:00
|
|
|
(0..NMONS - 1).each do |i|
|
2016-05-24 07:30:27 +08:00
|
|
|
config.vm.define "#{OSPREFIX}mon#{i}" do |mon|
|
|
|
|
mon.vm.hostname = "#{OSPREFIX}ceph-mon#{i}"
|
2016-01-26 03:28:10 +08:00
|
|
|
if !OSVM
|
|
|
|
mon.vm.network :private_network, ip: "#{SUBNET}.1#{i}"
|
|
|
|
end
|
2015-12-03 06:59:52 +08:00
|
|
|
# Virtualbox
|
2014-03-14 17:47:06 +08:00
|
|
|
mon.vm.provider :virtualbox do |vb|
|
2015-04-28 01:01:02 +08:00
|
|
|
vb.customize ['modifyvm', :id, '--memory', "#{MEMORY}"]
|
2014-03-14 17:47:06 +08:00
|
|
|
end
|
2015-12-03 06:59:52 +08:00
|
|
|
|
|
|
|
# VMware
|
2014-08-16 17:03:16 +08:00
|
|
|
mon.vm.provider :vmware_fusion do |v|
|
2015-04-28 01:01:02 +08:00
|
|
|
v.vmx['memsize'] = "#{MEMORY}"
|
2014-08-16 17:03:16 +08:00
|
|
|
end
|
2015-12-03 06:59:52 +08:00
|
|
|
|
|
|
|
# Libvirt
|
|
|
|
mon.vm.provider :libvirt do |lv|
|
|
|
|
lv.memory = MEMORY
|
|
|
|
end
|
2016-02-18 19:58:33 +08:00
|
|
|
|
|
|
|
# Parallels
|
|
|
|
mon.vm.provider "parallels" do |prl|
|
|
|
|
prl.name = "ceph-mon#{i}"
|
|
|
|
prl.memory = "#{MEMORY}"
|
|
|
|
end
|
2014-03-04 02:08:51 +08:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2014-11-05 23:40:36 +08:00
|
|
|
(0..NOSDS - 1).each do |i|
|
2016-05-24 07:30:27 +08:00
|
|
|
config.vm.define "#{OSPREFIX}osd#{i}" do |osd|
|
|
|
|
osd.vm.hostname = "#{OSPREFIX}ceph-osd#{i}"
|
2016-01-26 03:28:10 +08:00
|
|
|
if !OSVM
|
|
|
|
osd.vm.network :private_network, ip: "#{SUBNET}.10#{i}"
|
|
|
|
osd.vm.network :private_network, ip: "#{SUBNET}.20#{i}"
|
|
|
|
end
|
2015-12-03 06:59:52 +08:00
|
|
|
# Virtualbox
|
2014-08-16 17:03:16 +08:00
|
|
|
osd.vm.provider :virtualbox do |vb|
|
2014-09-03 06:08:06 +08:00
|
|
|
(0..1).each do |d|
|
2014-11-10 20:33:21 +08:00
|
|
|
vb.customize ['createhd',
|
|
|
|
'--filename', "disk-#{i}-#{d}",
|
2016-03-13 04:36:57 +08:00
|
|
|
'--size', '11000'] unless File.exist?("disk-#{i}-#{d}.vdi")
|
2015-01-20 01:20:01 +08:00
|
|
|
# Controller names are dependent on the VM being built.
|
|
|
|
# It is set when the base box is made in our case ubuntu/trusty64.
|
|
|
|
# Be careful while changing the box.
|
2014-11-10 20:33:21 +08:00
|
|
|
vb.customize ['storageattach', :id,
|
2015-08-27 17:24:53 +08:00
|
|
|
'--storagectl', STORAGECTL,
|
2014-11-10 20:33:21 +08:00
|
|
|
'--port', 3 + d,
|
|
|
|
'--device', 0,
|
|
|
|
'--type', 'hdd',
|
|
|
|
'--medium', "disk-#{i}-#{d}.vdi"]
|
2014-03-04 02:08:51 +08:00
|
|
|
end
|
2015-04-28 01:01:02 +08:00
|
|
|
vb.customize ['modifyvm', :id, '--memory', "#{MEMORY}"]
|
2014-08-16 17:03:16 +08:00
|
|
|
end
|
2015-12-03 06:59:52 +08:00
|
|
|
|
|
|
|
# VMware
|
2014-08-16 17:03:16 +08:00
|
|
|
osd.vm.provider :vmware_fusion do |v|
|
2014-09-03 06:08:06 +08:00
|
|
|
(0..1).each do |d|
|
2014-11-05 23:40:36 +08:00
|
|
|
v.vmx["scsi0:#{d + 1}.present"] = 'TRUE'
|
2014-11-10 20:33:21 +08:00
|
|
|
v.vmx["scsi0:#{d + 1}.fileName"] =
|
|
|
|
create_vmdk("disk-#{i}-#{d}", '11000MB')
|
2014-08-16 17:03:16 +08:00
|
|
|
end
|
2015-04-28 01:01:02 +08:00
|
|
|
v.vmx['memsize'] = "#{MEMORY}"
|
2014-03-04 02:08:51 +08:00
|
|
|
end
|
2014-05-11 09:52:26 +08:00
|
|
|
|
2015-12-03 06:59:52 +08:00
|
|
|
# Libvirt
|
|
|
|
driverletters = ('b'..'z').to_a
|
|
|
|
osd.vm.provider :libvirt do |lv|
|
|
|
|
(0..1).each do |d|
|
|
|
|
lv.storage :file, :device => "vd#{driverletters[d]}", :path => "disk-#{i}-#{d}.disk", :size => '11G'
|
|
|
|
end
|
|
|
|
lv.memory = MEMORY
|
|
|
|
end
|
|
|
|
|
2016-02-18 19:58:33 +08:00
|
|
|
# Parallels
|
|
|
|
osd.vm.provider "parallels" do |prl|
|
|
|
|
prl.name = "ceph-osd#{i}"
|
|
|
|
prl.memory = "#{MEMORY}"
|
|
|
|
(0..1).each do |d|
|
2016-01-26 03:28:10 +08:00
|
|
|
prl.customize ["set", :id,
|
|
|
|
"--device-add",
|
|
|
|
"hdd",
|
|
|
|
"--iface",
|
2016-02-18 19:58:33 +08:00
|
|
|
"sata"]
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2014-05-11 09:52:26 +08:00
|
|
|
# Run the provisioner after the last machine comes up
|
2014-11-05 23:40:36 +08:00
|
|
|
osd.vm.provision 'ansible', &ansible_provision if i == (NOSDS - 1)
|
2014-03-04 02:08:51 +08:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|