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

VMware-vagrant doesn't allow me to overwrite pciSlotNumber property for ethernet0 nor ethernet1 #7656

Closed
hectorj2f opened this issue Jul 27, 2016 · 2 comments

Comments

@hectorj2f
Copy link

I need to overwrite the value of the pciSlotNumber to 3 and 6 in order to bootstrap a VM with vmware and vagrant plugin. This VM should have two network interfaces whose names are ens3 and ens6. However I got the default ones which are ens33 and ens34.

In the following piece of code, I set the value for the pciSlotNumber:

      ["vmware_fusion", "vmware_workstation"].each do |vmware|
        config.vm.provider vmware do |v|

          v.gui = vm_gui
          v.vmx['memsize'] = vm_memory
          v.vmx['numvcpus'] = vm_cpus
          v.vmx["virtualhw.version"] ="8"
          v.vmx['hv.assumeEnabled'] = "TRUE"
          v.vmx['vhv.enable'] = "TRUE"
          v.vmx['allowNested'] = "TRUE"

          v.vmx["ethernet0.pciSlotNumber"] = "3"
          v.vmx["ethernet1.pciSlotNumber"] = "6"
        end
      end

Vagrant version

1.8.1

Host operating system

Ubuntu

Guest operating system

CoreOS

Debug

The logs of the vagrant up core-01 are available in the following gist:
https://gist.github.com/hectorj2f/cef6cf52c0ba0461ff16f9a1b54687a0

By looking at the logs, I could say that the VMX file is modified. However, if I follow the logs it seems that other values re-define the initial ones to 33 and 34, respectively.

Vagrantfile

Vagrant.configure("2") do |config|
  # always use Vagrants insecure key
  config.ssh.insert_key = false

  # enable vagrant-env plugin
  config.env.enable

  (1..$num_instances).each do |i|
    config.vm.define vm_name = "%s-%02d" % [$instance_name_prefix, i] do |config|
      config.vm.hostname = vm_name

      config.vm.box = "coreos-%s" % $update_channel
      if $image_version != "current"
          config.vm.box_version = $image_version
      end

      config.vm.box_url = "https://storage.googleapis.com/%s.release.core-os.net/amd64-usr/%s/coreos_production_vagrant.json" % [$update_channel, $image_version]

      ["vmware_fusion", "vmware_workstation"].each do |vmware|
        config.vm.provider vmware do |v, override|
          override.vm.box_url = "https://storage.googleapis.com/%s.release.core-os.net/amd64-usr/%s/coreos_production_vagrant_vmware_fusion.json" % [$update_channel, $image_version]
        end
      end

      if $enable_serial_logging
        logdir = File.join(File.dirname(__FILE__), "log")
        FileUtils.mkdir_p(logdir)

        serialFile = File.join(logdir, "%s-serial.txt" % vm_name)
        FileUtils.touch(serialFile)

        ["vmware_fusion", "vmware_workstation"].each do |vmware|
          config.vm.provider vmware do |v, override|
            v.vmx["serial0.present"] = "TRUE"
            v.vmx["serial0.fileType"] = "file"
            v.vmx["serial0.fileName"] = serialFile
            v.vmx["serial0.tryNoRxLoss"] = "FALSE"
          end
        end
      end

      if $expose_docker_tcp
        config.vm.network "forwarded_port", guest: 2375, host: ($expose_docker_tcp + i - 1), auto_correct: true
      end

      $forwarded_ports.each do |guest, host|
        config.vm.network "forwarded_port", guest: guest, host: host, auto_correct: true
      end

      ["vmware_fusion", "vmware_workstation"].each do |vmware|
        config.vm.provider vmware do |v|

          v.gui = vm_gui
          v.vmx['memsize'] = vm_memory
          v.vmx['numvcpus'] = vm_cpus
          v.vmx["virtualhw.version"] ="8"
          v.vmx['hv.assumeEnabled'] = "TRUE"
          v.vmx['vhv.enable'] = "TRUE"
          v.vmx['allowNested'] = "TRUE"

          v.vmx["ethernet0.pciSlotNumber"] = "3"
          v.vmx["ethernet1.pciSlotNumber"] = "6"
        end
      end

      ip_prefix = "172.17.8"
      if ENV[IP_PREFIX_ENV_VAR] != ""
        ip_prefix = ENV[IP_PREFIX_ENV_VAR]
      end
      ip = "#{ip_prefix}.#{i+100}"
      config.vm.network :private_network, ip: ip

      if File.exist?(CLOUD_CONFIG_PATH)
          # Copy the entire cloud config to the box.
          config.vm.provision :file, :source => "#{CLOUD_CONFIG_PATH}", :destination => "/tmp/vagrantfile-user-data"
          config.vm.provision :shell, :inline => "mv /tmp/vagrantfile-user-data /var/lib/coreos-vagrant/", :privileged => true
      end

      # Add a host unique fleet metadata field.
      config.vm.provision "shell" do |s|
          s.inline=$fleet_metadata_update
          s.args = "#{i}"
          s.name = "Fleet metadata update"
      end

    end
  end
end

Expected behavior

I'd like to have two network interfaces ens3 and ens6

Actual behavior

I get two network interfaces ens33 and ens34

@chrisroberts
Copy link
Member

Closing this (even though it is the earlier issue) and tracking it here: #8095

Thanks for the report!

@ghost
Copy link

ghost commented Apr 3, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@ghost ghost locked and limited conversation to collaborators Apr 3, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants