Giter Site home page Giter Site logo

Comments (6)

jeremymv2 avatar jeremymv2 commented on August 24, 2024

With version 1.0.0.pre.2 and the fix above, the windows cloning process gets to about 90% then errors with:

Cloning template win2012r2-datacenter_tmpl to new VM HPSDYN-WIN-22
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/rbvmomi-1.5.1/lib/rbvmomi/vim/Task.rb:11:in wait_for_completion': NicSettingMismatch: fault.NicSettingMismatch.summary (RbVmomi::Fault) from /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/knife-vsphere-1.0.0.pre.2/lib/chef/knife/vsphere_vm_clone.rb:252:inrun'
from /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.12.4/lib/chef/knife.rb:492:in run_with_pretty_exceptions' from /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.12.4/lib/chef/knife.rb:174:inrun'
from /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.12.4/lib/chef/application/knife.rb:135:in run' from /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.12.4/bin/knife:25:in'
from /opt/chef/embedded/bin/knife:23:in load' from /opt/chef/embedded/bin/knife:23:in'

Any ideas?

from knife-vsphere.

jeremymv2 avatar jeremymv2 commented on August 24, 2024

Solved my issue. Best I could tell it was because I wasn't setting the adapter IP. Re-wrote the plugin.rb so it made a bit more sense to me. With this I am able to clone a 2012R2 64bit template to a VM.

require 'rbvmomi'

class KnifeVspherePlugin
  attr_accessor :data

  def customize_clone_spec(src_config, clone_spec)

    if File.exists? data
      customization_data = JSON.parse(IO.read(data))
    else
      abort "Customization plugin data file #{data} not accessible"
    end

    cust_guiUnattended = RbVmomi::VIM.CustomizationGuiUnattended(
      :autoLogon => false,
      :autoLogonCount => 1,
      :password => nil,
      :timeZone => customization_data['timeZone']
    )
    cust_identification = RbVmomi::VIM.CustomizationIdentification(
      :domainAdmin => nil,
      :domainAdminPassword => nil,
      :joinDomain => nil
    )
    cust_name = RbVmomi::VIM.CustomizationFixedName(
      :name => customization_data['host_name']
    )
    cust_user_data = RbVmomi::VIM.CustomizationUserData(
      :computerName => cust_name,
      :fullName => customization_data['fullName'],
      :orgName => customization_data['orgName'],
      :productId => customization_data['windows_key']
    )
    cust_sysprep = RbVmomi::VIM.CustomizationSysprep(
      :guiUnattended => cust_guiUnattended,
      :identification => cust_identification,
      :userData => cust_user_data
    )
    dhcp_ip = RbVmomi::VIM.CustomizationDhcpIpGenerator
    cust_ip = RbVmomi::VIM.CustomizationIPSettings(
      :ip => dhcp_ip
    )
    cust_adapter_mapping = RbVmomi::VIM.CustomizationAdapterMapping(
      :adapter => cust_ip
    )
    cust_adapter_mapping_list = [cust_adapter_mapping]
    global_ip = RbVmomi::VIM.CustomizationGlobalIPSettings
    customization_spec = RbVmomi::VIM.CustomizationSpec(
      :identity => cust_sysprep,
      :globalIPSettings => global_ip,
      :nicSettingMap => cust_adapter_mapping_list
    )
    clone_spec.customization = customization_spec
    puts "New clone_spec object :\n #{YAML::dump(clone_spec)}"
    clone_spec
  end

  def reconfig_vm (target_vm)
    puts "In reconfig_vm method.  No actions implemented.."
  end
end

from knife-vsphere.

kodayashi avatar kodayashi commented on August 24, 2024

Hi @jeremymv2,

It looks like I'm hitting your same issue with the latest version of knife vsphere. I'm trying to clone a win2012x64 template to a VM with (essentially) the same code above. I've just taken out some customization_data:

class KnifeVspherePlugin
  attr_accessor :data

  def customize_clone_spec(src_config, clone_spec)

    if File.exists? './cplugins/data'
      customization_data = JSON.parse(IO.read('./cplugins/data'))
    else
      abort "Customization plugin data file #{data} not accessible"
    end

    cust_guiUnattended = RbVmomi::VIM.CustomizationGuiUnattended(
      :autoLogon => false,
      :autoLogonCount => 1,
      :password => nil,
      :timeZone => customization_data['timeZone']
    )
    cust_identification = RbVmomi::VIM.CustomizationIdentification(
      :domainAdmin => nil,
      :domainAdminPassword => nil,
      :joinDomain => nil
    )
    cust_name = RbVmomi::VIM.CustomizationFixedName(
      :name => customization_data['host_name']
    )
    cust_user_data = RbVmomi::VIM.CustomizationUserData(
      :computerName => cust_name
    )
    cust_sysprep = RbVmomi::VIM.CustomizationSysprep(
      :guiUnattended => cust_guiUnattended,
      :identification => cust_identification,
      :userData => cust_user_data
    )
    dhcp_ip = RbVmomi::VIM.CustomizationDhcpIpGenerator
    cust_ip = RbVmomi::VIM.CustomizationIPSettings(
      :ip => dhcp_ip
    )
    cust_adapter_mapping = RbVmomi::VIM.CustomizationAdapterMapping(
      :adapter => cust_ip
    )
    cust_adapter_mapping_list = [cust_adapter_mapping]
    global_ip = RbVmomi::VIM.CustomizationGlobalIPSettings
    customization_spec = RbVmomi::VIM.CustomizationSpec(
      :identity => cust_sysprep,
      :globalIPSettings => global_ip,
      :nicSettingMap => cust_adapter_mapping_list
    )
    clone_spec.customization = customization_spec
    puts "New clone_spec object :\n #{YAML::dump(clone_spec)}"
    clone_spec
  end

  def reconfig_vm (target_vm)
    puts "In reconfig_vm method.  No actions implemented.."
  end
end

My data file looks like this:

{
    "host_name": "knife-clone-test",
    "timeZone": "100"
}

I get that same NIC Mismatch error:

C:/Users/test/.chefdk/gem/ruby/2.0.0/gems/rbvmomi-1.5.1/lib/rbvmomi/vim/Task.rb:11:in `wait_for_completion': NicSettingMismatch: fault.NicSettingMismatch.summary (RbVmomi::Fault)
        from C:/Users/test/.chefdk/gem/ruby/2.0.0/gems/knife-vsphere-0.9.9/lib/chef/knife/vsphere_vm_clone.rb:239:in `run'
        from C:/opscode/chefdk/embedded/apps/chef/lib/chef/knife.rb:493:in `run_with_pretty_exceptions'
        from C:/opscode/chefdk/embedded/apps/chef/lib/chef/knife.rb:174:in `run'
        from C:/opscode/chefdk/embedded/apps/chef/lib/chef/application/knife.rb:139:in `run'
        from C:/opscode/chefdk/embedded/apps/chef/bin/knife:25:in `<top (required)>'
        from C:/opscode/chefdk/bin/knife:45:in `load'
        from C:/opscode/chefdk/bin/knife:45:in `<main>'

I'm trying to use DHCP, I wonder if that's the issue... Any thoughts?

from knife-vsphere.

hkhkhk1987 avatar hkhkhk1987 commented on August 24, 2024

meet this error again,any idea about it?

/Users/kunhou/.rvm/gems/ruby-2.1.2/gems/rbvmomi-1.5.1/lib/rbvmomi/vim/Task.rb:11:in wait_for_completion': NicSettingMismatch: fault.NicSettingMismatch.summary (RbVmomi::Fault) from /Users/kunhou/.rvm/gems/ruby-2.1.2/gems/knife-vsphere-0.9.9/lib/chef/knife/vsphere_vm_clone.rb:239:inrun'
from /Users/kunhou/.rvm/gems/ruby-2.1.2/gems/chef-11.16.4/lib/chef/knife.rb:493:in run_with_pretty_exceptions' from /Users/kunhou/.rvm/gems/ruby-2.1.2/gems/chef-11.16.4/lib/chef/knife.rb:174:inrun'
from /Users/kunhou/.rvm/gems/ruby-2.1.2/gems/chef-11.16.4/lib/chef/application/knife.rb:139:in run' from /Users/kunhou/.rvm/gems/ruby-2.1.2/gems/chef-11.16.4/bin/knife:25:in<top (required)>'
from /Users/kunhou/.rvm/gems/ruby-2.1.2/bin/knife:23:in load' from /Users/kunhou/.rvm/gems/ruby-2.1.2/bin/knife:23:in

'
from /Users/kunhou/.rvm/gems/ruby-2.1.2/bin/ruby_executable_hooks:15:in eval' from /Users/kunhou/.rvm/gems/ruby-2.1.2/bin/ruby_executable_hooks:15:in'

from knife-vsphere.

hvveen avatar hvveen commented on August 24, 2024

Also hitting this error, but only in the following situation;

  • WIN2012R2 template without any NIC's in it
  • Customization file without any NIC's defined
  • a cplugin file with only a couple of puts statements

vsphere_vm_clone.rb runs happily until

/ task = src_vm.CloneVM_Task(:folder => dest_folder, :name => vmname, :spec => clone_spec)
/ puts "Cloning template #{config[:source_vm]} to new VM #{vmname}"
/ task.wait_for_completion <<<<<============
/ puts "Finished creating virtual machine #{vmname}"

This happens before the actual customization and plugin will start.

Using the same template, but with 1 NIC defined runs without a problem.

Getting desperate....!

Grtz, Hans

from knife-vsphere.

swalberg avatar swalberg commented on August 24, 2024

Hi, is this still a problem? The subject seems to indicate that it is solved, but @hvveen's comments look like he's having a problem. Please let me know as I'm trying to clean up old issues.

There have been several improvements in the Windows cloning lately, so please update your gem and try again.

Thanks.

from knife-vsphere.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.