Upgrading NSX from the Command line

Every once in a while a new version of NSX comes out which you need to upgrade to. Last week NSX 6.1.3 was GAed and being the good techie I am I needed(wanted) to upgrade to it. Now I travel a lot and use remove VPN to access my lab at home and that’s where the problem started.

The upgrade process for NSX is pretty easy as long as you follow procedure and have local access. The process involves in opening a WEB connection to the NSX manager and then clicking on the upgrade button, which then pop-ups a file browser… Uploading a 2.5 GB file using a VPN connection from a hotel is something I attempted once and generally I decided never to do this again. So I needed another solution, API access!!!!

Step 1 – Get the NSX upgrade bundle

The first thing you need to do is get the NSX upgrade bundle. The problem with this is that you need to use a browser and the damn file is then local which you then have to upload bla bla bla…  The solution that I have found is by using my local browser to login to my.vmware.com, select the file I need and start the download. Then I copy the Download URL, login to my homelab and wget the file making sure I use the -O option to save the file.

wget "https://download2.vmware.com/software/NSX-V-610/VMware-NSX-Manager-upgrade-bundle-6.1.3-2591148.tar.gz?<REMOVED>" -O "VMware-NSX-Manager-upgrade-bundle-6.1.3-2591148.tar.gz"

This will save the upgrade bundle locally.

Step 2 – Upload the NSX upgrade bundle

The next step is to upload the NSX bundle to the NSX manager and for that we use CURL. Here is the code:

curl -i -v -k -u admin: -H 'Accept:application/xml' -F file=@VMware-NSX-Manager-upgrade-bundle-6.1.3-2591148.tar.gz -X POST https:///api/1.0/appliance-management/upgrade/uploadbundle/NSX -o upload.out

This will allow you to upload the bundle from you local site.

Step 3 – Check that the NSX bundle is uploaded

Next is to make sure that the bundle has been uploaded correctly:

curl -k -u admin: -H "Accept:application/xml" -X GET https:///api/1.0/appliance-management/upgrade/information/NSX

This should output the following:



    6.1.1
    6.1.3
    Upgrade to 6.1.3
    
        
            preUpgradeChecks1:Q1
            Do you want to enable SSH ?
            YESNO
        
    
    
        
            ValidationStep
            Upgrade Bundle Validation
            Upgrade bundle will be validated before the actual upgrade process.
        
        
            UpgradeStep
            Upgrade NSX manager
            Upgrade process for NSX Manager will begin.
        
    
    Please take a snapshot of the VM before proceeding with the upgrade.

Step 4 – Make a backup and snapshot

Before you upgrade make a backup!!!! how to do this LMGTFY 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *