VMware Networking Community
hola06
Contributor
Contributor
Jump to solution

Edge VM update placement reference

Hi,

We had re-register the edge VM after vcenter crash and following message recieved in alert.

Didnt get blog or steps if any tried it..share me the steps

 Description: The VM enode1 with moref id vm-100051 corresponding to the Edge Transport node 1b059d80-576d-469a-b9f9 vSphere placement parameters is found in NSX inventory but is not present in vCenter. Please check if the VM has been removed in vCenter or is present with a different VM moref id. Recommended Action: The managed object reference moref id of a VM has the form vm-number, which is visible in the URL on selecting the Edge VM in vCenter UI. Example vm-12011 in https://<vc-url>/ui/app/vm;nav=h/urn:vmomi:VirtualMachine:vm-12011:164ff798-c4f1-495b-a0be-adfba337e5d2/summary Please find the VM node1 with moref id vm-100051 in vCenter for this Edge Transport Node 1b059d80-576d-469a-b9f9. If the Edge VM is present in vCenter with a different moref id, please follow the below action. Use NSX add or update placement API with JSON request payload properties vm_id and vm_deployment_config to update the new vm moref id and vSphere deployment parameters. POST https://<manager-ip>/api/v1/transport-nodes/<tn-id>?action=addOrUpdatePlacementReferences. If the Edge VM with name node1 is not present in vCenter, use the NSX Redeploy API to deploy a new VM for the Edge node. POST https://<manager-ip>/api/v1/transport-nodes/<tn-id>?action=redeploy.

Labels (2)
Tags (1)
0 Kudos
1 Solution

Accepted Solutions
atusmenezes
VMware Employee
VMware Employee
Jump to solution

Try this one, then:

Execute a GET against this URL

https://<manager-ip>/api/v1/transport-nodes/<tn-id>

 and in tn-id, put the ID of the edge that is presenting problems. This will return a JSON with all configuration of this node. Then, execute the POST below:

url -k -v -u 'admin:PASSWORD'  -X POST -H 'Content-Type: application/json' -d '{
      "vm_id":"VM ID",
      "vm_deployment_config": {
      <You can get this info from the previous GET command>
      }
 }' https://<manager-ip>/api/v1/transport-nodes/<tn-id>?action=addOrUpdatePlacementReferences

 

You can get the VM_DEPLOYMENT_CONFIG info, from the previous GET command.

View solution in original post

8 Replies
atusmenezes
VMware Employee
VMware Employee
Jump to solution

Hello, how are you?

I believe you have to do something like that:

curl -k -v -u 'admin:PASSWORD'  -X POST -H 'Content-Type: application/json' -d '{
  "vc_id": "VCENTE ID",
      "vm_id":"VM ID",
      "node_user_settings": {
        "cli_username": "admin",
    "root_password":"PASSWORD",
    "cli_password":"PASSWORD"
      }
 }' https://<manager-ip>/api/v1/transport-nodes/<tn-id>?action=addOrUpdatePlacementReferences

 

But, I believe that recreate the edge node is easier.

hola06
Contributor
Contributor
Jump to solution

I tired that,it requested for the vc_id

