Using Virtual Machine custom attributes with PowerCLI for snapshotting

Here's a light one to end the week in a good mood! Expect no complex engineering though, PowerCLI scripts to manage snapshots must be very common around!

I manage a small environment where uber-scripting skills are not required. But for the sake of efficiency, laziness and "intellectual effort", here's what I use to patch my machines. All my VMs have custom attributes which include among others Business Owner, Primary IT Administrator, Emergency contact and an obscure one called "IsMirroredToDR". For historical reasons we have a software called HP Storage Mirroring for Virtual Infrastructure (SMVI) which works with ESX 4 (not ESXi), it does a great job but sometimes is a pain when things go wrong. This program creates snapshots and replicates them from production to DR sites at regular intervals for business recovery/continuity purposes.

Now whenever I need to patch servers I of course create snapshots in case something would go wrong. I however need to take special care of the VMs which have the IsMirroredToDR custom attribute set to True. I therefore use the script below to automatically create a snapshot on all VMs that are not mirrored to our DR site, and filter out VMs that are being mirrored so I can take care of those later. Once I have properly stopped all the mirroring processes and ensured all snapshots for these mirrored VMs have been deleted (as in consolidated to the base VMDKs), I then change the "False" to "True", run the script again et voila, even mirrored VMs are snapshotted :-)

I had also tested a version where I also filtered VMs per datacenter, but I somehow didn't save it.

I hope this code snippet will be useful to someone, though it's definitely not rocket science.

Have a nice weekend!

 

#Get a list of VMs who have the IsMirroredToDR custom attribute set to false, then sort ascending
$VMs = @(Get-VM|Get-Annotation -CustomAttribute "IsMirroredToDR" | Where {$_.Value -eq "False"} | Sort-Object AnnotatedEntity)

#begin action on each filtered VM (comment/uncomment as appropriate)
ForEach ($VM in $VMs) { 

#****CREATE SNAPSHOTS****
#New-Snapshot -VM $VM.AnnotatedEntity -Name BeforePatch

}

Post to Twitter

Server Virtualization Workshop

Right after passing my VCP5 last week I was contacted by a colleague from Slovakia who asked if I could provide an presentation to VMware vSphere. I liked the idea and asked in our team if someone would like to attend as well. Another colleague who's currently in a desktop support role and plans to upskill also showed interest, thus I started preparing a small workshop for them.

The workshop was time constrained (one day maximum), therefore I decided to articulate its content as follows:

2 hours theory, including among others:

  • basic introduction to type 1 & type 2 hypervisors
  • company-related stuff (virtualization standards, current infrastructure & design)
  • quick ESXi vs Hyper-V feature comparison (+explanation of Transparent Page Sharing, ballooning, vMotion, svMotion)
  • Presentation of ESXi and vSphere / vCenter
  • VM hardware, Thin/Thick disks
  • Review of all vSphere features with comments/quick explanations
  • VM Networking

3 hours hands-on lab, including:

  • Installation of 2 VMware ESXi hosts
  • Basic host setup (setting up NTP, configuring iSCSI software adapter, adding iSCSI targets)
  • Storage and VM Networking, Introduction to datastores
  • Creating a Windows VM / Installing vCenter Server 5
  • Configuring vCenter Server 5
    • Datacenters
    • Clusters
    • Configure a port group for vMotion
    • High Availability
    • Distributed Resource Scheduler (DRS)
    • Datastore Clusters & Storage Distributed Resource Scheduler (sDRS)
  • Working with the VMware vSphere Client (presentation of the various tabs, performance etc..)
  • Creating and working with VMs (snapshots, clones, templates)

In my opinion the theory part was quite dense, grabbing all these concepts in just two hours must not have been easy. The hands-on lab part was packed as well but was probably more enjoyable as colleagues got to interact and experiment. Techies love to get the ability to click everywhere!

The feedback from my colleagues was very positive, I am looking forward to their written comments on the content and the format of this workshop. I hope to have the possibility to provide more trainings like this in the future.

I started my career in IT 13 years ago by teaching people how to use computers so this was a good occasion to rehearse public speaking and appraise my communication skills. It's good to note that experience is like a good wine, the older the better.

Post to Twitter

VCP5 Certification : Pass!

After a couple months of preparation I decided to put myself out of misery and reserved the VCP5 exam at my local training/testing center in Prague. I took the test 5 days after booking it, leaving me some valuable time to review all I had learned, mark what needed to be improved and do a final check of things in the lab.

Despite much stress before the exam and during the first questions, I was thankfully able to get back in control and focus on what was really important: the exam and questions.  I'm not a native english speaker therefore I was granted additional time over the 90 minutes required to complete the 85 questions. The total allocated time was 135 minutes, but thankfully my english is not so bad and I managed to get the test done within 40 minutes.

My overall feeling is that the test was hard, but at the same time the level of questions was fair.

So was my score in regards to my knowledge as well as my experience both in production and test environments. I thought that the test gives a nice blend of questions related both to theory and practice, and represented the topics in the blueprint.

Here is what I have learned in preparing for the certification:

  • The Install, Configure, Manage course is great for structuring your knowledge but won't suffice for the test. Our trainer warned us of this and recommended us to use the available vSphere documentation and blueprint for guidance
  • Building my own lab and breaking all sort of stuff/simulating failures was crucial in understanding some more obscure concepts
  • Give yourself some time to get comfortable with the advanced features provided in vSphere 5
  • The Exam Blueprint covers all the questions you may be able to find in the exam, some members of the community have created their own blueprints/study notes and these have been a great basis
  • There are a lot of free resources that can help you improve and extend your knowledge around
  • There's nothing like studying hard, learning and being prepared – cramming 1-2 days before the exam won't bring any extra value 
  • I prepared a plan of my weaknesses and sought to address these by reading info/books/documentation (and of course training).

I wouldn't be able to properly close this post without giving out thanks and acknowledgements to people who have made this possible.

First of all, I would like to thank Rob Upham & his colleague Nick Watkins from VMware UK. I met them in London last summer at my company's technology conference. They were very keen to discuss with me about my desire to become certified. They provided me with information and guidance on the topic… and introduced me to Duncan Epping's yellow-bricks.com. Thank you gentlemen for showing the way!

Books

Studying Resources & Blogs

  • My central hub for learning resources online has been Scott Vessey's VMware Training blog. Comprehensive, with lots of links to other members of the VMware community. If you don't know where to start from, go to Scott's site, everything is very well categorized and explained. His site has been my main inspiration so what you will find below is most likely to be redundant with what you'll find on his blog.
  • Andrea Mauro's vInfrastructure Blog and his blueprint with notes
  • Jason Langer & Josh Coen's VCP5 Study Guide (<– guess what I had on me 10 mins before taking the exam)
  • Duncan Epping's yellow-bricks.com is filled with gems, especially enjoyed among others his article on esxtop
  • Lots of great blogs where I've gathered info and which I unfortunately forgot to bookmark 

Blogs with test practices

I spent quite a lot of time on the following excellent sites, which are linked from Scott Vessey's VMware Training blog (see above). 

I would recommend to stay away from brain dump websites which aren't a credible source of learning. I found that the solution to many questions were erroneous, and I would recommend to give priority to hands-on experience over memorization.

Videos & Podcasts

  • Eric Sloof's podcasts are a joy to look at, a video that I enjoyed a lot was about private VLANs, being underskilled in networks it helped me to better understand the matter and how it relates with vSphere.
  • A brilliant series of VCP-related brownbags are announced on Damian Karlson's website. The previously recorded brownbags can be found on Cody Bunch's website. They feature prominent members of the community and cover various objectives of the blueprints. I am not certain how they are organized so feel free to contact me so I can give credit where credit is due.

Conversations/Lab Setup

I had very fruitful conversations about my lab setup with Matt Liebowitz and Tommy Trogden. Thanks to them I found out that I didn't have to sell a kidney to get a decent lab.

Twitter

Did I mention twitter yet? There's a fantastic VMware community active on Twitter. I've had the chance to talk with great folks 

Last but not least – Family & Colleagues!

  • My wonderful pregnant wife for being so supportive, for believing I would achieve the certification, for standing seeing me leave home at 6am and get back past 8pm, to eat some food and put my head in the books/lab again. For being positive, for understanding I needed to focus on this learning and for everything she did to make this learning time easier.
  • My colleagues, for all they did to make my learning easier, for understanding that at some times I would have to focus on the training and for offloading tasks/dealing with some BAU requests.
  • My line manager and department manager, for fully supporting this initiative, for funding the ICM5 course and enabling me to build a lab at work, as well as facilitating my learning. 
  • My supporters, who helped me with some of the costs associated with the learning/lab setup: my dear friend Norberto Gasparotto Filho, a skilled IBM DB/2 Specialist from Brazil who's been hearing a lot of my whining, and my parents who didn't get to see me much with my family on skype for several weeks!

Post to Twitter

The VMware Training Lab is ready!

Hi everyone! One last post before the year's end to mask a long inactivity :-)

