How to tighten binding to a virtual machine
When binding a license to a virtual machine, we recommend setting the QlmLicenseBinding to EQlmUniqueSystemIdentifier2. This binding detects if the user is running on a virtual machine and binds the license to the UUID of the virtual machine.
The UUID of a virtual machine is supposed to be unique. When users clone a virtual machine, they are however presented with the option to create a clone with the same UIID as the source virtual machine. This is typically needed when the purpose of the cloning is to move the virtual machine to a new host. In an enterprise environment, having two virtual machines with the same UUID is problematic from a virtual machine management perspective.
The solution presented here is meant to protect against the use case of two VMs using the same UUID.
The proposed solution creates a new computer unique identifier (computerID) by combining the UUID of the virtual machine with a QLM-generated unique identifier.
To achieve this, you must set the QlmLicenseBinding to EUserDefined and create the computerID at runtime.
The code below shows how to create a new unique computer identifier.
private string GetComputerID ()
{
QlmHardware hw = new QlmHardware();
string computerID = hw.GetUniqueSystemIdentifier2();
string qlm_uuid = GetUniqueVMIdentifier();
if (!String.IsNullOrEmpty(qlm_uuid))
{
computerID += "::" + qlm_uuid;
}
return computerID;
}
private string GetUniqueVMIdentifier ()
{
string qlm_uuid = string.Empty;
QlmHardware hw = new QlmHardware ();
if (hw.RunningOnVM())
{
if (lv.QlmLicenseObject.ReadCookie("qlm_uuid", 0, out qlm_uuid) == false)
{
qlm_uuid = Guid.NewGuid().ToString();
bool userLevelResult;
bool machineLevelResult;
string errorMessage;
lv.QlmLicenseObject.StoreCookie(qlm_uuid, "qlm_uuid", 0, out userLevelResult, out machineLevelResult, out errorMessage);
}
}
return qlm_uuid;
} The code below shows how to use the LicenseValidator class to use the new computer identifier:
Last updated