Friday, February 17, 2017

Deleting an orphaned virtual machine when the Remove option is not available

So, I was testing out our new lab environment this week for the VMware Authorized class; vSphere Install, Configure & Manage 6.5, when I realized the current version has the student inadvertently create an orphaned VM.

The interesting thing is how it happened and what the resolution is.

So, we have a VCSA 6.5 vCenter and 2 ESXi 6.5 hosts joined to it.  The lab manual has us build a nested VCSA VM to run through the installation of VCSA.  AS soon as you get the VM setup, they have you delete it.  BUT, they have you use the new embedded Host Client which debuted in ESXi 6.0 with Update 2. 

Since you do this from the host & NOT from the Web Client or new vSphere Client (HTML5) through vCenter, the VM is gone, but the object in vCenter inventory that represents the VM still exists and shows up as orphaned:
 
No problem you say, just right click on it and choose Remove or choose Remove from the Actions menu... not so fast, it doesn't exist there:
 
Ok you say, well, surely it must be available in the new vSphere Client (HTML5), right?  NOPE:
 
OK, so how do you remove it from inventory when there are no options to do so.  Well, thanks to KB 1011468 https://kb.vmware.com/kb/1011468, we have a workaround. 
Here are the steps:
  1. Open VMware Infrastructure or vSphere Client and connect to vCenter Server with a user with Administrative rights.
  2. Change the view to the VMs and Templates inventory view.
  3. On the left pane, right-click vCenter Server, click New Folder and provide an alpha-numeric name to the folder.
  4. Click the virtual machine and while holding the left mouse button, drag the virtual machine to the folder created in step 3.
  5. Right-click the folder, and click Remove. The folder and its contents are deleted.
Simple right?  Wrong...
This KB is OLD, so in Step 1 in vSphere 6.5, you might see a problem ...  There is no Windows based vSphere Client available.  But hold it, the KB shows support for vCenter 6.5, how can that be?

Well, here's a little known fact.  IF you have the 6.0 Update 2 version of the OLD Windows based vSphere Client installed, you can actually use it to connect to vSphere 6.5!  Well, kind of, you CAN connect to an ESXi 6.5 host but NOT a vCenter 6.5 server.  So again we are stuck.

OK, so the real answer is to use the command line. 
You need to remove the VM information from the vCenter database. 
One easy way is with PowerCLI 6.5 Release 1, you need to:
  1. Connect to vCenter with a connect-viserver <VC FQDN>
  2. Issue the command get-vm | select name so you can see the VM in question
  3. Issue a remove-vm <VM name> to remove the orphaned VM 
  4. Re-run the original command to verify it's gone and view the inventory!

We start with this VM:
 
We list VMs in VC inventory & Delete the selected VM & Re-list:
 
And you can see the VM is now gone from inventory!

 
So, I've mentioned to my students before, although you can do the vast majority of what you need using a GUI, you may need some command line skills to do certain things when the GUI is lacking.

Never too late to learn PowerShell with PowerCLI for vSphere 6.5! 


Friday, February 10, 2017

How to disable DRS for a single host in the cluster

I saw a question today which was interesting, how do I disable DRS for a single host in the cluster? I thought about it, and you cannot do this within the UI, at least… there is no “disable DRS” option on a host level. You can enable/disable it on a cluster level but that is it. But there are of course ways to ensure a host is not considered by DRS:
  1. Place the host in maintenance mode
    This will result in the host not being used by DRS. However it also means the host won’t be used by HA and you cannot run any workloads on it.
  2. Create “VM/Host” affinity rules and exclude the host that needs to be DRS disabled. That way all current workloads will not run, or be considered to run, on that particular host. If you create “must” rules this is guaranteed, if you create “should” rules then at least HA can still use the host for restarts but unless there is severe memory pressure or you hit 100 CPU utilization it will not be used by DRS either.
  3. Disable the vMotion VMkernel interface
    This will result in not being able to vMotion any VMs to the host (and not from the host either). However, HA will still consider it for restarts and you can run workloads on the host, and the host will be considered for “initial placement” during a power-on of a VM.
I will file a feature request for a “disable drs” on a particular host option in the UI, I guess it could be useful for some in certain scenarios.

Original post by Duncan Epping from yellow-bricks.com
http://www.yellow-bricks.com/2017/01/17/disable-drs-single-host-cluster/

Friday, February 3, 2017

VMware VCSA 6.5 Backup and Restore How-to

VMware VCSA 6.5 Backup and Restore How-to.

Note that it is an “out-of-the-box” feature which does a file level backup. It’s “built-in” within the appliance itself, and it allows users to backup not only the vCenter Server but also Platform Services Controller (PSC) appliances directly. VCSA with embedded or external Platform Services Controller (PSC) is supported.

As you might imagine, the restore has to be launched from somewhere. When you’re in a situation when your VCSA is broken, you’ll have to first deploy clean VCSA via the Installation/deployment ISO, but you do that within the restore operation.

 

What is backed up?

The minimum set of data needed is backed up by default. Those are for example the OS, vCenter services and Inventory. You can additionally backup also Inventory, configuration, and historical data (Statistics, events, and tasks) in vCenter server database

So during the restore operation, you deploy a clean VCSA (phase 1) and you restore from backup (phase 2).  The vCenter Server UUID and all configuration settings are restored. The backup file is stored elsewhere, not on the VCSA itself. VCSA backup can be backed and sent up to different location via different protocols:
  • FTP
  • FTPS
  • HTTP
  • HTTPS
  • SCP

VMware VCSA 6.5 Backup and Restore How-To

Browse to https://VCSA:5480 >


Log in with the password you entered when you have deployed the solution. You’ll see this nice new UI….


After you log in, then you can hit the big Backup button. A wizard will start….


There you’ll be presented with a nice wizard which will allow you to specify where you want to send this backup. The location must be an empty folder. Note the option to encrypt your backup data, a simple check box.

Note the option to encrypt your backup data, a simple check box……



NOTE:  If you use HTTP or HTTPS, you must enable WebDAV on the backup Web server.

The Encrypt Backup Data checkbox, when checked, a new section appears inviting you to put login/password combination. The password form is intelligently checking if you enter twice the same password. If not, you have a small notification telling you that your passwords do not match.
And then I entered the backup setting, such as protocol, login/password combination (make sure to give read/write rights on the folder where you’re backing up) > and finish the wizard.


Note: To check which services are not running you go SSH to the VCSA 6.5 appliance and run

    service-control — status

which gives you services which run on one line, and also services which are not running. The “vmware-stsd” service should be normally running.

To start the service:

    service-control  — start vmware-stsd

Restore operation

Well, from then it is very straightforward. Just quickly…

Launch the setup application of the VCSA 6.5 (from the ISO)
  1. Click the Restore button
  2. Deploy a new appliance using the wizard.
  3. Accept EULA
  4. Enter Backup details
  5. Review backup information
  6. Enter appliance deployment target (ESXi host) ….. from them it is pretty similar to a clean deployment…