The last time I wrote on the blog was about a fundraiser directed to support my lab and education training costs. I was able to negociate with my workplace regarding the hardware, and I went to an easily deployable solution after strongly being inspired by @vTexan's own post.

My initial thought was to setup the lab at home, but considering the fact that our youngest son requires a lot of attention and that my wife is pregnant, I did a u-turn and decided instead to keep the lab at work and use this occasion to train and upskill my colleagues as well. Another benefit is that I don't need to turn my living room into a server room filled with cables, network devices and so on, plus I have all the hardware & cables I need immediately available in the office.

We had enough HP dc7700 sff and Dell Optiplex 755 workstations available at work, so I picked up three machines to setup a lab wich will consist of two ESXi hosts and one NFS server running on OpenFiler 2.3.

Each of the ESXi hosts are the small form factor version of the Optiplex 755 and were upgraded to 8 GB of RAM. The motherboard has 4 banks and supports a maximum of 8 GB so we bought a fair amount of 2x 2GB modules from Kingston. The OpenFiler server runs for now with 2 GB RAM and may get an upgrade later. For this server, I use the medium tower form factor version of the OptiPlex 755, as the SFF version can only mount one HDD. This box is provisional and will get replaced by an HP pizzabox. These machines were around in the office for a long time and I flashed their bios to the latest version to ensure all would be supported. After a couple issues with the VMware vSphere Appliance not starting, I had to disable Intel Trusted Execution on the bios as per instructions on VMware KB1003944.

We added a Cisco Catalyst 3650G switch to provide 1Gbps connectivity and allow for vMotion.

Here's a view of the provisional setup (note how there's no NIC redundancy yet):

There are quite some changes I'm planning ahead:

  • boot from USB
  • get several low profile NICs to provide redundancy and create a separate vMotion vmkernel port group, as well as allowing the use of multipathing and different iSCSI targets.
  • reconfigure the catalyst switch and use vlans
  • bringing in an HP DL360 G5 pizzabox with a bunch of local attached storage. I'm considering I will reconfigure it to use Openfiler, turning the current Optiplex 755 filer into a 3rd ESXi host.

The fun never ends, so stay tuned, and a Merry Christmas to you all!

Max

Post to Twitter

VMware Site Recovery Manager 5 installation fails with the error: Failed to update Perl installation directories.

Penguins

Hello,

A little article to start the week with. Mondays can't be boring!

While installing VMware Site Recovery Manager 5 installation on Windows 2008 R2 I was stuck with the following error at the very end of the install procedure : Failed to update Perl installation directories.

After two more unsuccessful attempts I turned out to my old pal Google who in turns redirected me to the following VMware KB Article.

It turns out that the issue is caused by the PERL installation which depends on the old-school 8.3 filename system. If this is disabled on your system, the installation will fail. You will have to browse to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem and change the value of registry key NtfsDisable8dot3NameCreation to 0, followed by a restart your server.

The KB article also indicates that:

"After enabling this registry setting per the Microsoft article, we must first make sure the VMware vCenter Site Recovery Manager installation folder ( %PROGRAMFILES%\VMware\VMware VCenter Site Recovery Manager or for 64-bit systems:%PROGRAMFILES(X86)%\VMware\VMware VCenter Site Recovery Manager)  is removed before restarting the installer."

In my case, the installation rollback procedure took care of removing the folder, but you may want to double-check.

Enabling 8.3 filename creation helped me successfully install SRM 5.0, I hope it will be helpful to you too! As of now, I have not yet tested whether the registry key can be set back to 1 after the install completes. I will test this and update accordingly.

Have a nice week!

Max

Post to Twitter

Fix for sluggish iPhone 3G on iOS 4.2.1

EDIT 28-Sep-2011 : Do not take this as a definitive fix. I need to hard reset my phone every day with 4.2.1 – The reasons why I wanted 4.2.1 were very questionable (tilt-shift filter capacity in instagram!), therefore a revert to 3.1.3 is planned, and so is the purchase of a Windows Phone 7 model.

 

I've recently installed iOS 4.2.1 over my jailbreaked 3.1.3 because of some apps I needed. I was struck by the very poor responsiveness of the device. I recall it being way faster when I bought it two years ago.

I searched for resources on the net and found inspiration here: http://appletoolbox.com/2010/11/iphone-slow-after-ios-4-2-1-update-fixes/

I remember that with Location Services disabled I was avoiding a lot of hassle and delays in some social apps. Checking the advices provided, I decided to disable the following services:

- Spotlight Search
- Location Services

