Wednesday, September 24, 2014

vCAC IaaS database creation script


One of vCloud Automation Center requirements is a database for the IaaS component.
Like said of vCAC Installation Guide, there are a few scenario options for creating the database.

- Create the database Manually
This option uses a script to create the database, tables, storage procedures, etc.
But the vCAC user requires sysadmin privileges on the SQL Server, imagine how happy is the DBA right now.

- Create an empty database
This option uses a script to create an empty database. Tables and views will be created during vCAC installation. The good thing about this approach it that vCAC user does not requires sysadmin privileges, db_owner on vCAC database is enough.

- Create the database through the installation wizard
This option allows you to create the database during the installation procedure, but as the first option, vCAC users must be a sysadmin of the SQL Server.

Despite pros and cons of each scenario, my concern is all about the location of the script.
Just unzip and it’s there, createDatabase.SQL script.

Ow, wait a second, do I need to install the appliance just to get that script ?!?!?!

If you are used with VMware’s installation guides, you will remember there’s always a section with the database creation script.
Well, it’s not the case with vCAC !!!

If you want to create the database up-front to avoid any issue you might have during implementation, here's the script. 
Now you don’t need to deploy a vCAC appliance just to get the script anymore.


/*
Creates the database.

Script Input Variables:
           DBName  : The name of the datbase to create
           DBDir  : The path for the database file without final slash
           LogDir : The path for the log file without final slash

*/
:On Error exit

-- Create the database $(DBName)
-- Database at path $(DBPath)
-- Log at path $(LogPath)
-- fixed: the data and log file path should be the same
-- just like the mssql default data (mdf) and log (ldf) files both reside under the same directory
-- to minimize code change the LogDir is left alone
-- bug 2747: there is case that requires data and log directories seperately so put it back

PRINT N'Creating Database ''$(DBName)''.';
DECLARE @data_dir NVARCHAR(250)
DECLARE @log_dir NVARCHAR(250)
SELECT @data_dir = N'$(DBDir)'
SELECT @log_dir = N'$(LogDir)'
IF @data_dir <> '\.' AND @log_dir <> '\.'
BEGIN
PRINT N'SQL database data and log file directory''$(DBDir)''.';
CREATE DATABASE [$(DBName)] ON PRIMARY
(NAME = N'$(DBName)', FILENAME = N'$(DBDir)\$(DBName).mdf' , SIZE = 1024MB , MAXSIZE = UNLIMITED, FILEGROWTH = 1024MB)

LOG ON
(NAME = N'$(DBName)_log', FILENAME = N'$(LogDir)\$(DBName)_log.ldf' , SIZE = 512MB , MAXSIZE = UNLIMITED, FILEGROWTH = 10%)
COLLATE SQL_Latin1_General_CP1_CI_AS;
END

ELSE

BEGIN
PRINT N'Using default SQL database data and log directory';

CREATE DATABASE [$(DBName)]
ALTER DATABASE [$(DBName)]
MODIFY FILE
(NAME = N'$(DBName)', SIZE = 1024MB, MAXSIZE = UNLIMITED, FILEGROWTH = 1024MB)
ALTER DATABASE [$(DBName)]
MODIFY FILE
(NAME = N'$(DBName)_log', SIZE = 512MB , MAXSIZE = UNLIMITED, FILEGROWTH = 10%)
ALTER DATABASE [$(DBName)]
COLLATE SQL_Latin1_General_CP1_CI_AS;
END

-- Set compatibility level to SQL 2008
PRINT N'Setting database compatibility level to SQL 2008.';
EXEC dbo.sp_dbcmptlevel @dbname=N'$(DBName)', @new_cmptlevel=100;

GO

-- Disable Full Text Search
PRINT N'Disabling full text search.';
IF (1 = FULLTEXTSERVICEPROPERTY('IsFullTextInstalled'))

BEGIN
            EXEC [$(DBName)].[dbo].[sp_fulltext_database] @action = 'disable'
END

GO

-- DB Settings
PRINT N'Setting database settings.';

ALTER DATABASE [$(DBName)] SET ANSI_NULL_DEFAULT OFF
GO

ALTER DATABASE [$(DBName)] SET ANSI_NULLS ON
GO

ALTER DATABASE [$(DBName)] SET ANSI_PADDING ON
GO

ALTER DATABASE [$(DBName)] SET ANSI_WARNINGS ON
GO

