Friday, July 18, 2014

esx is nastay or find tasks and disks and oh my 5.5 you hate my vmtx don't you

Collecting info about tasks in ESX and ESXi

COLLECTING INFORMATION ABOUT TASKS IN VMWARE ESX AND ESXI

Symptoms

While troubleshooting issues with VMware ESX and VMware vCenter, there may be differences between what vCenter and ESX consider tasks. An issue may occur when a task within vCenter server times out, and when attempting to run other tasks, it reports the error:
Another task is already in progress.

Purpose

This article provides steps to collect information about tasks for ESX and ESXi hosts.

Resolution

Note: For more information on resolving the symptoms described above, see Restarting the Management agents on an ESX or ESXi Server (1003490).
If your problem is re-occuring, and you need to find out which task the ESX host is taking a long time to process, you can use the following steps to isolate the task.

ESX

To collect information about tasks for ESX hosts:
  1. Log into the ESX host at the console or via SSH.  For more information, seeUnable to connect to an ESX host using Secure Shell (SSH) (1003807).
  2. In order to get a list of tasks on this host, run the command:

    vmware-vim-cmd vimsvc/task_listThe output is similar to:

    (ManagedObjectReference) [
       'vim.Task:haTask-112-vim.VirtualMachine.createSnapshot-3887',   'vim.Task:haTask-pool21-vim.ResourcePool.updateConfig-33252',   'vim.Task:haTask-pool22-vim.ResourcePool.updateConfig-33253',   'vim.Task:haTask-pool3-vim.ResourcePool.updateConfig-33254',   'vim.Task:haTask-pool5-vim.ResourcePool.updateConfig-33255',   'vim.Task:haTask-pool6-vim.ResourcePool.updateConfig-33256',   'vim.Task:haTask-pool7-vim.ResourcePool.updateConfig-33257',   'vim.Task:haTask-pool8-vim.ResourcePool.updateConfig-33258',   'vim.Task:haTask-pool10-vim.ResourcePool.updateConfig-33260'
    ]
  3. To get a list of tasks associated to specific virtual machines, you must first get theVmid of the virtual machine. Run the command:

    vmware-vim-cmd vmsvc/getallvmsThe output is similar to:
    Vmid        Name                  File                       Guest OS       Version   Annotation112    VM-1           [Datastore] VM-3/VM-3.vmx      winLonghornGuest        vmx-04128    VM-2           [Datastore] VM-3/VM-3.vmx      winXPProGuest           vmx-04144    VM-3           [Datastore] VM-3/VM-3.vmx      winNetStandardGuest     vmx-04
  4. Make note of the values under the Vmid column as they will be referenced in later steps.
  5. When you have the Vmid, you can then get a list of tasks associated with a specific virtual machine. Run the command:

    vmware-vim-cmd vmsvc/get.tasklist
    where  is the number identified in step 4.

    The output is similar to:
    (ManagedObjectReference) [   'vim.Task:haTask-112-vim.VirtualMachine.createSnapshot-3887']
  6. Make note of the task identifier. In the above example, the task identifier is 3887.
  7. To get information about a particular task's status, run the command:

    vmware-vim-cmd vimsvc/task_info 

    where  is the number recorded in step 6.


    The output is similar to:
    (vmodl.fault.ManagedObjectNotFound) {   dynamicType = ,   faultCause = (vmodl.MethodFault) null,   obj = 'vim.Task:3887',   msg = "The object has already been deleted or has not been completely created",}

ESXi

To collect information about tasks for ESX hosts:
  1. Log into the ESXi host at the console. For more information, see Tech Support Mode for Emergency Support (1003677).
  2. In order to get a list of tasks on this host, run the command:

    vim-cmd vimsvc/task_listThe output is similar to

    (ManagedObjectReference) [
       'vim.Task:haTask-112-vim.VirtualMachine.createSnapshot-3887',   'vim.Task:haTask-pool21-vim.ResourcePool.updateConfig-33252',   'vim.Task:haTask-pool22-vim.ResourcePool.updateConfig-33253',   'vim.Task:haTask-pool3-vim.ResourcePool.updateConfig-33254',   'vim.Task:haTask-pool5-vim.ResourcePool.updateConfig-33255',   'vim.Task:haTask-pool6-vim.ResourcePool.updateConfig-33256',   'vim.Task:haTask-pool7-vim.ResourcePool.updateConfig-33257',   'vim.Task:haTask-pool8-vim.ResourcePool.updateConfig-33258',   'vim.Task:haTask-pool10-vim.ResourcePool.updateConfig-33260'
    ]
  3. To get a list of tasks associated to specific virtual machines, you must first get theVmid of the virtual machine. Run the command:

    vim-cmd vmsvc/getallvmsThe output is similar to:
    Vmid        Name                  File                       Guest OS       Version   Annotation112    VM-1           [Datastore] VM-3/VM-3.vmx      winLonghornGuest        vmx-04128    VM-2           [Datastore] VM-3/VM-3.vmx      winXPProGuest           vmx-04144    VM-3           [Datastore] VM-3/VM-3.vmx      winNetStandardGuest     vmx-04
  4. Make note of the values under the Vmid column as they will be referenced in later steps.
  5. When you have the Vmid, you can then get a list of tasks associated with a specific virtual machine by running the command:

    vim-cmd vmsvc/get.tasklist
    where  is the number identified in step 4.

    The output is similar to:
    (ManagedObjectReference) [   'vim.Task:haTask-112-vim.VirtualMachine.createSnapshot-3887']
  6. Make note of the task identifier. In the above example, the task identifier is 3887.
  7. To get information about a particular task's status, run the command:

    vim-cmd vimsvc/task_info 

    where  is the number recorded in step 6.


    The output is similar to:
    (vmodl.fault.ManagedObjectNotFound) {   dynamicType = ,   faultCause = (vmodl.MethodFault) null,   obj = 'vim.Task:3887',   msg = "The object has already been deleted or has not been completely created",}
...

Collecting information about tasks in VMware ESXi/ESX (1013003)


Symptoms


  • While troubleshooting issues with ESXi/ESX hosts and VMware vCenter Server, there may be differences between what vCenter Server and an ESXi/ESX host considers tasks. An issue may occur when a task within vCenter Server times out, and when attempting to run other tasks, it reports the error:
Another task is already in progress.

Purpose

This article provides steps to collect information about tasks for ESXi/ESX hosts.

Resolution

Note: For more information on resolving the symptoms described above, see Restarting the Management agents on an ESXi or ESX host (1003490). If your problem is re-occurring, and you must determine which task the ESXi/ESX host is taking a long time to process.

To isolate the task follow the steps for the appropriate host:

ESX hosts