For smooth user experience reasons, I also disabled the Auto join WiFi network prompt, which always jumps on your face in the most inappropriate moments.

I followed these changes by two consecutive hard resets.

Guess what? Someone is happy with his rejuvenated iPhone 3G!

Post to Twitter

DoubleTake (HP Storage Mirroring Recover) x64 – Memory leak issue in version 5.2.2.1741 (fixed)

Dears,

more than 10 months and I haven't posted anything! I've been extremely busy, to say the least. Family life and ramping up work projects take their toll on free time, hobbies and blogging. My family sees me rarely enough so I don't want to deprive them of these rare and precious moments, especially with my 1 year old boy!

As the title says above, I've come across an interesting issue experienced in Windows 2008 R2 while running the 64-Bit DoubleTake 5.2.2.1741 agent (also known as HP Storage Mirroring Recover). The situation was that after running almost normally for 2-3 weeks, DoubleTake would start leaking memory, consuming up all the available memory thus forcing system to swap to disk. In this case, the virtual machine (a file server) had 4 GB RAM and once this was committed, the swap file increased to 16 GB. At the same time, because the folder used for replication was located on the C: drive, and was using up some space as well, the server ended up with less than 100 MB available on the disk. This of course is very bad news. The system became totally unresponsive and had to be reset.

An incident was raised with HP and they acknowledged that the 5.2.2.1741 version has known problems and needs to be upgraded to 5.2.2.1865.6, which we did promptly. At the same time, I reconfigured our source and target servers to use a dedicated folder on a larger disk (to avoid exhaustion of free space on disk C).  Hopefully this should fix the issue for good.

I hope this post will give something to chew for those who follow it and who lost faith in ever seeing something new published on it!

Let's be honest, I am posting because I wanted to share some information of interest before cutting off all ties with the civilized world as I prepare for my core leave… 2 weeks in the French Riviera, at my parents, with the whole family. Needless to say, I'm very much looking forward! I will put Active Directory and Virtualization books aside for 2 weeks, and enjoy a suntan a some swimming!

Have all fun and enjoy your holidays :-)

Max

{EAV_BLOG_VER:ed070426dfbfd13f}

Post to Twitter

A quick spring update + ask your questions by twitter

Dear visitors, I hope you have been well. Time flies at the speed of light, and I realize that my last blog post was written two months ago, with the latest significant IT-related post being at least 4 months old. Saying that I've been pretty busy is the very least I can tell. A lot of work, family life, and studying towards certifications are enough to take you away from writing!

I hope to update this blog as soon as I'll get my hands on a significant issue to solve. There have been many, but when you're in the rush of it and forget to take note of it, you tend to consider it as past and resolved, and you just file it on some dark corner of your mind.

I don't see myself being less busy at least for a couple coming months… but I have got a little idea.

If you have some questions to ask, feel free to contact me through twitter… and I'll try to give a hand!

Take care and have a great sunday!
Max

Post to Twitter

The 33 keywords of death on Twitter

Hey all!

Just for fun, I will divert from technical blogging to celebrate the end of 2010 with a bit of humor.

I've done some cleanup today on my main twitter account because of huge amounts of spam on my timeline. While removing accounts I came accross a very interesting pattern of keywords that used to show up on these spammer accounts descriptions. 

Some of them are absolutely ludicrous, such as the infopreneur, the business ninja or the mentalist. I tend to believe that people who put that in their descriptions are either the next generation of web 2.0 egomaniac crooks or totally desperate cases.

Father of 5, marketeer, strategist and world-known syndicator. Marketing coach and success mentor.

I've had to laugh and take the time to look at the profile of a 14 years old entrepreneur. Do these guys use a description generator?

That's rather risible sad to see how a word has become mutilated by a generation of people enslaved by social media. An entrepreneur, to quote wikipedia, is in its original sense "one who undertakes an enterprise, especially a contractor, acting as intermediatory between capital and labour". There's a big difference between undertaking an enterprise and having a robot post automated links on your twitter stream, making a page with a youtube video where you explain how to do business and how you sit at home and make 1000$ a week. Still the same kind of crap you could find in your local newspaper or on the Reader's Digest, but 2.0 enabled.

Rants aside, here's the list. Some of these words can (and often are) combined together. Enjoy!

affiliate
cash
coach
entrepreneur
entrepreneurial
fitness
foreclosure
forex
guru
health
idea
income
infopreneur
junkie
listing
loan
marketeer
marketing
mentalist
mentor
mlm
money
mortgage
ninja
nutrition
seo
strategist
success
syndicator
tips
traffic
trainer
wholesaler