ALTER DATABASE [$(DBName)] SET ARITHABORT ON
GO

ALTER DATABASE [$(DBName)] SET AUTO_CLOSE OFF
GO

ALTER DATABASE [$(DBName)] SET AUTO_CREATE_STATISTICS ON
GO

ALTER DATABASE [$(DBName)] SET AUTO_SHRINK OFF
GO

ALTER DATABASE [$(DBName)] SET AUTO_UPDATE_STATISTICS ON
GO

ALTER DATABASE [$(DBName)] SET CURSOR_CLOSE_ON_COMMIT OFF
GO

ALTER DATABASE [$(DBName)] SET CURSOR_DEFAULT  GLOBAL
GO

ALTER DATABASE [$(DBName)] SET CONCAT_NULL_YIELDS_NULL ON
GO

ALTER DATABASE [$(DBName)] SET NUMERIC_ROUNDABORT OFF
GO

ALTER DATABASE [$(DBName)] SET QUOTED_IDENTIFIER ON
GO

ALTER DATABASE [$(DBName)] SET RECURSIVE_TRIGGERS OFF
GO

ALTER DATABASE [$(DBName)] SET ENABLE_BROKER
GO

ALTER DATABASE [$(DBName)] SET AUTO_UPDATE_STATISTICS_ASYNC OFF
GO

ALTER DATABASE [$(DBName)] SET DATE_CORRELATION_OPTIMIZATION OFF
GO

ALTER DATABASE [$(DBName)] SET TRUSTWORTHY OFF
GO

ALTER DATABASE [$(DBName)] SET ALLOW_SNAPSHOT_ISOLATION ON
GO

ALTER DATABASE [$(DBName)] SET PARAMETERIZATION SIMPLE
GO

ALTER DATABASE [$(DBName)] SET  READ_WRITE
GO

ALTER DATABASE [$(DBName)] SET RECOVERY SIMPLE
GO

ALTER DATABASE [$(DBName)] SET  MULTI_USER
GO

ALTER DATABASE [$(DBName)] SET PAGE_VERIFY CHECKSUM 
GO

ALTER DATABASE [$(DBName)] SET DB_CHAINING OFF
GO

ALTER DATABASE [$(DBName)] SET ALLOW_SNAPSHOT_ISOLATION ON
GO

ALTER DATABASE [$(DBName)] SET READ_COMMITTED_SNAPSHOT ON
GO 

END

  

Wednesday, September 17, 2014

Assigning Tags with PowerCLI


A friend of mine had a challenge, identify which VM belongs to which owner !!!
The reason for that is simple. Since here is a service provider ,being able to identify it’s customer’s VMs help them to better manage the environments and specific customer’s needs.

Someone could argue why not to use folders ?!? well, folders would help you to identify just one aspect of  the VM, what if you need to identify every web server belongs to client A ? well why not create subfolders ?  Do you see where I’m going to ? handling hundreads of folders is not ideally.

vCenter 5.1 brough the ability to Tag it’s inventory, meaning you can tag one or more vCenter objects with one or more tags. Then you could easily search them using those tags as well.

Without further ado, let’s see how we accomplished that:

- Go to vCenter, click at HOME, Tags and then at New Category
that will identify the purpose of our tags


- Give it a Name and a Description.
Since it’s intented just for VMs I’m selecting just it. (you could make your tag available for many objects types).


- Click on New Tag to create the tag itself

 - Give it a Name, a Description and pick up the Category we just created before.
Create a tag for each Customer you want to identify


 Now the funny part.
Since you might have hundreds of VMs to Tag, tagging them manually is a hell of a job, so why not use a script for that ?!?

I’m using PowerCLI to manage this task, if you need some information to get it started check the PowerCLI basics here.

- Create a CSV file including the Name of the VM and the Tag you want to assign to them.
You can export the VMs from vCenter running: Get-VM | select Name | Export-CSV c:\temp\vms.csv –NoTypeInformation

Be aware of the first line, which identifies the headers, you will need them later.


- Copy the CSV to a location where you can access (I used c:\temp)

Now let’s Tag those VMs

- On PowerCLI run: Import-CSV c:\temp\vms.csv | % {New-TagAssignment -Tag  $_.Customer -Entity $_.Entity}

It’s done.

To see which VM has been tagged run: Get-TagAssignment