To collect information about tasks for ESX hosts:

  1. Log into the ESX host at the console or via SSH. For more information, see Unable to connect to an ESX host using Secure Shell (SSH) (1003807).
  2. To get a list of tasks on the host, run the command:

    vmware-vim-cmd vimsvc/task_list

    The output is similar to:

    (ManagedObjectReference) [
       'vim.Task:haTask-112-vim.VirtualMachine.createSnapshot-3887',
       'vim.Task:haTask-pool21-vim.ResourcePool.updateConfig-33252',
       'vim.Task:haTask-pool22-vim.ResourcePool.updateConfig-33253',
       'vim.Task:haTask-pool3-vim.ResourcePool.updateConfig-33254',
       'vim.Task:haTask-pool5-vim.ResourcePool.updateConfig-33255',
       'vim.Task:haTask-pool6-vim.ResourcePool.updateConfig-33256',
       'vim.Task:haTask-pool7-vim.ResourcePool.updateConfig-33257',
       'vim.Task:haTask-pool8-vim.ResourcePool.updateConfig-33258',
       'vim.Task:haTask-pool10-vim.ResourcePool.updateConfig-33260'
    ]
  3. To get a list of tasks associated to specific virtual machines, you must first get the Vmid of the virtual machine. Run the command:

    vmware-vim-cmd vmsvc/getallvms

    The output is similar to:

    Vmid  Name   File                        Guest OS              Version   Annotation
    112   VM-1   [Datastore] VM-3/VM-3.vmx   winLonghornGuest      vmx-04
    128   VM-2   [Datastore] VM-3/VM-3.vmx   winXPProGuest         vmx-04
    144   VM-3   [Datastore] VM-3/VM-3.vmx   winNetStandardGuest   vmx-04
  4. Make note of the values under the Vmid column as they will be referenced in later steps.
  5. When you have the Vmid, you can then get a list of tasks associated with a specific virtual machine. Run the command:

    vmware-vim-cmd vmsvc/get.tasklist VMID

    Where VMID is the number identified in step 4.

    The output is similar to:

    (ManagedObjectReference) [
       'vim.Task:haTask-112-vim.VirtualMachine.createSnapshot-3887'
    ]
  6. Make note of the task identifier. In the example above, the task identifier is:

    haTask-112-vim.VirtualMachine.createSnapshot-3887
  7. To get information about a particular task's status, run the command:

    vmware-vim-cmd vimsvc/task_info task_identifier

    Where task_identifier is the string recorded in step 6.

    The output is similar to:

    (vim.TaskInfo) {
      dynamicType = ,
      key = "haTask-112-vim.VirtualMachine.createSnapshot-3887",
      task = 'vim.Task:haTask-112-vim.VirtualMachine.createSnapshot-3887',
      description = (vmodl.LocalizableMessage) null,
      name = "vim.VirtualMachine.createSnapshot",
      descriptionId = "VirtualMachine.createSnapshot",
      entity = 'vim.VirtualMachine:112',
      entityName = "deploy-test",
      state = "running",
      cancelled = false,
      cancelable = false,
      error = (vmodl.MethodFault) null,
      result = ,
      progress = 15,
      reason = (vim.TaskReasonUser) {
         dynamicType = ,
         userName = "root",
      },
      queueTime = "2012-11-28T01:29:35.233835Z",
      startTime = "2012-11-28T01:29:35.234891Z",
      completeTime = ,
      eventChainId = 2936866,
      changeTag = ,
      parentTaskKey = ,
      rootTaskKey = ,
    }

ESXi hosts

