Wednesday, May 25, 2011

Installing VMware vCenter Operations 1.0.0

Another day, another VMware acquisition! VMware vCenter Operations (aka vCops, vCops on the block) is VMware’s entry into the operations management market. Not content with providing the hypervisor, VMware have decided to enter the management space. If you have a virtualized environment with no existing management software, vCops is a no brainer. If you’ve got a small to medium environment with a monitoring system you’re not happy with, vCops is worth a look.
To install vCops, you’ll need the following prerequisites.
  1. VMware vCenter Operations

    You can either download a free trial from VMware.com or ask your friendly VMware account manager. I recommend your account manager, because they give you VMware-branded goodies like lanyards and pencils.
  2. IP address

    You’ll need an IP address on a network with connectivity to your ESX hosts. Don’t forget the subnet mask and default gateway too! Is that network a /24 or a /25, I can never remember…
  3. The hostname of your vCenter

    vCops has no automatic vCenter discovery feature, so you’ll need to know the hostname of your vCenter. It’d be nice if VMware baked some auto-discovery magic into OVFs, but we can live without it.
  4. Service account credentialsvCops requires an account to establish a connection to vCenter. If you don’t have a dedicated service account, you can use your vCenter service account.
  5. License key

    A 60-day trial key is available on the vCops download page. If you don’t have a key, you can only go as far as installing the product. You will not be able to login.
  6. A secure password

    Like all other vApps, you’ll need to set a local password.
Got everything you need? Alright, let’s install!
  1. Extract the source media and place the VMware-vcops-1.0.0.0-373027_OVF10.ovf file on your desktop.
  2. In the vCenter client, click File > Deploy OVF Template…
  3. On the Source screen, select the OVF file then click Next.

    Deploy OVF Template - Source
  4. On the OVF Template Details, confirm you have enough disk space then click Next.

    Deploy OVF Template - Template Details
  5. Accept the End User License Agreement then click Next.

    Deploy OVF Template - EULA
  6. On the Name and Location screen, enter the hostname and select the location of the virtual machine then click Next. You can use the default name of VMware vCenter Operations or something that matches your corporate naming scheme.

     Deploy OVF Template - Name and Location
  7. On the Host/Cluster screen, select the host or cluster you want to run CapacityIQ on then click Next.

    Deploy OVF Template - Host / Cluster screen
  8. On the Datastore screen, select the datastore for the CapacityIQ VM then click Next.

    Deploy OVF Template - Datastore Selection
  9. In the Disk Format screen, select the type of disk provisioning you want then click Next. If you’re installing vCops as a trial, thin provisioned is okay.

  10. On the Network Mapping screen, select the network you want vCops to be connected to, then click Next. The security profile is similar to vCenter (similar users, similar access requirements), so you’ll probably want to choose the same network as your vCenter server.

  11. On the Ready to Complete screen, click Finish to deploy vCops.

  12. Wait for vCops to finish deploying. This is the VMware equivalent of watching grass grow. Luckily, deployment is quick.

    Deploying VMware vCenter Operations dialog box
  13. Click Close to complete.

    Deploying VMware vCenter Operations dialog box - complete
  14. Power on the VMware vCenter Operations VM.
    Interesting note: the underlying guest OS is that it is SUSE Linux Enterprise 11 (64-bit).

    vCenter Operations VM in vCenter
  15. Open a console to the VM. You’ll see the server booting.

    Notice the last entry: "check if we are installed in a VMware machine”! Does VMware expect people try run vCops on Hyper-V?!

    vCenter Operations - booting up for the first time
  16. Time to configure! Use your arrow keys to select Configure Network then press Enter.

    vCenter Operations Manager - console configuration menu
  17. It’s time to configure vCops with an IP address.

    vCenter Operations Manager - IP address configuration
  18. When IP configuration is complete, return to the main menu.

    vCenter Operations Manager - IP address configuration
  19. Now select the time zone.

  20. If you’re installing vCops, you’re probably not in the “Queensland – Holiday Islands” time zone, although you might wish you were.

    vCenter Operations Manager - time zone configuration
  21. After configuring the time zone, return to the main menu.
  22. The console-based configuration is complete. You can now close the remote console.
  23. Open a web browser and access the IP address of vCops. If you’ve forgotten what this is, you can always check vCenter. The vCops appliance has VMware Tools installed so the IP address is reported.
  24. The certificate warning can be safely ignored. You’ll have the option of configuring a certificate from your own CA later.

    vCenter Operations Manager - certificate warning
  25. At the vCops login page, login using the username admin and password admin.

    vCenter Operations Manager - login page
  26. You will be prompted to change the default password. Enter the old and new passwords then click Change.

    vCenter Operations Manager - initial password change
  27. At the prompt, click OK.

    vCenter Operations - credentials updated confirmation
  28. Now it’s time to register vCops with vCenter.

    Name: this is a label and can be anything.
    Host (IP): the IP address of your vCenter. Despite the label, using the hostname seems to work fine too.
    Registration user name: the username of the account used to register vCops with vCenter. This is a once-off requirement and won’t be saved.
    Registration password: whatever your password is, hopefully not your name.
    Collection user name: this is the service account saved by vCops that performs collection. If you want to create a dedicated service account for vCops, put the username here. If not, you can specify your vCenter service account.
    Collection password: hopefully not 1234.

    vCenter Operations - vCenter registration

  29. Click Test. If everything is right, you’ll get the message

    The registration credentials are correct.
    The collection credentials are correct.

    vCenter Operations - vCenter registration test success

    If not, don’t despair. Scroll to the bottom of this blog post for some help on registration error messages.
  30. Click Save. You should get the message

    Use the vSphere Client to connect to the registered vCenter Server system and assign a license for vCenter Operations Standard.

    vCenter Operations - vCenter registration instructions

    We’ll do that, but first let’s poke around the vCops console!
  31. The first tab is the Setup tab.

    This is self explanatory. If you want to change any vCenter connection details, you can do this by clicking on the Update or Unregister buttons.

    vCenter Operations - setup tab

    The second tab is SMTP.

    If you want to setup e-mail alerting, this is the place to do it.

    vCenter Operations - SMTP tab

    The Logs tab has the logs for the vApp components. You can generate support bundles here.

    vCenter Operations - logs tab

    The Status tab has some basic status messages. If you’re viewing this tab, you can say with 100% certainty that vCops VM is powered on.

    vCenter Operations - status tab

    The Self tab contains a health view of the vCops vApp.

    vCenter Operations - Self Info tab

    The UI Settings tab contains UI settings, big surprise.

    vCenter Operations - UI Settings tab

    Want to change the admin password? (a good idea because the default is admin/admin!) Do this on the Account tab.

    vCenter Operations - Account tab

    Want to get rid of the annoying self-signed certificate warnings? If your organization has a CA, this is the place to upload the certificate. You don’t seem to be able to generate a Certificate Signing Request (CSR) here though.

    vCenter Operations - SSL Certificate tab

    Okay, that’s all the vCops tabs. But what about the OS Configuration link in the upper-right corner? Click it.

    It dumps you at another login screen. You can login using root and the password you configured in step 26.

    You can perform a guest restart or shutdown of the vCops appliance from the System tab.

    vCenter Operations - system configuration screen

    If you need to change the vCops time zone, you can perform that from the Time Zone screen.

    The Network Status screen has network status…

    …and you can change the IP address details from the Network Address screen

    Proxies can be configured from the Network Proxy screen

    And appliance upgrades can be performed in the Appliance Administration screen.

    Anyway, our work from the console is done. You can logout. Now, back to vCenter…

  32. In vCenter, open the Plug-in Manager (Plug-ins > Manage Plug-ins)
  33. In the Plug-in Manager, ensure that the vCenter Operations Standard plugin is enabled.

    vCenter Operations - vCenter Plug-in Manager
  34. In vCenter, go to the VMware Licensing Manager.
    (Home > Administration > Licensing)
  35. Click the Manage vSphere Licenses button
  36. On the Add License Keys screen, paste the vCops license, add a description then click Add License Keys.
    Click Next to continue.

    vCenter Operations - vCenter - Add License Keys
  37. On the Assign Licenses screen, select vCenter Operations on the left hand side. On the right-hand side, click the vCenter Operations Standard radio button. When you activate the license, a green tick will appear in the action column.

    This step is important! Do not proceed unless you see the green tick! If you don’t do this, vCops will throw an ambiguous licensing error!

    On the Remove License Keys screen, click Next.
  38. On the Confirm Changes screen, click Next to finish.
  39. Now, back to your web browser! Enter the address of vCops and login using your vCenter credentials.

    vCenter Operations - Login Screen
  40. Done!

    (You can also access vCenter Operations through the Solutions and Applications screen in VMware – Home > Solutions and Applications > vCenter Operations Standard)

    vCenter Operations Manager - dashboard