following message received while execution

}root@mgr3:~# curl -k -v -u admin:password -X POST -H 'Content-Type: application/json' -d '{
> "vc_id": "db241c37-ac4c-44b1-9228-58c98e5b0720",
> "vm_id":"vm-135007",
> "node_user_settings": {
> "cli_username": "admin",
> "root_password":"password",
> "cli_password":"password"
> }
> }' https://x.x.x.x/api/v1/transport-nodes/1b059d80-576d-469a-b9f9-3acff042b61b?action=addOrUpdatePlacementReferences
Note: Unnecessary use of -X or --request, POST is already inferred.
* Trying x.x.x.x...
* TCP_NODELAY set
* Connected to x.x.x.x (x.x.x.x) port 443 (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
* successfully set certificate verify locations:
* CAfile: /etc/ssl/certs/ca-certificates.crt
CApath: /etc/ssl/certs
* TLSv1.3 (OUT), TLS handshake, Client hello (1):
* TLSv1.3 (IN), TLS handshake, Server hello (2):
* TLSv1.2 (IN), TLS handshake, Certificate (11):
* TLSv1.2 (IN), TLS handshake, Server key exchange (12):
* TLSv1.2 (IN), TLS handshake, Request CERT (13):
* TLSv1.2 (IN), TLS handshake, Server finished (14):
* TLSv1.2 (OUT), TLS handshake, Certificate (11):
* TLSv1.2 (OUT), TLS handshake, Client key exchange (16):
* TLSv1.2 (OUT), TLS change cipher, Client hello (1):
* TLSv1.2 (OUT), TLS handshake, Finished (20):
* TLSv1.2 (IN), TLS handshake, Finished (20):
* SSL connection using TLSv1.2 / ECDHE-RSA-AES256-GCM-SHA384
* ALPN, server did not agree to a protocol
* Server certificate:
* subject:
* start date: Aug 26 12:57:13 2022 GMT
* expire date: Nov 28 12:57:13 2024 GMT
* issuer:
* SSL certificate verify result: self signed certificate (18), continuing anyway.
* Server auth using Basic with user 'admin'
> POST /api/v1/transport-nodes/1b059d80-576d-469a-b9f9-3acff042b61b?action=addOrUpdatePlacementReferences HTTP/1.1
> Host: x.x.x.x
> Authorization: Basic YWRtaW46Vk13YXJlMSFWTXdhcmUxIQ==
> User-Agent: curl/7.58.0
> Accept: */*
> Content-Type: application/json
> Content-Length: 232
>
* upload completely sent off: 232 out of 232 bytes
< HTTP/1.1 400 Bad Request
< cache-control: no-cache, no-store, max-age=0, must-revalidate
< pragma: no-cache
< expires: 0
< x-xss-protection: 1; mode=block
< x-frame-options: DENY
< x-content-type-options: nosniff
< content-type: application/json
< date: Tue, 03 Jan 2023 07:43:28 GMT
< x-envoy-upstream-service-time: 5
< vary: Accept-Encoding
< set-cookie: JSESSIONID=C0286F3CD57DEBD38EE7BD8BE97B2334; Path=/; Secure; HttpOnly
< x-frame-options: SAMEORIGIN
< x-xss-protection: 1; mode=block
< strict-transport-security: max-age=31536000; includeSubDomains
< server: envoy
< transfer-encoding: chunked
<
{
"httpStatus" : "BAD_REQUEST",
"error_code" : 287,
"module_name" : "common-services",
"error_message" : "Json de-serialization error: property vc_id is unrecognized."
* Connection #0 to host x.x.x.x left intact
}

0 Kudos
atusmenezes
VMware Employee
VMware Employee
Jump to solution

Try this one, then:

Execute a GET against this URL

https://<manager-ip>/api/v1/transport-nodes/<tn-id>

 and in tn-id, put the ID of the edge that is presenting problems. This will return a JSON with all configuration of this node. Then, execute the POST below:

url -k -v -u 'admin:PASSWORD'  -X POST -H 'Content-Type: application/json' -d '{
      "vm_id":"VM ID",
      "vm_deployment_config": {
      <You can get this info from the previous GET command>
      }
 }' https://<manager-ip>/api/v1/transport-nodes/<tn-id>?action=addOrUpdatePlacementReferences

 

You can get the VM_DEPLOYMENT_CONFIG info, from the previous GET command.

hola06
Contributor
Contributor
Jump to solution

thanks @atusmenezes ,That works!

Enclose the post json script for any one who looking for similar issue.

{
     "vm_id":"vm-000000",
      "vm_deployment_config": {
        "vc_id": "xxxxxxxxxxxxxxxxxxxxxxxxxxxx",
        "compute_id": "resgroup-67017",
        "storage_id": "datastore-67006",
        "management_network_id": "dvportgroup-67010",
        "management_port_subnets": [
          {
            "ip_addresses": [
              "x.x.x.x"
            ],
            "prefix_length": 24
          }
        ],
        "default_gateway_addresses": [
          "x.x.x.1"
        ],
        "data_network_ids": [
          "dvportgroup-67012",
          "dvportgroup-67013",
          "dvportgroup-67010"
        ],
        "reservation_info": {
          "memory_reservation": {
            "reservation_percentage": 100
          },
          "cpu_reservation": {
            "reservation_in_shares": "HIGH_PRIORITY",
            "reservation_in_mhz": 0
          }
        },
        "resource_allocation": {
          "cpu_count": 16,
          "memory_allocation_in_mb": 65536
        },
        "placement_type": "VsphereDeploymentConfig"
      },
      "node_user_settings": {
        "cli_username": "admin",
        "audit_username": "ausdit"
      }
    }

 

0 Kudos
leslier
Contributor
Contributor
Jump to solution

I'm facing this exact issue, I don't mean to be daft, but for the POST statement: 

 

url -k -v -u 'admin:PASSWORD'  -X POST -H 'Content-Type: application/json' -d '{
      "vm_id":"VM ID",
      "vm_deployment_config": {
      <You can get this info from the previous GET command>
      }
 }' https://<manager-ip>/api/v1/transport-nodes/<tn-id>?action=addOrUpdatePlacementReferences

 

 

For the "URL" portion, what am I putting there? This? 

 

https://<manager-ip>/api/v1/transport-nodes/ so it would look like...

https://<manager-ip>/api/v1/transport-nodes/ -k -v -u 'admin:password'  -X POST -H 'Content-Type: application/json' -d '{.....

 

 

And, do I dump the entire line into the POST field in POSTMAN? Any help would be appreciated thank you.

 

0 Kudos
dee0606
Enthusiast
Enthusiast
Jump to solution

Hi @leslier 

Tried with postman it works for me.

1. Collect the output from postman

https://<manager-ip>/api/v1/transport-nodes/<tn-id>

 

now push using the available data without form_factor and push it on json..validate the json before push...

https://<manager-ip>/api/v1/transport-nodes/<tn-id>?action=addOrUpdatePlacementReferences

{
"vm_id":"VM ID",
"vm_deployment_config": {
"vc_id": "db241c37-ac4c-44b1-9228-xxxxxxxxxxxx",
"compute_id": "resgroup-xxxxxx",
"storage_id": "datastore-xxxxxx",
"management_network_id": "dvportgroup-xxxxxxxx",
"management_port_subnets": [
{
"ip_addresses": [
"x.x.x.x"
],
"prefix_length": 24
}
],
"default_gateway_addresses": [
"x.x.x.x"
],
"data_network_ids": [
"dvportgroup-x",
"dvportgroup-x",
"dvportgroup-x"
],
"reservation_info": {
"memory_reservation": {
"reservation_percentage": 100
},
"cpu_reservation": {
"reservation_in_shares": "HIGH_PRIORITY",
"reservation_in_mhz": 0
}
},
"resource_allocation": {
"cpu_count": 16,
"memory_allocation_in_mb": 65536
},
"placement_type": "VsphereDeploymentConfig"
},
"node_user_settings": {
"cli_username": "admin",
"audit_username": "audit"
}
}

 

0 Kudos
leslier
Contributor
Contributor
Jump to solution

Thanks much for the explainer. Just an update, I was able to fix this by pushing a refresh node config, via this command.

 

https://<manager-ip>/api/v1/transport-nodes/<tn-id>?action=refresh_node_configuration&resource_type=...

 

0 Kudos
ken-gould
VMware Employee
VMware Employee
Jump to solution

Slightly different use case here. Cluster was lost and rebuilt, so there is a different datastore moref

But the edge doesn't exist yet (it needs to be redeployed) , so there is no vm_id yet

Is there any way to pull the trigger on reconfiguring the VM so that the new datastore moref can be set, and then the redeploy api called? 

0 Kudos