Network Load Balancing (WLBS) and virtual machines

We where having trouble configuring a new network load balancing (WLBS) cluster. We have several host machines that each run a guest where all guests should be part of one cluster.

We started by preparing the first guest:

  • Created diskimages
  • Installed the os
  • Installed software
  • Updated all software
  • Shutdown

 

We now have a virtual machine and then

  • Copied it to all host machines
  • Started all guest
  • Add all guest to a domain

 

This is where weird behavior started to occur as some guest could not communicate and worst of all we could not create a network load balancing cluster with the network load balancing manager.

Turns out that all guests shared the same SID and NIC id’s. We forgot to

  • Run SysInternal’s NewSid tool on each guest to reset the SID
  • Remove the virtual NIC’s and re-adding them to reset the NIC id’s.

 

A bit of information can be found at the following knowledge base article:

Network Load Balancing Manager does not work with imaged servers

No interfaces are available for installing a new cluster

http://support.microsoft.com/kb/828258

So what is the lesson learned? That after copying a virtual machine to remove all NIC’s at first startup, rebooting AND then running NewSid BEFORE adding the guest to a domain. I knew about the SID issues as I experienced similar behavior in the old days when you created Ghost images and restored them on several machines but what is new for me is the NIC stuff.

Windows cannot access the specified device, path, or file. You may not have the appropriate permissions to access the item.

Anyone will get this message sooner or later so the normal steps I usually do are:

Check if I have read/execute permissions on the file

Check if it is blocked because it is an internet download and then unblock it

Check if I’m the owner

Well today I did this on a file that I downloaden on server A, copied to a storage server and then copying it to server B to run it again. I got this message and did the steps above without any success.

The almighty google helped me again but not in the first few hits on the error. It guided me to a forum where the solution was posted to the message Windows cannot access the specified device, path, or file.  You may not have the appropriate permissions to access the item.

“Un-install IE Enhanced security from Windows Components. Viola problem gone”

I tried it and I can now execute those files although it should have worked as all security attributes on the file where set correctly. Very weird…

Remote Desktop Copy & Paste

In Microsoft Virtual PC you can drag & drop files between your host and the virtual machines and this was (I thought) missing in remote desktop. But this feature isn’t missing it is just disabled at default. To enable it you must share your local drive with the remote machine/desktop session.

  • Open the options for your remote desktop connection
  • Go to the “Local Resources” tab.
  • Select the “More…” button in the “Local devices and resources”

A new dialog opens to configure the resource to share.

  • Check the “Drives” checkbox
  • Click “OK”

See the below screenshots to guide you in locating the checkbox.

Remote Desktop Connection Remote Desktop Connection (2)

 

And presto! Copy and pasting files between local and remote desktop suddenly works!

ForEach method exceptions and events

I just read this article by DigiMortal about List<T>.ForEach and exceptions. His assumption was that if an exception occurs while processing one of the items that the next item would still be processed which is not that case. Maybe he was aware of this (well he is now!) and somebody did not add exception handling to the method called (which by the way is not that methods responsibility IMHO).

Turns out that I had a similar problem a long time ago with events.

class Test
{
    public event EventHandler MyEvent;

    public void DoMyEvent()
    {
        if(MyEvent!=null)
        {
            MyEvent(this, EventArgs.Empty);
        }
    }
}

This example allows subscriptions to the MyEvent event. At a certain time I experienced weird application behaviour and the cause was that a subscription raised an exception causing other subscribers not receiving my precious event! As this implementation did not know how stable the subscribers were it needed a redesign and that was the following:

class Test
{
    private readonly List<EventHandler> _myEvent = new List<EventHandler>();

    public event EventHandler MyEvent
    {
        add { _myEvent.Add(value); }
        remove { _myEvent.Remove(value); }
    }

    public void DoMyEvent()
    {
        foreach (var subscriber in _myEvent)
        {
            try
            {
                subscriber.Invoke(this, EventArgs.Empty);
            }
            catch (Exception)
            {
                // Do some logging here or just BAN the subscription!
            }
        }
    }
}

This could contain some errors as I just did this from notepad but you bet the idea. The cool thing is that you can rewrite the DoMyEvent method to invoke all subscriptions simultaneously which can be very neat if they do expensive remote calls.

  • Recent Posts
  • Recent Comments
  • Archives
  • Categories
  • Meta