chef-provisioning-vsphere icon indicating copy to clipboard operation
chef-provisioning-vsphere copied to clipboard

kitchen driver vsphere can't handle reboot

Open yamamoto52 opened this issue 6 years ago • 1 comments

Versions:

chef-client : 14.7.17

  • Version of Chef-Provisioning: 2.7.2
  • Version of Chef-Provisioning-vSphere: 2.3.1

Platform Details

  • Version of vSphere/vCenter: 6.5
  • Version of ESXi: 6.5

Scenario:

I need to reboot vm during chef run.

Everything works correctly when I use driver Vagrant .

Steps to Reproduce:

Implement in recipe : reboot 'reboot after rename' do action :reboot_now end

configure kitchen.yml like :


driver: name: vsphere driver_options: host: user: "<%= ENV['TERRAFORM_USER'] %>" password: "<%= ENV['TERRAFORM_PASSWD'] %>" insecure: true machine_options: start_timeout: 600 create_timeout: 600 ready_timeout: 90 bootstrap_options: datacenter: 'Datacenter' template_name: 'CM_TMPL_TF_W2012R2x64 template_folder: 'CM_OS_TEMPLATE' vm_folder: 'Terraform' num_cpus: 2, network_name: - '415Virtual' memory_mb: 4096 resource_pool: 'vSAN_Tier2' ssh: elevated: true port: 5985 user: "<%= ENV['WINRM_USER'] %>" password: "<%= ENV['WINRM_PASSWD'] %>"

provisioner: name: chef_zero log_level: info product_name: chef product_version: 14.7.17 download_url: "https://host.ra-int.com/artifactory/chef-internal/chef-client/chef-client-14.7.17-1-x64.msi" always_update_cookbooks: true retry_on_exit_code: - 35 # signals node is rebooting - 20 # for test max_retries: 3 wait_for_retry: 180 data_bags_path: test/integration/data_bags client_rb: exit_status: :disabled client_fork: false attributes: ra: cookbook_name: username: 'username' password: <%= ENV['DOMAIN_PASSWORD'] %>

verifier: name: inspec

platforms:

  • name: windows-2012r2

transport: elevated: true

suites:

  • name: random_name run_list: verifier: inspec_tests: - test/smoke/random_name

Expected Result:

reboot and chef retry after 180s

Actual Result:

  • reboot[reboot after rename] action reboot_now[2018-12-27T11:47:39+01:00] INFO: Processing reboot[reboot after rename] action reboot_now (cookbookname::default line 41) [2018-12-27T11:47:39+01:00] WARN: Rebooting system immediately, requested by 'reboot after rename' [2018-12-27T11:47:39+01:00] INFO: Changing reboot status from {} to {:delay_mins=>0, :reason=>"Reboot by Chef", :timestamp=>2018-12-27 11:47:39 +0100, :requested_by=>"reboot after rename"} [2018-12-27T11:47:39+01:00] INFO: Chef Run complete in 17.390383 seconds

        Running handlers:
    [2018-12-27T11:47:39+01:00] INFO: Running report handlers
        Running handlers complete
    [2018-12-27T11:47:39+01:00] INFO: Report handlers complete
        Chef Client finished, 0/0 resources updated in 22 seconds
    [2018-12-27T11:47:39+01:00] WARN: Rebooting server at a recipe's request. Details: {:delay_mins=>0, :reason=>"Reboot by Chef", :timestamp=>2018-12-27 11:47:39 +0100, :requested_by=>"reboot after rename"}
    
        Running handlers:
    [2018-12-27T11:47:39+01:00] ERROR: Running exception handlers
        Running handlers complete
    [2018-12-27T11:47:39+01:00] ERROR: Exception handlers complete
        Chef Client failed. 0 resources updated in 22 seconds
    [2018-12-27T11:47:39+01:00] FATAL: Stacktrace dumped to C:/Users/cmadmin/AppData/Local/Temp/kitchen/cache/chef-stacktrace.out
    [2018-12-27T11:47:39+01:00] FATAL: Please provide the contents of the stacktrace.out file if you file a bug report
    [2018-12-27T11:47:39+01:00] FATAL: Chef::Exceptions::Reboot: Rebooting server at a recipe's request. Details: {:delay_mins=>0, :reason=>"Reboot by Chef", :timestamp=>2018-12-27 11:47:39 +0100, :requested_by=>"reboot after rename"}
    

------Exception------- Class: Kitchen::ActionFailed Message: 1 actions failed. Converge failed on instance . Please see .kitchen/logs/custom-hostname-windows-2012r2.log for more details

Please see .kitchen/logs/kitchen.log for more details Also try running kitchen diagnose --all for configuration

Error : [20] when executing command: 'kitchen test custom-hostname'

yamamoto52 avatar Dec 27 '18 12:12 yamamoto52

Hi, we had similar problems with rebooting the node during converge. Try adding 1min. delay to the Chef reboot. It helped us. Cheers.

mdpdesign avatar Mar 02 '19 09:03 mdpdesign