,

How to redeploy edge transport node in NSX-T(KB#00106)

 Hello Guys,

We all know that "How to redeploy the edge gateway in NSX-V" or "How to change the form factor of NSX-V edge from small to medium or large" but how many of you knows how to do it in NSX-T?

I am sure, till now few are in assumption that it is not relevant to NSX-T (at least first part) 😊

It is well relevant and we do redeploy edge nodes in NSX-T too. In this post I am giving you the method to not only redeploy it but also to change the form factor very easily. I gone through web before I did it by myself and could see very complicated process to replace the exiting node with the newly deployed node.

That might be relevant in some other scenario but my initial issue or goal was to change the existing edge node form factor from Medium to xLarge. So, I used API and it worked just perfect!.

Here you go.

Step1 - Connect the NSX-T using API. #If you don't know how then use comment box.

Step 2 - Use the API call 

GET https://10.112.152.10/policy/api/v1/transport-nodes    #It will give you the detail of all edge nodes

Step 3 - Pick the ID of target edge node from the output of step 2 and run the command as below

GET https://10.112.152.10/policy/api/v1/transport-nodes/7b60f554-a36f-4c71-9d6c-fddf7826da8a

You will get output something like below



Step 4 - Find the form factor parameter in output of step3. You will see like below-



If you have something else configured here then you will find like MEDIUM or SMALL or LARGE. You can change it as per your requirement and copy the entire output what you got in step 3 and paste in the API tool's body in Raw and JSON format.



Step 5 - Now, use below API call to change the form factor

POST https://10.166.171.198/policy/api/v1/transport-nodes/7b60f554-a36f-4c71-9d6c-fddf7826da8a?action=redeploy

it will start the redeployment and will take around 5-15 minutes or more depending upon your infrastructure.

Background process behind all the task is-

1. It put the target node in maintenance mode

2. Power off and remove the node

3. Deploy the new node with modified form factor or any other modified parameter and power it on

4. Register the node in NSX-T database

5. Configure everything as it was before

6. Exit the maintenance mode from new deployed node


Hopefully you could understand the whole process but if any doubt, please use the comment section. I will try my best to reply.


Thank you.

, ,

Get list of edge gateways connected to Internet (KB#00105)

Hello Guys,

I used to get such requests from customers so I thought to share this one to web. Many of you might know this but I am sure that many will have benefit from this post.

My colleagues too requested to share this trick to get the edge gateway name which are connected to internet. 

This sounds tricky but very simple. Try your thought before scroll down and comment :)

If not getting any idea then continue reading it. So, any edge gateway connected to internet through external network, right? and it has a name :) let's say in our case that name is InternetPG. I am assuming that you know the basic VCD stuff like what is the external network and how can we connect an edge gateway to the internet. If not then its time to start the study for the sake of new year. LOL!

Logic is, get the edge gateway name where connected external network name like InternetPG. Now, use this logic in powercli


Connect-CIServer mylabs.vcnotes.in #just to connect VCD
Get-EdgeGateway | Where {$_.ExtensionData.Configuration.GatewayInterfaces.GatewayInterface.name -clike "InternetPG"} | Select Name, orgvdc | out-gridview

I like to take output in gridview, if you want, you can remove out-gridview in above command. You will have output like below one.



Enjoy the year end guys!


,