You can also filter based on a specific Customer: Get-VM -Tag “Customer” | select Name


Be aware I’m not the best script guy out there, there might be smatter ways of doing that, use your imagination ; )
The script is provided as is, without any guarantee, make sure you run it on a non-productive environment first to make sure it’s safe.

To learn more about PowerCLI Tag snap-in, click here.

Thursday, September 11, 2014

VMware’s releases during September 2014

Busy week here at VMware with so many products receiving releases, while some of them are just bug fixes others have huge changes, I will try to list the most interesting ones of each one, but I really encourage all of you to read the entirely release notes.

Let’s see what's new though

This release has so many fixes covering areas like Installation, Advanced Services Design, Configuration and provisioning that I wont be able to list here. But It brought some new cool NSX integrations, improvements on reporting a vCO plug-in and much more.

Besides all the fixes, it’s a small release wich did not bring anything new, just the support matrix has been expanded to now includes CentOS 6.5 as a vCD cell and Oracle 12c and SQL 2014 as a database.
But one thing that worths mentioning is that when adding or removing datastores from datastores clusters does not longer impacts vCD. See KB2075366

There’s no new features on this release it’s just bug fixes.

It’s a minor release in terms of new features, like a new container at Home page for vCloud Air, but has fixed a lot of issues (take a look at release notes). It also increased it’s supported databases, supporting now Oracle 12c, SQL 2012 SP 1 and SQL 2014,

WOW, hosts are getting bigger, ESXi now supports hosts with 6TB of RAM, VMware vShiel Endpoint Thin Agent has been renamed to VMware Tools Guest Introspection. There's also some welcome fixes for purple screens that might be happening in some specific situations.

Its follows the supported databases as vCenter and also fixed a issue that took a longer time to a host starts rebooting after some patching.
 
Now the appliance is SUSE Linux Enterprise Server 11 SP3. There’s some changes on Top-N Widget which can now interacts with other widgets and provide filter on the data also there's now specific metrics for Port WWN and Storage Paths, cool right.

Personaly I think SRM 5.8 brought the most interesting new features, now it integrates with vSphere Web Client, also there’s a new vCO plu-in for SRM. If you are also using ESXi 5.5 U2 the Operations Maximum has increased as well. If you don’t want to use an external database now SRM includes an optional vPostgreSQL.
That’s all great news, don’t you think ?

This VR appliance brings interoperability with vCloud Air DR solution out of the box, meaning you dont have to download a specific version anymore.
Also new reporting dashboard that provides summary reports of vSphere Replication usage was provided.

This version changed the way of collection objects in vCenter resulting in a more properly collection, now it’s possible to set a purge day setting for logs besides of a more intuitive vCAC integration and improvements at plugin-SDK and Rest API.

USB 3.0 support is now included, expanded virtual printing support and HTML access is now fully supported on Windows 8  and Windows 8.1 remote desktops are just a few examples of news on this release.

This version is focus on integration, as with vCAC 6.1, and as addition of your preferred public clouds or vCloud Air, also some enhancements on usability and reporting.

This release provides fast time to value with more automation and focused information and business cases with Out of the Box Dashboards, Installaion and deployment enhacements, usability improvements and also fixes for some issues that might be driver you crazy ; )

Good reading... I know it’s a lot to digest

Friday, September 5, 2014

VMworld 2014 Hands-On Lab


If you missed vmworld2014 or did not have a change to take a lab while you were there, that’s your change to take it.
VMware is already publishing the new labs debuted at VMworld 2014 at Hands-On Lab (HOL).

That means you don’t need to wait until vmworld 2014 Europe finishes to start trying the new products and features, it’s all there at HOL.
If some lab is not available yet, just check next week, the Labs are being published weekly by VMware, we will get there ; )

One thing you will notice is that there’s no easy way to say which one is from vmworld2014, the trick is to use the search box, everything starting with “-14” is new.


 
Good Lab Time
 

Who am I

My photo
I’m an IT specialist with over 15 years of experience, working from IT infrastructure to management products, troubleshooting and project management skills from medium to large environments. Nowadays I'm working for VMware as a Consulting Architect, helping customers to embrace the Cloud Era and make them successfully on their journey. Despite the fact I'm a VMware employee these postings reflect my own opinion and do not represents VMware's position, strategies or opinions.

Most Viewed Posts

Blog Archive