The installation is pretty difficult to screw up. Here are all the errors I was able to generate.
  • If you enter the wrong vCenter IP address, you’ll get the error

    vCenter Operations Standard cannot connect to the vCenter Server system to confirm the registration credentials. Check the status of the VMware VirtualCenter Server service.

    vCenter Operations Standard cannot connect to the vCenter Server system to confirm the registration credentials. Check the status of the VMware VirtualCenter Server service.

    If you enter your username or password incorrectly, you’ll get the error

    The registration user name or password is incorrect.

    image
  • You’ll get a similar error if the collection user name or password is incorrect.

    The registration credentials are correct. The collection user name or password is incorrect.

    The registration credentials are correct. The collection user name or password is incorrect.
  • If you don’t activate the license properly, you’ll get an error message. If this occurs, make sure you add the license into the vSphere License Manager (step 36) AND assign the license (step 37). It’s easy to miss step 37.

    This product is unlicensed. Use a vSphere Client to connect to the vCenter Server and assign a license key.
    This product is unlicensed. Use a vSphere Client to connect to the vCenter Server and assign a license key.
Enjoy vCops!

Monday, May 16, 2011

FlexLM and Furious: Restricting FlexNet license usage

FlexNet licenses are expensive. Sometimes they can cost all your coffee money so it's no wonder you might want to restrict their usage. The FlexNet framework offers a horrific mechanism for restricting license check-out: the options file. Typically named license.opt, the options file is a configuration file that doesn't make sense to anybody.


image
A typical FlexNet license server folder containing an assortment
of files. The options file is labelled ‘4’. Depending on your region, this
may appear as IV or
å››.
 