Unable to modify Edge gateway in vCloud Director (KB#00104)

Hello Guys,

This is not a general issue everyone faces but I have this issue in my platform and customer used to report it after every few days. To help myself and team, I am creating this blog but I will be glad if it help anyone out there.

Issue - Edge gateway modification action failing repeatedly with below like error -

[ e0fe75fa-4eff-48d5-9d9a-73f0020a29d5 ] Cannot update edge gateway "Edge-Gateway" - Cannot update edge gateway "Edge-Gateway" - Could not execute JDBC batch update - Batch entry 0 /* Method: unknown */ /* Method: unknown */ /* delete com.vmware.vcloud.common.model.net.AllocatedIpAddressModel */ delete from allocated_ip_address where id='5a6ee85c-f052-4ba5-b77f-b7932302b4df'::uuid was aborted: ERROR: update or delete on table "allocated_ip_address" violates foreign key constraint "fk_alloc_ip_gw_assigned_ip" on table "gateway_assigned_ip" Detail: Key (id)=(5a6ee85c-f052-4ba5-b77f-b7932302b4df) is still referenced from table "gateway_assigned_ip". Call getNextException to see other errors in the batch. - ERROR: update or delete on table "allocated_ip_address" violates foreign key constraint "fk_alloc_ip_gw_assigned_ip" on table "gateway_assigned_ip" Detail: Key (id)=(5a6ee85c-f052-4ba5-b77f-b7932302b4df) is still referenced from table "gateway_assigned_ip".

Observation - Even if you try to update the description, it fails with similar error. No update is possible until and unless you resolve above mystery.

Resolution - It will be fixed from VCD DB but if you are not that good in DB then I would suggest to open a case with VMware. They will help you out for sure. They always keep on saying that don't change anything in the DB by your own and we will fix it for you. Leverage the support! :) But sometime, you have to fix the issue right now. In that situation, this can help you. I am little good now in DB and know what I am doing so I used to a lot operations in the VCD DB. It is up to you. 

So, if you read the error then you will come to know that the DB table "allocated_ip_address" is having some issues with id "5a6ee85c-f052-4ba5-b77f-b7932302b4df". Let's see what is this ID.

1. Login primary vcd cell and then DB with below command

root@vcdcell01# sudo -u postgres psql vcloud

1. vcloud=# select * from allocated_ip_address where id='5a6ee85c-f052-4ba5-b77f-b7932302b4df';

You will have output like below

-[ RECORD 1 ]-+-------------------------------------

id            | 5a6ee85c-f052-4ba5-b77f-b7932302b4df

scope_id      | 72ead83f-7216-436b-a94f-43cd01aa534e

address       | 57.191.5.195

addr1         | 968820163

timeout       | 9999-12-31 23:59:59.997

last_modified | 2020-03-06 15:54:51.327

state         | 1

Now run next command in the DB only

2. vcloud=# select * from logical_network where scope_id = '72ead83f-7216-436b-a94f-43cd01aa534e';

You will get possibly below output

-[ RECORD 0 ]-+-------------------------------------

 Now you need to find out that where this address 57.191.5.195 is configured. Simplest way, as this error on a edge gateway so, go to edge gateway in GUI, browse to the network and subnet and try to find this IP address which must be assigned to one of the external network. Once you find it then run below command

3. vcloud=# select * from logical_network where name = 'problematic_network_name';

Note that problematic network is the name of the network which has the IP address 57.191.5.195. From above command you will have the ip_scope_id value. Note that please.

Now to fix the issue, please run below command.

4. vcloud=# update allocated_ip_address set scope_id = 'ip_scope_id value, noted from command 3' where id = '5a6ee85c-f052-4ba5-b77f-b7932302b4df';

Now once updated, you will see that there is no more error on the edge gateway while updating it.

Also, this is one of the use case where you can have this issue. I myself know few more use cases which are tough to explain in post.

If you have such issue at your workplace and if VMware too struggle a lot about this, you may try this or reach me out. I will try my best to help you in this situation.

Cheers!

 

Good to Know about VMware Cloud Director (KB#00103)

Hello Folks,

I got feedback from few fellows that I write up about incidents, issues, automation, short and efficient ways to do any task but all these stuff is for those who already works on VCD or on any platform being it NSX, vCenter or powershell. 

Till the date, I haven't published anything like basics of something because I feel that Internet is already full of such stuff. But still, because I received this feedback so I thought to write up for the guys who are fresher in virtualization but in my own way ;)

I have planned to mention "Good to know" things about any product I work on being it VCD, NSX, VRLI, VROPS, vCenter, Usage Meter, vRNI or powershell.

Today, I picked VCD. This is for those who just started learning VCD or want to start learning VCD but I believe few points will help those too who are working with VCD ;)

See, in current circumstances, I think, not only me is short of time but also all the readers too. I believe the information which is being shared should be crisp and to the point. I don't know whether the slide I made to describe the basics of VCD is good enough or not but you can tell me if you think that I should elaborate any other component. I am leaving this to see if it raise any question and helpful anyone out there ;)

You may fill the comment box with your thoughts and questions :)


, , ,

Move multiple disks from one vm to another vm (KB#00102)

Hello Folks,

Adding another solution for one unique challenge I got from my customer. 

Challenge - Customer used to move multiple vmdk files from one vm to another vm in vcenter server. Actual challenge is the time in hand for this operation and number of vmdks to remove are always around 15, 18 or 20 per vm. This activity used to have multiple VMs. This become more challenging at the time of roll back once we have moved all disks from source to target vm. That much of vmdks to move and in short period of time can lead to confusion and human error too.

Solution - I created below powercli script which drastically decrease the time require in such activity and roll back too become very easy with it. Chance of human error is 99% lesser now.

Below is the code -

Function move-vmdk{
clear
$time
= Get-Date
#It will record the timestamp before starting this activity

Write-Host
"Current time is $time"
$sourcevm
= Read-Host "Enter the source VM Name "
Write-Host
"Total number of disk on source vm is" (Get-HardDisk -VM $sourcevm).count -ForegroundColor yellow
$fd
= Get-HardDisk -VM $sourcevm
$TargetVM
= Read-Host "Enter the target VM Name "
Write-Host
"Total number of disk on target vm is" (Get-HardDisk -VM $TargetVM).count -ForegroundColor Green
Write-Host
"This script works with file name of disk to move so please mention the filename of each disk to move in notepad and save it in C:\temp with disklock.txt name"
#save the disk’s location for all the targeted disks to path C:\Temp in notepad file named diskloc.txt
$diskfile
= Get-Content -Path C:\Temp\diskloc.txt
$confirm
= Read-Host -Prompt "Are you sure you want to process for this disk migration (Y/N) "
If
($confirm -eq "y") {
Foreach
($loc in $diskfile){
$trgVM
= Get-VM -Name $TargetVM
$disk
=get-vm -name $SourceVM | Get-HardDisk | Where-Object {($_.Filename -eq $loc)}
Remove-HardDisk
$disk -Confirm:$false
New-HardDisk
-VM $trgVM -DiskPath $loc
Write-host
(" ")
}
}
$time
= Get-Date
#It will record the timestamp after completion of this activity
Write-host
"Operation has been completed succesfully"
Write-Host
"Current time is $time"
Write-Host
"Total number of disk on target vm is" (Get-HardDisk -VM $TargetVM).count -ForegroundColor Green
Write-Host
"Total number of disk on source vm is" (Get-HardDisk -VM $sourcevm).count -ForegroundColor yellow
}

Below is the sample output

Note that time taken is just 32 seconds to move four VMDK files. Just to add, size of vmdk doesn't change the time for this migration.

Hope you will find it useful if you too have such requirement! Any doubt or thought, plesae feel free to comment.

Cheers!