To collect information about tasks for ESXi hosts:

  1. Log into the ESXi host at the console. For more information, see Tech Support Mode for Emergency Support (1003677).
  2. To get a list of tasks on the host, run the command:

    vim-cmd vimsvc/task_list

    The output is similar to:

    (ManagedObjectReference) [
       'vim.Task:haTask-112-vim.VirtualMachine.createSnapshot-3887',
       'vim.Task:haTask-pool21-vim.ResourcePool.updateConfig-33252',
       'vim.Task:haTask-pool22-vim.ResourcePool.updateConfig-33253',
       'vim.Task:haTask-pool3-vim.ResourcePool.updateConfig-33254',
       'vim.Task:haTask-pool5-vim.ResourcePool.updateConfig-33255',
       'vim.Task:haTask-pool6-vim.ResourcePool.updateConfig-33256',
       'vim.Task:haTask-pool7-vim.ResourcePool.updateConfig-33257',
       'vim.Task:haTask-pool8-vim.ResourcePool.updateConfig-33258',
       'vim.Task:haTask-pool10-vim.ResourcePool.updateConfig-33260'
    ]
  3. To get a list of tasks associated to specific virtual machines, you must first get the Vmid of the virtual machine. Run the command:

    vim-cmd vmsvc/getallvms

    The output is similar to:

    Vmid  Name   File                        Guest OS              Version   Annotation
    112   VM-1   [Datastore] VM-3/VM-3.vmx   winLonghornGuest      vmx-04
    128   VM-2   [Datastore] VM-3/VM-3.vmx   winXPProGuest         vmx-04
    144   VM-3   [Datastore] VM-3/VM-3.vmx   winNetStandardGuest   vmx-04
  4. Make note of the values under the Vmid column as they will be referenced in later steps.
  5. When you have the Vmid, you can then get a list of tasks associated with a specific virtual machine by running the command:

    vim-cmd vmsvc/get.tasklist VMID

    Where VMID is the number identified in step 4.

    The output is similar to:

    (ManagedObjectReference) [
       'vim.Task:haTask-112-vim.VirtualMachine.createSnapshot-3887'
    ]
  6. Make note of the task identifier. In the example above, the task identifier is:

    haTask-112-vim.VirtualMachine.createSnapshot-3887
  7. To get information about a particular task's status, run the command:

    vim-cmd vimsvc/task_info task_identifier

    Where task_identifier is the string recorded in step 6.

    The output is similar to:

     (vim.TaskInfo) {
      dynamicType = ,
      key = "haTask-112-vim.VirtualMachine.createSnapshot-3887",
      task = 'vim.Task:haTask-112-vim.VirtualMachine.createSnapshot-3887',
      description = (vmodl.LocalizableMessage) null,
      name = "vim.VirtualMachine.createSnapshot",
      descriptionId = "VirtualMachine.createSnapshot",
      entity = 'vim.VirtualMachine:112',
      entityName = "deploy-test",
      state = "running",
      cancelled = false,
      cancelable = false,
      error = (vmodl.MethodFault) null,
      result = ,
      progress = 15,
      reason = (vim.TaskReasonUser) {
         dynamicType = ,
         userName = "root",
      },
      queueTime = "2012-11-28T01:29:35.233835Z",
      startTime = "2012-11-28T01:29:35.234891Z",
      completeTime = ,
      eventChainId = 2936866,
      changeTag = ,
      parentTaskKey = ,
      rootTaskKey = ,
    }
...

Converting a template to a virtual machine fails with the error: A component of the virtual machine is not accessible on the host (1021563)


Cause


This issue occurs when a component (for example, a virtual CD-ROM) is attached to the virtual machine but, is no longer accessible or valid.

Resolution


To work around this issue, remove the device from the virtual machine's .vmtx file.
To remove the device from the virtual machine's .vmtx file:
  1. Log in to the ESXi/ESX host service console as root from an Secure Shell (SSH) or directly from the console of the server.f
  2. Unregister the virtual machine from vCenter Server. Right-click the virtual machine and click Remove from Inventory.
  3. Go to the . vmtx file of the virtual machine by going to the Virtual Machines File System (VMFS) volume.cd /vmfs/volumes/LUN_A/virtualmachine
  4. Make a backup of the . vmtx file with the command:cp vm_name.vmtx vm_name.bak
  5. Open the . vmtx file in a text editor and look for entries similar to:ide1:0.clientDevice = "FALSE"
    ide1:0.deviceType = "cdrom-image"
    ide1:0.fileName = "/vmfs/volumes/storage1/ISO/winxp.iso"
    Note: For vSphere 5.5 substitute ide1:0.clientDevice = "FALSE" for ide1:0.present = "FALSE"
  6. Change the entries to:ide1:0.clientDevice = "TRUE"
    ide1:0.deviceType = "atapi-cdrom"
    ide1:0.fileName = "" 

    Note: For vSphere 5.5 substitute ide1:0.clientDevice = "TRUE" for ide1:0.present = "TRUE"
  7. Re-register the virtual machine. 
    To re-register a virtual machine 
    perform one of these options:
  • Re-register a virtual machine on ESX with the command:vmware-cmd –s register vm_name.vmtx
  • Re-register a virtual machine on ESXi with the command:vim-cmd solo/registervm /vmfs/volumes/datastore_name/VM_directory/VM_name.vmtx
Post a Comment