The options file allows you to restrict license check-out to authorized users (informally known as, "stopping those filthy students from other departments too cheap to buy their own darn AutoCAD licenses"). Can you restrict license check-outs to people in an LDAP or Active Directory group? No. You're restricted to lame methods like
  1. Computer name - This might be useful if you want to authorize license checkout to computers in a specific computer lab or the nodes in a high-performance compute (HPC) cluster. If you're a university, your HPC cluster probably consists of over-clocked Celerons in a datacentre. And if you’re a university, your datacentre is probably a broom closet with an Apple sticker on it.

  2. User name - If you include the line INCLUDE matlab USER paul, I will be able to check-out a MATLAB license for my Donald Trump popularity modelling project. But what if I login from a personal laptop where my user account is DoctorPaulMedicineMan? License check-out denied! And did I mention FlexNet treats usernames as case sensitive? If I login as PAUL or even Paul I'll get the same error: check-out denied!

  3. IP address - this is useful in approximately 0% of circumstances. If your users use DHCP, it's useless. If your users VPN in, they're assigned a VPN address which is useless unless you want to give access to everybody who VPNs in (in which case, you're useless). If your desktops use static IP addresses, you've probably got bigger problems than restricting license checkouts.

  4. Subnet - this would be useful if the programmers at Flexera knew how to subnet. In the magical FlexNet world (I'm not sure how to get there but I think it involves being at the Flexera offices and eating lots of mushrooms) there is no such thing as CIDR. To allow all the users in 172.16.0.1/24 access to the AutoCAD license, you simply include the line INCLUDE autocad INTERNET 172.16.0.* Simply place the asterisk in the subnet octet you want to permit! Awesome! Now, what do you do if it's a /25 and the next subnet is full of hungry AutoCAD who will consume all your licenses like piranhas with humans in a villain's lair?

    Piranhas can be restricted using an options files.
     
  5. Display - you can restrict the check-out of licenses to a /dev/tty or Windows Remote Desktop client name. This was last used when tested in 1987 by a Highland Software engineer and the FBI currently offer a $25 million reward for any tips leading to proof this feature is used.

  6. Project - check-out is restricted to users who have a environment variable set. This is unfathomably useless.
With all these useless mechanisms, how can I properly restrict license check-outs? I'm glad you asked.
  1. Free for all! - if you're reading this blog post, you’re probably looking to restrict license usage so a free for all solution probably isn't acceptable in your organization.

  2. License slave - designate somebody in your organization as a 'license slave'. Restrict license checkouts for controlled applications/features using an options file. If a user wants access to a feature, have the license slave add their username or hostname to the options file. To ensure they are always available to update the options file, simply handcuff them to their desk.

  3. Leverage identity management! - Create a security group for each feature/application you want to restrict. For example, if you want to restrict AutoCAD check-outs, create a security group called Authorized AutoCAD Users Bagel. With some clever ETL skills, you can transform the contents of this security group into an options file! Could this be the topic of an upcoming blog post?!

  4. Leverage directory services - The poor man's version of the above. Instead of using your identity management system to convert the contents of a security group into an options file, write a script to do it. Setup a scheduled task to run this script every second. Don't dare comment the script - this will allow somebody beside yourself to understand it which can only undermine your job security.
Thank you for reading. I'm unsure what my next licensing blog post will be on. Maybe alligators. Or that identity leverage thing.
 

Error "get unknown disk controller type" during a V2V or P2V

In 1927, Ivan Pavlov realized that a bell could be used to condition dogs to salivate. VMware have achieved similar conditioning with virtualization professionals and VMware Converter: a properly conditioned VCP will experience joy when shown a 100% status completed successfully image.
VMware Converter - CompletedVCPs should exert caution when
viewing this image. Too late!
Conversely, when shown a status failed, the VMware evangelist will suffer VMware heartbreak, a condition characterised by keyboard banging and swearing.
VMware Converter - Failed at 85%The message nobody wants to see.
How do you start debugging a VMware Converter problem? Firstly, export the Converter log bundle and unzip it. Open the most recent vmware-converter-worker and vmware-converter-server logs. You can ignore nearly every other file: we’re only interested in the events surrounding the error (which are kept in the most recent logs).
Let’s look at vmware-converter-server-1. VMware Converter logs are like Windows logs except more verbose. The majority of messages are informational (read: useless). Instead of reading every event, look for the event that sticks out like a sore thumb.
[2011-02-10 13:15:24.117 04224 info 'App'] [task,373] [task-2] -- ERROR -- Convert: converter.fault.CloneFault (converter.fault.CloneFault) {
dynamicType = <unset>,
faultCause = (vmodl.MethodFault) null,
description = "unknown disk controller type",
msg = "",
}

The converter.fault.CloneFault is a generic error. The only useful information here is on the description line (highlighted in red) – unknown disk controller type. In this scenario, this error is probably enough to Google on but let’s drill down further. The vmware-converter-server logs only contain high-level error information. For more granular errors messages, we need to look at the vmware-converter-worker log.
[#4] [2011-02-10 13:14:06.509 04808 error 'task-4'] get unknown disk controller type
[#4] [2011-02-10 13:14:06.509 04808 error 'task-4'] hosted to managed disk clone failed: unknown disk controller type
[#4] [2011-02-10 13:14:06.509 04808 error 'task-4'] Disk clone failed with clone error unknown disk controller type

You can Google any of these errors to find the VMware KB article KB 1036719 - V2V conversion fails when using Paravirtual SCSI Controller. If you get this error message, you're probably trying to V2V a virtual machine with a paravirtualized SCSI adapter (aka PVSCSI). VMware have confirmed this as a bug, and they have a lame workaround: change the disk controller type to LSI Logic before the conversion.
“Before? BEFORE?! I’ve already done the V2V! This conversion took 57 hours! I need a resolution that doesn’t involve reconversion!”
I’m not sure why VMware recommended that workaround when a much easier alternative is available: changing the destination disk controller type. To do this, start the conversion wizard. On the Options screen, click the Devices Edit link.
image
Change the Disk controller option from Preserve source to SCSI LSI Logic. Click Next then proceed as normal.
image
For the more astute readers, you’ll notice the title of this blog post is incorrect. If you get this error message, it's because the source machine is a virtual and has a PVSCSI adapter. Therefore, the operation is a V2V and not a P2V. But I put 'P2V' in the title because it's a generic term for conversion and people seem to use the term interchangeably these days.











Monday, May 9, 2011

Moving a guest customization to another vCenter

Do you have multiple vCenters in your environment? Do you deploy VMs from different vCenters? Even if your vCenters are in in linked-mode and have shared storage containing your templates, you’ll still need to manually make guest customizations available on both vCenters. A pain, but easy to rectify. To move a single guest customization to another vCenter, perform the following tasks.
  1. In the Customization Specifications Manager on the source vCenter, right-click on a customization then click Export.
  2. Save the customization somewhere.
  3. Copy this customization to the destination vCenter server
  4. In the Customization Specifications Manager on the destination vCenter, right-click in the whitespace then click Import.
  5. Select the customization XML file.
  6. When the message “The Public key in the specification does not match the vCenter public key. Click OK to open the Customization Specification Wizard, reenter the password and continue the import.” appears, click OK.
  7. Click Next until you reach the Administrator Password section.
  8. At the Administrator Password section, re-enter the administrator password then click Next.
  9. Click Next until you reach the Workgroup or Domain section.
  10. If you want to join your VM to a domain, enter the relevant credentials then click Next.
  11. Click Next until you reach the Ready to Complete section, then click Finish.
Now, that’s good for one guest customization. But what if you have a hundred? Use PowerShell. Arnim over at van-lieshout.com has a great guest customization export and import scripts.

Sunday, May 8, 2011

Validating an XML document with an ISO-Schematron schema on OSX

Schema languages make sure your XML documents are valid. But not all schema languages are equal. ISO-Schematron is great but validation isn't as simple as right-clicking on your XML document in Eclipse and clicking Validate - Eclipse doesn't support ISO-Schematron natively!.

A good free and open-source XSLT and XQuery toolkit is Saxon. You can use the XSLT processor in Saxon to validate XML documents against ISO-Schematron schemas. There are three editions of Saxon - HE (Home Edition), PE (Professional Edition) and EE (Enterprise Edition). For validating the occasional document, Saxon-HE is fine. As of writing, the latest available is 9.3 which you can download here (saxonhe9-3-0-4j.zip).

Here are a few tips for first time Saxon users.

  1. When you've finished downloading Saxon, don't unzip it with OSX's built in Archive Utility. There is a bug in Apple's Archive Utility that affects the way Java .jar files are handled (it "helpfully" extracts the contents of the .jar file). Unzip it with StuffIt Expander (available in the Apple App Store).

  2. The command line usage of Saxon on OSX is slightly different to Windows. The command

    java -jar saxon9he.jar -o output.xsl -s mySchema.sch iso_svrl_for_xslt2.xsl

    will work in Windows but will throw an error in OSX ("Command line option -o requires a value"). You'll need your command slightly: add a colon after the -o operator and remove the space.

    java -jar saxon9he.jar -o:output.xsl -s:mySchema.sch iso_svrl_for_xslt2.xsl

Now, let's test an XML document against an ISO-Schematron schema.

Saxon doesn't simply spit out a 'Your XML document makes no sense' report. It takes two steps to validate an XML document against an ISO-Schematron schema. Step one involves three files.
  1. iso_schematron_skeleton_for_saxon.xsl - this contains the ISO-Schematron schema definition/rules of war! This comes with Saxon.
  2. iso_svrl_for_xslt2.xsl - SVRL is the Schematron Validation Report Language. It prepares your report and shows where you screwed up.
  3. mySchema.sch - this is the schema you've written. It defines valid content.
We need to transform mySchematron.sch with iso_svrl_for_xslt2.xsl to create yet another XSL (let's call it output.xsl). To do this, execute the following command

java -jar saxon9he.jar -o:output.xsl -s:mySchema.sch iso_svrl_for_xslt2.xsl

If your schema was invalid, you'll get a Transformation failed: Run-time errors were reported message. Luckily, the error message is verbose and will tell you what line in your schema is invalid and why. If your schema was valid, you'll now have a output.xsl file.

Now, this output.xsl file you've generated is special. It contains a mashup of your schema with the SVRL. If you transform any XML document with the output.xsl file, you'll get an XML report detailing whether it is valid against your schema! How clever! Let's transform myXMLDocument.xml.

java -jar saxon9he.jar -o:whereDidIScrewUp.xml -s:myXMLDocument.xml output.xsl

In this case, whereDidIScrewUp.xml is the validation report of your XML document.

I hope this helps! I might write a Eclipse plugin if I get some time.

UPDATE: I've been beaten to the punch! Castle Systems have released Schematron-EP (Eclipse Plugin). I've yet to test it.

Friday, May 6, 2011

The virtual machine is running in a monitor mode that is incompatible for Fault Tolerance

And what is a monitor mode?

There are configuration issues for the Fault Tolerance operation. Refer to the errors and warnings list for details.

The virtual machine is running in a monitor mode that is incompatible for Fault Tolerance

image

Solution: turn the VM off, enable FT then power it on.

But that doesn’t answer: what is a monitor mode, and why do I have the wrong one? And why did I have to power the VM off to change the monitor mode?

In VMware, the Virtual Machine Monitor (VMM, or ‘monitor’) is the virtualization layer that presents virtual hardware to the guest. When virtualization technology was removed from the Roswell spacecraft by the VMware Corporation, Intel and AMD did not have virtualization hardware assist in their processors: early hypervisors ran entirely in software. The humans in Intel and AMD optimized their processors with virtualization-friendly features as they came to understand the beautiful alien technology. These processor optimizations (Intel VT-X/EPT, AMD-V/RVI) allowed VMware to optimize their monitor by offloading some virtualization features from software onto the CPU (in theory…)

The VMM has to operate in different modes according to the underlying capabilities of the processor. If the underlying CPU doesn’t have hardware MMU virtualization (hwMMU) support, the VMM cannot take advantage of it. Does this mean that if a CPU has hardware assist functionality, the VMM will always try to use it? No!

Under certain workloads, hardware assistance actually slows down the VM! And some features (like VMware FT) will not function if the monitor is using certain types of hardware assist. If you enable FT on your VM and the VM’s monitor mode is using hardware MMU virtualization, it will fail. Luckily, changing the monitor mode is just a matter of shutting the VM down, enabling FT (so the VMM knows not to use hwMMU), and powering the VM on.

For the most part, you don’t need to worry about monitor modes: the VMM chooses the best most depending on the operating system, your CPU and the VMware features required (FT, VMI). You can change the monitor mode in the the VM settings (VM > Edit Settings > Options > CPU/MMU Virtualization), but it’s not recommended.

An extensive list of default monitor modes for the different virtual machine configurations is available in VMware’s Virtual Machine Monitor Execution Modes in VMware vSphere™ 4.0 document.

Tuesday, May 3, 2011

Error “The server fault ‘SystemError’ had no message.” when working with a VM

Sometimes when you convert a template to a VM it becomes untouchable. When you edit the settings of an untouchable VM, the following error message appears.
image
The server fault ‘SystemError’ had no message.
Call "PropertyCollector.RetrieveContents" for object "propertyCollector" on vCenter Server "myVMwareServer.eight02.com" failed.
Useful eh? Luckily, fixing the problem is easy: just unregister and register the VM. To do that, perform the following tasks.
  1. Make a note of the datastore that contains the untouchable VM.
  2. Unregister the VM from the inventory.
    (right-click on the VM then click Remove from Inventory)
  3. Open the datastore and subfolder containing the untouchable VM.
  4. Register the VMs .VMX file.
    (right-click on the .VMX file then click ‘Add to Inventory’).
Done! The thing I don’t like about this error is it isn’t reproducible. Ah well, hopefully it is fixed in the Adobe Flex vSphere 5 client.

Friday, April 22, 2011

Installing VLC on a jailbroken iPad

So, you've got a jailbroken iPad. Cydia is installed. You've got an international flight in 6 hours and you want some movies to pass the time. Here's a 5 minute guide to getting VLC (and movies!) onto your iPad

  1. If you haven't jailbroken your iPad, you won't have Cydia and you cannot proceed. Refer to my previous blog post.
  2. Open Cydia.
  3. Install VLC.
  4. Install OpenSSH. This will install an FTP server on your iPad. An FTP server is like a drop box for files. You connect to the FTP server via an FTP client, and copy your movies across.
  5. Install a FTP client on your computer. If you're using a Mac, the best client is FileZilla. If you're using Windows, the best client is...FileZilla.
  6. Find the IP address of your iPad. This is in the Settings > Wi-Fi > (Your Access Point)
  7. Open FileZilla and enter the following settings
    1. Host: (your iPad's IP adddress)
    2. Username: root
    3. Password: alpine
  8. The FileZilla screen is split vertically. The left side shows the files on your local computer. The right side shows the files on your iPad.
  9. On the right side, navigate to /private/var/mobile/Media.
  10. On the left side, navigate to the folder containing your movies.
  11. Drag the movies from the left to right.
  12. When you're done, open VLC.
There you go! Now load your iPad quickly: movies copy over Wi-Fi, and you might not have enough time to copy everything you want before your flight departs!

Jailbreaking the iPad on iOS 4.3.2 with redsn0w

I've got a Sydney to Singapore flight tomorrow and I was looking to fill my iPad with the usual international flight movies: a season of Law & Order (the classic seasons when they still used typewriters), some Comedy Central Roasts and a few movies I've been meaning to watch. Normally this would just be a matter of copying movies into the VLC iPad application, but, the VLC application has been removed from the App Store!

Fortunately, it's still available from the Cydia App Store. But this means you'll need to jailbreak your iPad. Normally I leave my iPad jailbroken, but I have a long flight and I want some entertainment...

Items required to jailbreak

  1. redsn0w: you'll need at least version 0.9.6rc14. That won't mean much to you if you don't compulsively follow the iOS jailbreaking scene. In any case, just download it. It's available for both Windows and MacOS.
  2. iPad firmware: this is the 4.3.2 firmware for the iPad. Not the iPad2 - I'm stubbornly holding onto my iPad1. You can download this here. redsn0w modifies this IPSW to contain a payload which contains magic.
  3. iTunes 10.2.2. This is a no brainer. If you're using MacOS, use Software Update to ensure you have the latest version. If you're running Windows, find your nearest Apple Store and buy a Mac.
Now that we've got the tools, let's do it!
  1. Use iTunes to update your iPad to the latest iOS version 4.3.2.
  2. Run redsn0w and follow the instructions.
  3. Done! You'll know if your iPad was successfully jailbroken if there is an extra icon labelled Cydia.
If you're getting the error message "IPSW not recognized", your version of redsn0w isn't new enough. If redsn0w crashes, chances are you've downloaded the wrong iPad firmware. Make sure the iPad firmware you've downloaded matches your actual iPad firmware. You can check your current iPad firmware in Settings > General > About.  If your iPad firmware is 4.3.2 (8H7) and you're trying to run redsn0w on a file that isn't called iPad1,1_4.3.2_8H7_Restore.ipsw, you'll run into problems.

This jailbreak shouldn't take longer than 5 minutes (except for downloading the IPSW - your connection speed may vary!) If the "Downloading Jailbreak Data" screen appears on your iPad for more than 30 seconds, something is wrong.

Anyway, I have to load up my iPad with some movies for my flight. Enjoy your Easter holidays!

Thursday, April 14, 2011

FlexNet, FLEXnet, FlexLM, FLEXlm, it’s the same product, stop renaming it you crazy marketing people: an overview.

Hundreds of years ago, software vendors had a problem. They realized distribution of their software was uncontrolled after they sold their products: that is to say, people pirated their software. Vendors had to rely on the goodwill of their users to not copy their software. Until FlexNet was invented in 1988, times were hard for software vendor salespeople.

Sales person: “Hello customer! I can sell your company 100 licenses of this expensive product for the low price of $100,000!”
User: “If I buy 1 license, will your software stop me from installing it on 100 company computers, all my friends computers and all the computers in my brother-in-law’s electorate?”
Sales person: “No.”
User: “In that case, I’ll buy 1 license.”

Over the next two decades, the FlexNet licensing framework (aka. FLEXnet, FlexLM, Flexlm, Flex Kal El, Flex LM2: Electric Boogaloo and El Flexacabra) would allow vendors to minimize this problem. This worked by having a license server that would keep track of how many licenses were in use, how many licenses the user had purchased, and how many cabbages would be thrown at the user if they tried exceeding this limit (typically a student trying to use a pirated copy of AutoCAD).

But how did they restrict the software to the licensed computer? They did it by locking the software to the only unique and unchangeable serial number a computer has: the MAC address of the network adapter. When you purchase software that is FLEXenabled, the vendor will ask you for your license server MAC address. They will give you a license file which is locked to this MAC address. If you do not provide the vendor a MAC address, they will steal your automobile’s air freshener. It may seem harsh, but this is the price of software license management.

image
A typical MAC address.

Once you have a license file, you can setup your license server. This server needs to be reliable otherwise people won’t be able to use the legally obtained software your company has purchased, driving them to a life of unhappiness and overeating. Your license server needs to be network connected (2600 baud token ring should be fine) because FLEXenabled applications on your client computers need some sort of layer 2 network connectivity to send their license check-out requests.

So Mr. Paul, tell me more about this type of exercise!

OKAY! At its core, FlexNet is a service on a Windows server (or a daemon on a Linux server). In Flex terminology, each service/daemon is referred to as a license server. Here is a screenshot of multiple FlexNet license servers installed on a Windows server. You will require a video card to view the following image.

Windows services: all the crappy license servers
The Windows Services management console. To access this screen, you will need enough money to buy a Windows license.

I have highlighted the FlexNet license servers with red boxes. If your computer only has a CGA or EGA graphics adapter, these may appear as black or light blue boxes. Are you impressed? We can take that one step further. If your computer has Microsoft Silverlight, you can zoom further to reveal more. Let’s zoom in on the Autodesk License Manager to see what the heck a license manager service consists of.

image
A folder containing the FlexNet licensing components. In Linux, the Windows logo in the upper right is replaced with a penguin.

Each FlexNet license server consists of 6 components.

  • The FlexNet license manager (lmgrd.exe) is the server that does everything. When started, it starts the vendor daemon (more on this later), hogs a port (usually 27000) and waits for license management queries. When an application says “My stupid user wants to model Donald Trump’s hairpiece in AutoCAD, are there any AutoCAD licenses remaining?”, the FlexNet license manager replies helpfully with “What? I’m just the project manager, I don’t do any work! Go ask the vendor daemon on port 1234.”
  • The vendor daemon contains the business logic required to determine whether a license is available. When started, the vendor daemon will hog a port and then read the license file to see what you’re entitled to. It will then wait for referrals from the FlexNet license manager. When the client contacts it asking for a license for a particular feature, it will respond with either yay, nay. If it responds with yay, the application will work. It it responds with nay, the application will respond with “YOU HAVE NO LICENSES: BUY MORE LICENSES DEADBEAT” and then fill your house with ghosts who will push you down the stairs and break your legs.
  • The license file contains your entitlement information. A FLEXenabled application could contain many licensed features. For example, the Autodesk Education Suite 2010 consists of the following features, some of which you may or may not be licensed for:
    • Autodesk AutoCAD – 10 licenses
    • Autodesk 3ds Max – 1 license
    • Autodesk Green-Up-Your-Building-Yo – 60,000 licenses
    • Autodesk The White Album - unlimited licenses
    • Autodesk Toupee Modelling – 2,000,000,000 licenses

The license file also contains information on which vendor daemons are allowed to read it.

  • The options file allows license check-out to be restricted. You can restrict licenses to IP addresses, IP ranges, hostnames, usernames, or a combination. This is a useful feature if you think that people named Paul are morons who should never be allowed to use AutoCAD let alone a computer or a refrigerator. The file extension is .opt. If you give an options file a different extension bees will swarm your local pool.
  • The log file contains any server related events (ie. logging when the license server has stopped, started, failed, died, submitted its tax return, run over pedestrians, etc.). The file extension is .log. If anything goes wrong it is about as useful as a log. If you are having issues with your licensing, do not send me your log file. I cannot emphasise that enough.
  • The debug log file contains license related events (ie. when licenses have been checked-in or checked-out). File extension is .debuglog. If you are a linux neckbearded geek with no life, you can write an application which reads this .debuglog file and tells you which license features are most popular (probably that toupee modelling one) and which ones are least popular (so you can stop buying those features and spend the money on Domo merchandise).

How do license checkouts work?

FlexNet is a client-server application. That is to say, the client (your end user) wants to kill the server administrator when the licensing is broken (in a good year, this can be up to 99% of the time). However, in the unlikely event your license infrastructure is working, the license check-out process is as follows.

image

  1. Client contacts the FlexNet Server
    The client (typically a laptop user in a north pole igloo) starts AutoCAD. AutoCAD looks in a few places (system environment variables, Windows registry, licensing files, adjacent barrels) for the hostname and port of the FlexNet license server. It will ask the FlexNet license server for the vendor daemon port.
  2. Server responds with vendor daemon port
    The FlexNet license manager replies with the port of the vendor daemon and sometimes the location of your neighbourhood chemist.
  3. Client responds with license check-out request
    The client responds with “AutoCAD license: give me 1.”
  4. Vendor daemon checks license file
    The vendor daemon determines whether any valid licenses are available.
  5. Vendor daemon replies with yay/nay

So there you have the basics of FlexNet. It is a completely foolproof framework for preventing filthy pirates (read: students) from pirating your application. Some questions still linger: how can I make my license service redundant in case someone drops a lobster into my license sever and destroys it? Where should I purchase cheap name brand footwear? What colour is a license file? I will address these issues in a following post if I feel like it. Stay tuned.

Wednesday, April 13, 2011

Setting up an Aladdin HASP license server

In my last licensing blog post, I wrote about how AnywhereUSB devices could be used to virtualize physical license servers with USB copy protection dongles. In this post, I’ll show you how to setup an Aladdin HASP license server from scratch. Nothing about it isn’t difficult, but the entire process is unintuitive. There are two nearly indistinguishable types of HASP keys, and you’ll need different types of installers for each. And you launch the installer from the monitoring component. So obvious. And the great thing about licensing is, you have no choice! You either figure out how the licensing application works, or you don’t use the software.

To begin, you’ll need three bits of software.
  • Digi AnywhereUSB drivers
    These will install the virtual USB controllers on your server and install the AnywhereUSB management console. If you’re installing the HASP license server on a physical server with USB ports, you obviously don’t need to install this.

  • Aladdin Monitor
    This is a management console for your HASP devices. It shows you what devices are connected, whether the HASP services have started, and the clients that have checked out licenses (for HASP HL keys). It is also the installer for the HASP HL Service. How obvious! The user interface for the Aladdin Monitor is among the worst ever produced (up there with BMW iDrive and SAP).

    You can download the Aladdin monitor installer (aksmon32_setup) here.

  • Aladdin HASP4 server
    The Aladdin HASP4 server acts as an intermediary between Aladdin HASP4 protected applications and the Aladdin HASP4 dongle

    You can download the Aladdin HASP4 server installer (lmsetup.exe) here.
To begin, install the AnywhereUSB drivers. I’ll describe how to install these drivers in a later blog post.
Next, install the Aladdin Monitor by performing the following steps.
  1. Extract the aksmon32_setup.exe file from the package to the destination server.
  2. Run the aksmon32_setup.exe installer.
  3. Unless you are a German speaker, select U.S. English then click OK. Perhaps Aladdin HASP makes more sense if you select German (UPDATE: according to a German reader, no. It isn't any more intuitive in Deutsch).

    Aladdin HASP Monitor installer: select language

  4. At the Welcome screen, click Next.
    Aladdin HASP Monitor installer: welcome screen

  5. At the License Agreement screen, sign away your rights by clicking I agree then clicking Next.

    Aladdin HASP Monitor installer: license agreement screen

  6. At the Destination Location screen, click Next.

    Aladdin HASP Monitor installer: destination installation screen

  7. The installer will ask you if you want to keep a backup. This backup is completely useless, but we’ll select Yes anyway. Click Next.

    Aladdin HASP Monitor installer: backup request screen

  8. Click Next to start the installation of the Aladdin Monitor.

    Aladdin HASP Monitor installer: ready to install screen

  9. Once the installation has completed, click Finish to exit the installer.

    Aladdin HASP Monitor installer: installation complete screen

  10. The Aladdin Monitor is now available in the Start Menu.

    Aladdin HASP monitor link in Start Menu
That was boring! Now time to install the Aladdin HASP HL-Service. You have to do this from within the Aladdin Monitor. How intuitive! Let's begin before you fall asleep.
  1. Open the AKS Monitor application
    (Start > Programs > Aladdin > Monitor > AKS Monitor)

    Aladdin Monitor

  2. Click Services > Hardlock > Install HL Service

    Aladdin Monitor: Install HL-Server Service

  3. A prompt will appear.
    Click OK to accept.
    Aladdin monitor: confirmation of Hardlock service installation

  4. Now it’s time to make sure the HASP HL service automatically restarts if it crashes (a license service crashing? Surely not!).
    Open the Computer Management console (Start > Run > compmgmt.msc)

  5. Select the Services node in the left-hand pane

  6. Select the HL-Server service.
    Aladdin monitor: checking the service start settings

  7. Right-click on the HL-Server service and click Properties.

    Aladdin monitor: checking the service start settings

  8. On the Recovery tab, change the First failure, Second failure and Subsequent failures reponses to Restart the Service.

    Aladdin monitor: setting the HL-Service to restart automatically

  9. Click OK to close the properties window.

  10. Close the Computer Management console.

  11. In the AKS Monitor, click Services > Hardlock > Start HL-Server Service. This will cause the HL-Server service to rescan the network for Aladdin dongles.

    Aladdin monitor: starting the HL-Server

  12. Once the scan is complete, an HL-Server will appear under the HL-Server folder.

    Aladdin monitor: looking at the HL-Server node

  13. Expanding the server node will show all the Aladdin dongles connected to the server. In this case, there is a single Aladdin dongle with the module address of 6903.

    Aladdin monitor: an Hardlock dongle has appeared!
  14. Close the Aladdin Monitor.
Okay, we’re nearly there. If we plug in an Aladdin HASP HL dongle, it will work. Now we need to install the software to support Aladdin HASP4 dongles! To do this, perform the following steps.
  1. Extract the lmsetup.exe file from the package to the destination server.
  2. Run the lmsetup.exe installer.
  3. Select U.S. English then click OK.

    clip_image002[13]

  4. At the Welcome screen, click Next.

    clip_image004[11]

  5. At the End User License Agreement screen, click I accept the license agreement then click Install.

    clip_image006[8]

  6. At the Installation Type screen, select Service (nhsrvice.exe) then click Next.
    Installing it as an application is utterly stupid and would require you to login to start the license service.

    clip_image008[8]

  7. A the Choose Destination Location screen, click Next.

    clip_image010[8]

  8. A the Select Program Manager Group, click Next.

    clip_image012[8]

  9. At the Device Driver Installation screen, click Next.

    This screen will appear even if the appropriate driver is present on the server. Good work guys!

    clip_image014[8]

  10. If a Driver Installation error message appears, click OK to continue.
    This behaviour is by design and expected.

    clip_image016[9]

  11. On the HASP License Manager screen, select Yes then click Finish to complete the installation.

    clip_image018[7]

  12. Now, time to make sure the service automatically restarts when it crashes.

    Open the Computer Management console
    (Start > Run > compmgmt.msc)
  13. Select the Services node in the left-hand pane
  14. Select the HASP Loader service.

    clip_image020

  15. Right-click on the HASP Loader service and click Properties.

    clip_image022

  16. On the Recovery tab, change the First failure, Second failure and Subsequent failures reponses to Restart the Service.

    clip_image024

  17. Click OK to close the properties window.
  18. Close the Computer Management console.
  19. Open the AKS Monitor application
    (Start > Programs > Aladdin > Monitor > AKS Monitor)
  20. The server name will appear under the HASP License Manager server.

    clip_image026

  21. Close the Aladdin Monitor.
Woo, finally done! Now all you need to do is point your HASP clients at your HASP server! Maybe I’ll write a post on that.

Tuesday, April 12, 2011

Deploying VMs with multiple interfaces through PowerCLI

The easiest way of deploying a large amount of VMs quickly is with a PowerCLI script. You write a script that modifies a guest customization, then you deploy from that customization. But how do you configure the IP addresses on the deployed VM?

Get-OSCustomizationNicMapping -spec myCustomization | Set-OSCustomizationNicMapping -IpMode UseStaticIP -IpAddress 192.168.0.100 -SubnetMask 255.255.255.0 -DefaultGateway 192.168.0.1 -Dns 192.168.0.150,192.168.0.151

Get-OSCustomizationNicMapping -spec myCustomization | Set-OSCustomizationNicMapping -IpMode UseStaticIP -IpAddress 192.168.0.100 -SubnetMask 255.255.255.0 -DefaultGateway 192.168.0.1 -Dns 192.168.0.150,192.168.0.151

Simple enough, but what is the server has multiple interfaces? Look at the output above. See the ‘Position’ column? ‘1’ means that the first network adapter is being modified. You can change different network adapters by modifying the Position attribute in the Get-OSCustomizationNicMapping command.

Get-OSCustomizationNicMapping -spec myCustomization | where { $_.Position -eq '1'} | Set-OSCustomizationNicMapping -IpMode UseStaticIP -IpAddress $192.168.0.100 -SubnetMask 255.255.255.0 -DefaultGateway 192.168.0.1 -Dns 192.168.0.1,192.168.0.1

Get-OSCustomizationNicMapping -spec myCustomization | where { $_.Position -eq '1'} | Set-OSCustomizationNicMapping -IpMode UseStaticIP -IpAddress $192.168.0.100 -SubnetMask 255.255.255.0 -DefaultGateway 192.168.0.1 -Dns 192.168.0.1,192.168.0.1

Notice how the output is the same. We can modify the second adapter by changing the Position attribute to 2.

Get-OSCustomizationNicMapping -spec myCustomization | where { $_.Position -eq '2'} | Set-OSCustomizationNicMapping -IpMode UseStaticIP -IpAddress $192.168.0.100 -SubnetMask 255.255.255.0 -DefaultGateway 192.168.0.1 -Dns 192.168.0.1,192.168.0.1

Get-OSCustomizationNicMapping -spec myCustomization | where { $_.Position -eq '2'} | Set-OSCustomizationNicMapping -IpMode UseStaticIP -IpAddress $192.168.0.100 -SubnetMask 255.255.255.0 -DefaultGateway 192.168.0.1 -Dns 192.168.0.1,192.168.0.1

All good. But, you should only have a single default gateway on a server. When we try to execute the command without the –DefaultGateway argument, we get an error message.

Set-OSCustomizationNicMapping : Missing an argument for parameter 'DefaultGateway'. Specify a parameter of type 'System.String' and try again.

Set-OSCustomizationNicMapping : Missing an argument for parameter 'DefaultGateway'. Specify a parameter of type 'System.String' and try again.
At line:1 char:204
+ Get-OSCustomizationNicMapping -spec myCustomization | where { $_.Position -eq '2'} | Set-OSCustomizationNicMapping -IpMode UseStaticIP -IpAddress 192.168.200.100 -SubnetMask 255.255.255.0 -DefaultGateway <<<<  -Dns 192.168.0.150,192.168.0.151
+ CategoryInfo : InvalidArgument: (:) [Set-OSCustomizationNicMapping], ParameterBindingException
+ FullyQualifiedErrorId : MissingArgument,VMware.VimAutomation.ViCore.Cmdlets.Commands.SetOSCustomizationNicMapping

The Set-OSCustomizationNicMapping command has a bug that forces you to have a default gateway! Boo hiss! How do we get around this? Set the OSCustomizationNicMapping so both interfaces have default gateways. Then, use a RunOnce command to remove the default gateway you don’t want. In the Guest Customization settings, go to Run Once and add the command

netsh interface ip delete address “Local Area Connection” address=192.168.0.1 gateway=all

image

This command will delete the default gateway 192.168.0.1 on the interface “Local Area Connection” (the first network adapter). Obviously if you want to delete the default gateway on the second adapter, change this to “Local Area Connection 2”.

I hope this helps you. In the meantime, I will file a bug report with VMware and see if it’s fixed in VMware 5.

Wednesday, April 6, 2011

Jailbreaking the iPhone 4 on iOS 4.3.1 with redsn0w

With every iOS release, you can expect a jailbreak within several weeks. iOS 4.3.1 is no exception! Being the resident office iPhone enthusiast, I've had a few people ask me how to jailbreak their iPhones, and whether it's worth it. It's funny that the why precedes how :)

Well, the good news is that it's simple and straightforward.

  1. To begin, consult the helpful Jailbreak Matrix to see if your iOS firmware and phone model can be jailbroken. If you've bought an iPhone in the last two years, the answer is generally yes.
  2. Download your current iOS firmware (a link is provided in the Jailbreak Matrix).
  3. Download the jailbreaking application redsn0w. redsn0w will modify your downloaded iOS firmware to contain an payload.
  4. Run redsn0w and follow the instructions. redsn0w will modify your downloaded firmware then guide you through the process of uploading it to your phone. This involves placing your iPhone in DFU (Direct Firmware Update) mode, which takes a few tricky keypresses. If you don't get it at first, keep on trying. It took me 4 or 5 times to get it right!
  5. Once the firmware has been uploaded, you can close redsn0w as the rest of the jailbreak takes place on your iPhone.

If you're stuck with a "Moving Applications" screen while your iPhone 4.3.1 is being jailbroken, be patient! I had to wait 4-5 minutes for redsn0w to progress beyond that point. Now that you're waiting for your phone to be jailbroken, check out these 5 bloody good reasons to jailbreak your iPhone!

(Disclaimer: jailbreaking can potentially brick your phone and void your warranty! Only do it if you have a compelling reason. Like BiteSMS).