UNITY- POWERSHELL : THE FIRST STEPS TO AUTOMATION
Interview by Erwan Quelin: made in Nantes develops scripts for UNITY Dell EMC arrays.
Interview with Erwan Quelin about the development of his PowerShell module
Erwan, based in Nantes, has been a Systems engineer at Cheops Technology for 6 years. He works in multiple ways with a wide variety of clients in the Western region. A specialist in virtualization with VMware products and in storage using the VNX, Unity and VPLEX product families from Dell EMC, Erwan is certified as a VMware Certified Professional-Data center virtualization 4, 5 and 6 and as an EMC Implementation Engineer-VNX and Unity, and has recently joined the vExpert VMWare program and Dell EMC Elect for the year 2017.
Erwan, could you tell us a little more about the development of this script?
Automation of the IT system is a major topic which is not limited only to GAFA. As part of my service and my work I always try to automate tasks which can sometimes be repetitive but necessary to create a storage array or a virtualization infrastructure in an optimal and permanent way. This has created a real time savings on tasks that bring no added value for my customers (like creating X LUNs…) and also ensures me consistency in my deployments, for example, by ensuring such that both arrays are configured strictly identically.
When Dell EMC released Unity arrays on the market, I quickly took an interest in the fact that they had a RESTFul API which makes it possible to administer them via simple http requests. Having noticed this, I started developing a PowerShell module which would make it possible to fully administer EMC Unity arrays from the command line.
Can you give us more details about this module?
Before we get into the details of the Unity-PowerShell module, it may be necessary to explain what PowerShell is and why it is interesting compared with other languages.
PowerShell is both a scripting language based on .NET and an online command interface. It is developed by Microsoft and replaces the venerable cmd.exe console, providing additional commands to manage any type of compatible device.
PowerShell is of course mainly used to manage the Microsoft ecosystem (Windows Server, Exchange, SharePoint, etc.) ecosystem, but some vendors make additional commands available in the form of modules to administer their product.
One of the most popular extensions is PowerCLI. This is developed by VMware, and uses the PowerShell command line to administer a range of products from the vendor (vSphere ESXi, vSphere vCenter, etc.). A few months ago, Microsoft made the PowerShell project Open Source, and extended it to the Linux and Mac OS operating systems.
So what does ‘cmdlet’ mean?
PowerShell commands are called Commandlets. When launched unilaterally, they can be used to execute a specific action, such as the Get-Service command, which, as its name indicates, is used to view information about Windows services.
In your opinion, what differentiates PowerShell from its peers?
What makes PowerShell powerful and easy to use is the concepts of object and pipeline. The Get-Service command doesn’t just display text, but generates an object that can be manipulated (for example by applying a filter to show only started services), or to pipe the output into another command. The command below can be used to restart the DnsCache service online:
> Get-Service -Name DnsCache | Restart Service
By adding a little logic with If arguments and other loops, it is possible to develop powerful scripts that can be used to administer a system much more easily.
What is your script used for exactly?
The Unity-PowerShell module has been developed using the same mechanisms. It allows administrators to retrieve information about one or more Unity arrays and to configure them. When a LUN is created, which requires more than ten clicks, the module can be used to perform the same operation with a single command line, and to do this consistently for each LUN created.
The module can be used on any Windows desktop or server as soon as PowerShell 5 is available. It is possible (and recommended) to download and activate the module with the following commands:
> Install Module -Name Unity-PowerShell -Scope Current User > Import-Module -Name Unity PowerShell
When the module is available, the new commands it provides can be listed:
If in doubt, help is available for each command:
> Get-Help -Name Get-UnityPool
Now we have an overview of the subject, let’s get into the meat of the matter and connect to a Unity array. You will need to know its FQDN or IP address and a username and password.
> connect-Unity -Server unity01.okcomputer.lab
If everything goes well, the command will display information to you about the array you are connected to, such as such as the name and model, for example. Now let’s try to retrieve information concerning storage pools. The commands used to query an array all start with GET. Logically enough, you can list the pools with the following command:
It is possible to limit your search to a specific pool.
In these commands we can see an important part of the operation of unity: IDs. Each item is listed not by name but by a unique ID. Consequently, this ID is used in virtually all commands with the module.
For example, if you want to add a description to the first pool, you need to populate the command Set-Unity Pool with the ID ‘pool_1’:
> Set-UnityPool -ID ‘pool_1’ -Description ‘Pool avec FastVP active’
We have seen that with a little practice, these commands are relatively easy to use and can be used advantageously instead of the graphical user interface. The module is developed in PowerShell will give you the ability to integrate it in scripts, which can be used, for example, to create multiple LUNs at a time, then automatically present them to the servers concerned. You could also develop a script to automatically increase the size of a LUN based on criteria that you define.
By using other existing as PowerShell modules, such as Pester (https://github.com/pester/pester), it is possible to define a testing framework which you might use to make sure that your Unity arrays are always configured according to a pre-designed mold.
It would be difficult to describe all possible use cases since the possibilities are great.
I hope this article will help you see the attraction of using the Unity-PowerShell module to administer your Unity arrays, and that it will make you want to take it further. The module is still in development and is open to all contributions, if you feel the desire to write code and documentation, report a bug or simply to provide feedback on the module.
|Don’t hesitate to contact Erwan on Twitter: Follow @erwanquelin
or on GitHub: https://github.com/equelin
Address of Unity-PowerShell project: https://github.com/equelin/unity-PowerShell