If you use Microsoft Windows Azure Pack and WAP Usage used to work but has now mysteriously stopped working then this post is for you. If it has
been working then you need to first set it up and configure it correctly, and you need to read
instead. However, if it still isn’t working after you have done all of that, read on for some tips on how to get it going again.
Be aware that while WAP Usage may not be working for the reason I list below, this is not the only possible reason. I promise more articles will follow covering some of those other reasons but I have to start somewhere.
What needs to be working for WAP Usage to work
1. Virtual Machine Manager.
2. The VMM to Operations Manager connection.
3. Operations Manager.
4. The OperationsManager DB to OperationsManagerDW DB synchronization workflows.
5. The OperationsManagerDW data aggregation workflows.
6. Service Provider Foundation (SPF).
7. The SCSPFDB.
8. The Usage service.
9. The UsageDB.
If WAP usage has stopped working then it has stopped working somewhere in the middle of this, somewhere at the edges, or somewhere in the detail between the bits I have listed.
This article will only cover one very particular way it can stop, and I will follow up additional blogs on the others.
VM display names and SQL DB tables
When designing your application, one of the things you need to think about is how your application will store its data. A very popular way to do this is to use a SQL database as your store. In fact, it is so popular that the Usage service uses no fewer than seven databases, and once you include the end-user billing systems, it is often many more. If you are using a SQL DB then when you are creating your tables you need to specify for each column how big the entries are going to be.
When it comes to WAP Usage we defined the maximum size of certain property tables to be 64 characters, as that is the maximum size of a VM name when you are creating it from VMM (which is what WAP does). When you are creating VMs this way, it cannot be any longer. Unfortunately, as the data is arriving in the Usage DB via the OperationsManagerDW DB, it is possible that some VMs who have their data in the OperationsManagerDW have been created outside of WAP and are managed outside of WAP, and the VM names have been changed to contain more than 64 characters outside of WAP.
It should be noted that the VM display name is not the same thing as the computer name of the VM, but is rather how VMM displays the name of the VM in its console.
When VM names contain more than 64 characters
So what happens when a VM display name is changed to contain more than 64 characters? Put simply, WAP Usage breaks.
The data will have been gathered into the OperationsManager DB and the OperationsManagerDW DB, and it will have been correctly aggregated, however when the SPF service attempts to pull this data into the SPF Usage tables it will fail.
The SPF Usage Metering Retriever encountered an error while attempting to retrieve usage data. All SCSPFDB database changes have been rolled back. Failure information: The given value of type String from the data source cannot be converted to type nvarchar of the specified target column..
How to tell if this is the problem
Run the following SQL against the Operations Manager DB:
select displayname, len(displayname) as [No. of Chars] from basemanagedentity
where FullName LIKE 'Microsoft.SystemCenter.VirtualMachineManager.2012.VirtualMachine:%'
and len(displayname) > 64
This will list the names of all VMs that have been given a display name that can break the Usage service.
Please note that if none are listed then this isn’t your problem.
The easiest way to fix this is to rename the listed VM names so that they are less than or equal to 64 characters, using the console where it was changed in the first place (Hyper-V or VMM). Once done, wait for the data flow to move through and Usage will commence once again.
As I mentioned above, it is possible there are other causes of a breakage in the WAP usage service and I will be adding to this post with some more in the very near future. If this isn’t your problem then keep watching.
| Escalation Engineer | Microsoft GBS Management and Security Division