So dear blog followers, I end this note and wish you all in advance a very happy and successful New Year 2011!

Max

P.S. : I've got the GFS rotation working smoothly for a month now. I will post an update sometime in January about the solution, time permitting :-)

Post to Twitter

Automated Tape Withdrawal with EMC Networker

NOTE: As of today, I am still solving several issues related to this that are peculiar to the way EMC Networker is implemented. Expect more updates on this issue.

 

Recently I've been designing a Backup GFS Rotation with EMC Networker (GFS Stands for Grandfather-Father-Son, google will be your friend). Things went quite smoothly up to the point where I had to tell networker to eject some of the tapes for off-site storage.

To make things a bit more understandable, the GFS rotation works upon this scheme:
- Daily backups from monday to thursday
- Weekly backups on friday
- Monthly backups on 1st of month
- Yearly backup on 31 December each year

The aim of a backup being to have data available in case of a crisis or catastrophical failure, we want to have weekly, monthly and yearly tapes stored securely and away of the production site. Because we have a tape library, we are able to manage a variety of tapes that are each set in a dfifferent pool and we have those from weekly monthly and yearly pools moved to the I/O station of the tape library. The I/O station is a tray that allows backup operators to either deposit or withdraw cartridges from the tape library.

Because I am not an expert with Networker (self upskilling has its limits), I have requested help from EMC. A very friendly Technical Support Engineer helped me figure out what was needed to gather the tape labels and to perform the withdrawal. However, it quickly appeared that our tape library doesn't supports 'ADD' and 'REMOVE' commands. I was therefore unable to rely on nsrjb -x -T [tape_label] -w to perform the extraction.

After talking with another TSE, we were able to check that our library (IBM TS3200, 4U) supports at least slot-based operations. That wasn't however very reassuring, as there was no evident way to link the volume label info returned by mminfo into something that would report a slot number or anything that nsrjb would process for the withdrawal operation. The only thing we came up with is that nsrjb launched without parameters prints a list of slots and volumes plus other data on stdout.

Without escape lane, I thought of a solution that would help me to link volume label and slot. The only place where I could get both was when launching nsrjb without parameters. But then, I needed to extract this data and compare it.

I thought that parsing nsrjb stdout with FOR /F would allow me to know which tape is on which library slot. But then I needed to make sure that we process only the tapes that are from today's backup set. Why today? Considering that the job is run only when weekly, monthly or yearly save groups are
ran, and that this is launched immediately after a save group completes, the 'today' parameter is relevant. For example: we are friday 1st october, the monthly job launches, when it finishes, savepnpc starts the required post-backup script (the one relevant to ejection), we check for backups that were completed today (completed just before the backup), tapes are found and are subsequently ejected.

Therefore, we filter the list of savesets returned by mminfo with the 'today' criteria (see full command below).
Then with the variables we have extracted to perform the comparison, we launch a 2nd batch file and pass these variables as script parameters (slot number and volume label). This batch will write an entry in a log file, then unload tapes that can be in the tape reader and moves them to the library, then moves tapes from the library into any available I/O station port.

The solution I designed is made of two scripts:
list.bat -> checks for today backups and returns volume labels, parses nsrjb output, searchs for a match between today's tapes and nsrjb output. If a match is found, the slot number and volume label are passed as parameters to match.bat

match.bat -> launched with two arguments: slot number and volume label. For every volume label, tries to unmount the tape from tape mechanism, moves it to any available I/O station port (in our case, 3 slots), then writes an entry to a logfile.

If your tape library is off-site, you can share this logfile on a network location with the teams that will be collecting the tapes. In order to ensure logging and quality, I recommend making up a yearly calendar with expected collection days and which kind of backup the team is expected to collect, in addition to this, keeping a log file of tape deposits/withdrawals is highly recommended.

I hope this solution will help some of you solve a quite annoying issue!

Cheers for now and stay hooked to the blog for more features!
Max

Here is the code of both files:

list.bat
FOR /F %%A IN ('mminfo -q "client=client_name,savetime>=today" -ot -r barcode') DO FOR /F "skip=3 tokens=1,2,3 delims=: " %%B IN ('nsrjb') DO IF %%A==%%C match.bat %%B %%A

match.bat
REM MATCH.BAT Slot_Number Volume_Label
ECHO "%date% – %time % – Ejecting volume %2 located into slot %1 into ports 1-3" >> C:\tape_withdraw.txt
nsrjb -u %2
nsrjb -w -S %1 -P 1-3

Post to Twitter

show
 
close