Edge VM present in NSX inventory not present in vCenter alarm
search cancel

Edge VM present in NSX inventory not present in vCenter alarm

book

Article ID: 368081

calendar_today

Updated On:

Products

VMware NSX

Issue/Introduction

Title: Alarm for edge.edge_vm_present_in_nsx_inventory_not_present_in_vcenter
Event ID: edge.edge_vm_present_in_nsx_inventory_not_present_in_vcenter

Alarm Description: 

"The VM <edge_vm_name> with moref id <vm_moref_id> corresponding to the Edge Transport node <edge_node_uuid> vSphere placement parameters is found in NSX inventory but is not present in vCenter. Check if the VM has been removed in vCenter or is present with a different VM moref id."

  • Purpose: An alarm will be raised when Auto Edge VM is present in NSX-T inventory but not present in vCenter.
  • Impact: When this alarm is present, the edge VM moref id might have been changed. This might impact redeploy operations of this auto edge VM. During redeploy, the power off operation of the old VM fails due to the stale old moref id or due to communication issues, resulting in the old VM functioning at the same time along with the newly deployed VM. This results in networking issues along with IP conflicts.

Environment

NSX-T Datacenter

Cause

  1. Operations where the host is unregistered and registered back with vCenter with all VMs present result in the VMs having new moref ids.  Similar operations with VM unregister and reregister due to some other failure/recovery workflows result in VMs having a new moref id.  The NSX inventory and the Edge Transport node configuration still has a reference to the old moref id.
  2. Sometimes the vCenter operations on a VM fail when the VM is facing communication issues due to changes in thumbprint, etc.

Resolution

Steps to Resolve
For 3.2.1 and higher

Case 1 : If the Edge VM is present in vCenter with a different moref id, please follow the below action.

Use the NSX add or update placement API to update the new vm moref id for this auto deployed edge node.

NSX add or update placement API: POST https://<NSX Manager IP/FQDN>/api/v1/transport-nodes/<transport node id>?action=addOrUpdatePlacementReferences

* you can run the following API call to get the configurations of the node to use in the body for the next step
GET https://<NSX Manager IP/FQDN>/api/v1/transport-nodes/  -------> search the output for the edge name and locate the external id 

GET https://<NSX Manager IP/FQDN>/api/v1/transport-nodes/<edge node UUID from above>

**it is recommended to  validate the updated payload for the API by using a json checker such as jsonlint.com

Craft an API request payload that consists of 4 fields using the following steps:

  1. vm_deployment_config - Refer Line 2 in the sample request payload below. Copy this block from GET https://<NSX Manager IP/FQDN>/api/v1/transport-nodes/<edge UUID>
  2. node_settings - Refer Line 29 in the sample request payload  below. Copy this block from GET https://<NSX Manager IP/FQDN>/api/v1/transport-nodes/<edge UUID>
  3. node_user_settings - Refer to line 43 in the block below. Craft this block from scratch
  4. vm_id - Refer to line 48 in the sample request payload below. For vm_id collect the edge virtual machine moref Id from vCenter Client URL (or vSphere MOB). You can get VM moref id just by clicking edge VM in VCenter as shown in the following screenshot:

Sample Payload:

{
"vm_deployment_config" : {
      "vc_id" : "36895c2f-####-####-####-d3eb2485576d",
        "compute_id" : "resgroup-42",
        "storage_id" : "datastore-17",
        "compute_folder_id" : "group-v38",
      "management_network_id" : "f7cc6be7-####-####-####-89abfe889834:########-vif1",
        "management_port_subnets" : [ {
        "ip_addresses" : [ "##.##.##.##" ],
          "prefix_length" : 19
        } ],
      "default_gateway_addresses" : [ "##.##.##.##" ],
      "data_network_ids" : [ "5d069776-####-####-####-8e31eaa289df:########-vif2" ],
        "reservation_info" : {
          "memory_reservation" : {
            "reservation_percentage" : 100
          },
          "cpu_reservation" : {
            "reservation_in_shares" : "NORMAL_PRIORITY",
            "reservation_in_mhz" : 9196
          }
        },
        "resource_allocation" : {
          "cpu_count" : 4,
          "memory_allocation_in_mb" : 8192
        },
        "placement_type" : "VsphereDeploymentConfig"
      },
  "node_settings" : {
    "hostname" : "########-##-##-##-##",
    "ntp_servers" : [ "##.##.##.##" ],
    "dns_servers" : [ "##.##.##.##" ],
      "enable_ssh" : true,
      "allow_ssh_root_login" : true,
      "syslog_servers" : [ {
      "server" : "##.##.##.##",
        "port" : "514",
        "protocol" : "TCP",
        "log_level" : "INFO"
      } ],
      "enable_upt_mode" : false
    },
"node_user_settings":{
    "cli_username":"#####",
    "root_password":"<password>",  <<<<<<<< edge node root password      
    "cli_password":"<password>"    <<<<<<<< edge node cli password
   },
   "vm_id":"vm-1003"
}

 

Case 2 : If the Edge VM with name <vm_name> is not present in vCenter, use the NSX Redeploy API to deploy a new VM for the Edge node. 

NSX Redeploy API: POST https://<NSX manager IP/FQDN>/api/v1/transport-nodes/<transport node id>?action=redeploy

  1. Run edge transport node API: GET https://<NSX Manager IP/FQDN>/api/v1/transport-nodes/<transport node id> 
  2. Use GET API response as request payload to POST https://<NSX manager IP/FQDN>/api/v1/transport-nodes/<transport node id>?action=redeploy