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

Network disconnected on virtual machine creation #34

Open
geoff-carr-bzy opened this issue May 17, 2017 · 3 comments
Open

Network disconnected on virtual machine creation #34

geoff-carr-bzy opened this issue May 17, 2017 · 3 comments

Comments

@geoff-carr-bzy
Copy link

Versions:

  • Version of Chef-Provisioning: 2.2.1
  • Version of Chef-Provisioning-vSphere: 2.0.2

Platform Details

  • Version of vSphere/vCenter: 5.5.0, 418647
  • Version of ESXi: 5.5.0, 356722

Scenario:

Trying to deploy / clone a Windows Server 2012 R2 virtual machine from a template using Test Kitchen configuration and customization.

Steps to Reproduce:

In the VM template that we are using the network is set to the only network that the cluster has. This is a VMware Distributed Switch / port group with static binding. Whether we set the desired network within the customization section of the .kichen.yml file or leave it out the result is the same.

Expected Result:

The network should be connected in both the Virtual Machine settings and in the guest OS.

Actual Result:

Once the virtual machine comes up the network is disconnected i.e. in VM settings under Network adapter 1> Device Status the Connected and Connect at power on boxes are unchecked and the network status within the guest OS is showing as unplugged.

Possible related issues:

Issue #19: Automatically connect network by mrmarbury in CenturyLinkCloud/chef-provisioning-vsphere on GitHub
Issue #100: Cloned Machines Have Disconnected Network Adapters by dan-rose in CenturyLinkCloud/chef-provisioning-vsphere on GitHub

@jjasghar
Copy link

jjasghar commented Jun 1, 2017

Unfortunately, I don't have a 5.X ESXi or vCenter instance. I can't verify or recreate this, and I won't have that version anytime soon. I'll label this as a 5.x issue, but I don't think we'll have a fix anytime soon. That's not saying that if someone figures out the PR to fix this without breaking 6.0+ compat, I'd love to get it merged.

Thanks for the report!

@donwlewis
Copy link

@IcedGoblin I believe this is a problem within VSphere itself. I have seen this issue even when not leveraging chef-provisioning-vsphere. What version of distributed switch are you using?

@hrmmmwhynot
Copy link

hrmmmwhynot commented May 26, 2018

Not sure if this applies to the current state of the code here, but try adding this into "driver.rb" > def clone_vm(action_handler, bootstrap_options, machine_name)
right after "vm = vsphere_helper.find_vm(vm_folder, machine_name)"

      # fix network not connected after clone
      dnic = vm.config.hardware.device.grep(RbVmomi::VIM::VirtualEthernetCard).find{|nic| nic.props}
      if dnic[:connectable][:startConnected].eql?false
          puts "Switch cloned NIC to: Connect at power on"
          dnic[:connectable][:startConnected] = true
          dnic[:connectable][:connected] = true
          dnic[:connectable][:allowGuestControl] = true
          spec = RbVmomi::VIM.VirtualMachineConfigSpec({
              :deviceChange => [{
                  :operation => :edit,
                  :device => dnic
              }]
          })
          vm.ReconfigVM_Task(:spec => spec).wait_for_completion
      end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants