cloudfoundry-attic / bosh-lite

A lite development env for BOSH
Apache License 2.0
319 stars 244 forks source link

VM_MEMORY & VM_CORES removal #191

Closed gerhard closed 10 years ago

gerhard commented 10 years ago

Since 0fb94e46991516c84bbdd2fb08e24ac4b670f07c VM_CORES and VM_MEMORY configs have been removed from Vagrantfile. Running vagrant up on 6ff4cbdc58c3ba1fb7b9d3877644b413e680c35f gets us a 2GB & 4 core VM which is under-resourced to run cf alone, never-mind other bosh releases.

Is there a new way of starting a VM with more than the default 2GB of memory?

sykesm commented 10 years ago

The configurations live inside the vagrant box: https://github.com/cloudfoundry/bosh-lite/blob/master/templates/vagrant-local.tpl#L1:L2

You can export the environment variables or add overrides to your own vagrant file. If you're getting 2G instead of 6, you should make sure you're running reasonable recent levels of vagrant.

gerhard commented 10 years ago

We have the env variables already exported, we were on Vagrant 1.6.3, will be upgrading to 1.6.5 to see if it makes a difference.

When were vagrant.tpl's introduced?

sykesm commented 10 years ago

Same commit that you referenced (https://github.com/cloudfoundry/bosh-lite/commit/0fb94e46991516c84bbdd2fb08e24ac4b670f07c). The configuration was simply moved out of the "main" vagrantfile and into the box.

gerhard commented 10 years ago

Sorry, I should have been clearer: when were vagrant.tpl's introduced as a Vagrant feature? Is it even a Vagrant feature or is it a convention that bosh-lite is using?

Put simply, vagrant up --provider=vmware_fusion used to create a VMware VM with 4 CPUs and 6GB of RAM by default. This is no longer the case, we now get 2GB and 4 CPUs which is defined in https://github.com/cloudfoundry/bosh-lite/blob/master/templates/vmware.json#L52-L53. We were overriding the default VM memory with a VM_MEMORY env. This no longer works and the README doesn't suggest that the default vagrant up approach has changed.

sykesm commented 10 years ago

It's been there for quite some time and it's documented under the heading Load Order and Merging at http://docs.vagrantup.com/v2/vagrantfile/index.html. The first place vagrant looks for config is the Vagrantfile in the box.

I've verified that setting the environment variables and using overrides in the bosh-lite vagrantfile behave as expected.

cppforlife commented 10 years ago

We have also confirmed that cores/mem configuration works with vmware fusion provider. Are you verifying vm sizes through settings window from fusion ui?

sykesm commented 10 years ago

If you're using fusion, make sure you're using the latest plugin version or you might run into the config merging issue (https://github.com/mitchellh/vagrant/issues/3996).

gerhard commented 10 years ago

We are running VMware Fusion 6.0.3 on OS X 10.9.2. This is a step-by-step of what we are doing and seeing:

 |2.0.0-p451| piv-ws-archway in ~/workspace/bosh-lite
± gl+dj |master ✓| → git remote -v
origin  git@github.com:cloudfoundry/bosh-lite (fetch)
origin  git@github.com:cloudfoundry/bosh-lite (push)

 |2.0.0-p451| piv-ws-archway in ~/workspace/bosh-lite
± gl+dj |master ✓| → git log | head -1
commit 6ff4cbdc58c3ba1fb7b9d3877644b413e680c35f

|2.0.0-p451| piv-ws-archway in ~/workspace/bosh-lite
± gl+dj |master ✓| → echo $VM_MEMORY
10240

 |2.0.0-p451| piv-ws-archway in ~/workspace/bosh-lite
± gl+dj |master ✓| → vagrant -v
Vagrant 1.6.5

± gl+dj |master ✓| → vagrant plugin list
deep_merge (1.0.1)
vagrant-aws (0.5.0)
vagrant-bosh (0.0.5)
vagrant-login (1.0.1, system)
vagrant-omnibus (1.4.1)
vagrant-share (1.1.1, system)
vagrant-triggers (0.4.1)
vagrant-vmware-fusion (2.4.1)

± gl+dj |master ✓| → cat Vagrantfile
Vagrant.configure('2') do |config|
  config.vm.provider :virtualbox do |v, override|
    override.vm.box = 'bosh-lite-ubuntu-trusty-virtualbox-293'
    override.vm.box_url = 'http://d3a4sadvqj176z.cloudfront.net/bosh-lite-virtualbox-ubuntu-trusty-293.box'

    # To use a different IP address for the bosh-lite director, uncomment this line:
    # override.vm.network :private_network, ip: '192.168.59.4', id: :local
  end

  [:vmware_fusion, :vmware_desktop, :vmware_workstation].each do |provider|
    config.vm.provider provider do |v, override|
      override.vm.box = 'bosh-lite-ubuntu-trusty-vmware-15'
      override.vm.box_url = 'https://d3a4sadvqj176z.cloudfront.net/bosh-lite-vmware-ubuntu-trusty-15.box'

      # To use a different IP address for the bosh-lite director, uncomment this line:
      # override.vm.network :private_network, ip: '192.168.54.4', id: :local
    end
  end

  config.vm.provider :aws do |v, override|
    override.vm.box = 'bosh-lite-ubuntu-trusty-aws-174'
    override.vm.box_url = 'https://d3a4sadvqj176z.cloudfront.net/bosh-lite-aws-ubuntu-trusty-174.box'

    # To turn off public IP echoing, uncomment this line:
    # override.vm.provision :shell, id: "public_ip", run: "always", inline: "/bin/true"

    # To turn off CF port forwarding, uncomment this line:
    # override.vm.provision :shell, id: "port_forwarding", run: "always", inline: "/bin/true"
  end
end

± gl+dj |master ✓| → vagrant up
Bringing machine 'default' up with 'vmware_fusion' provider...
==> default: Cloning VMware VM: 'bosh-lite-ubuntu-trusty-vmware-15'. This can take some time...
==> default: Verifying vmnet devices are healthy...
==> default: Preparing network adapters...
==> default: Starting the VMware VM...
==> default: Waiting for the VM to finish booting...
==> default: The machine is booted and ready!
==> default: Forwarding ports...
    default: -- 22 => 2222
==> default: Setting hostname...
==> default: Configuring network adapters within the VM...
==> default: Waiting for HGFS kernel module to load...
==> default: Enabling and configuring shared folders...
    default: -- /Users/pivotal/workspace/bosh-lite: /vagrant

 |2.0.0-p451| piv-ws-archway in ~/workspace/bosh-lite
± gl+dj |master ✓| → vagrant ssh
Welcome to Ubuntu 14.04 LTS (GNU/Linux 3.13.0-35-generic x86_64)

 * Documentation:  https://help.ubuntu.com/
vagrant@bosh-lite:~$ cat /proc/meminfo
MemTotal:        2049704 kB
MemFree:         1507588 kB

What are we missing?

sykesm commented 10 years ago

Did you do a vagrant plugin update? It doesn't look like it:

vagrant plugin list
...
vagrant-vmware-fusion (2.4.1)

The README calls out the following explicitly as a known working version and you're behind that:

$ vagrant plugin list | grep vmware-fusion
vagrant-vmware-fusion (2.5.2)
gerhard commented 10 years ago

Upgrading the vagrant-vmware-fusion plugin to 3.0.1 fixed it, cheers.