VMware Cloud Community
CHJamey
Contributor
Contributor
Jump to solution

Error when trying to clone a vm and then call a powercli script from ExternalWFStubs.MachineProvisioned

vcac 6

Hello, I am executing a powercli script from ExternalWFStubs.MachineProvisioned.  I have been using Calling Powershell/PowerCLI Scripts from a vCAC Workflow as a reference.

The script runs fine after the vm is provisioned, and it does what it is supposed to do, but the deployed vm is deleted when it is finished and the following error is thrown.

Workflow:            WFStubMachineProvisioned

Result Details:       Failed with the following exception:  Cannot invoke this function because the current host does not implement it.

Has anyone else seen this and know what's up?  I'll continue checking it out and post back with what I find.

Thanks

0 Kudos
1 Solution

Accepted Solutions
GrantOrchardVMw
Commander
Commander
Jump to solution

Are you able to share the PowerCLI?

Grant

Grant http://grantorchard.com

View solution in original post

0 Kudos
6 Replies
GrantOrchardVMw
Commander
Commander
Jump to solution

Are you able to share the PowerCLI?

Grant

Grant http://grantorchard.com
0 Kudos
CHJamey
Contributor
Contributor
Jump to solution

Sorry for my delayed response Grant.  As you suggested, it turned out to be the PowerCLI and I got it squared away.  Since I'm new to vcac, I didn't know it was so easy to pass variables from vcac to a powercli script.  The main steps were to import the script into vcac using cloudutil, create the properties in the property dictionary, add the properties to the blueprint and use the below syntax to grab the data the properties grab.

#############Begin Code

if ( (Get-PSSnapin -Name VMware.VimAutomation.Core -ErrorAction SilentlyContinue) -eq $null )

{

    Add-PsSnapin VMware.VimAutomation.Core

}

Connect-VIServer vcenterName -User domain\user -Password pass

#get properties from vcac

$NewNetwork = $Properties["NetworkSelection"]

$VMname = $Properties["VirtualMachineName"]

$NIC = Get-VM -Name $VMname | Get-NetworkAdapter

Get-VM $VMname | get-NetworkAdapter | where{ $_.Name -eq $NIC}| set-NetworkAdapter -NetworkName $NewNetwork -Confirm:$false

#############End Code

This is just a test script to get my bearings.

I will be posting the below two questions today as well..... unless you can knock them out real quick!

1.  How do I add another cluster to a FabricGroup?  I have one cluster added to a FabricGroup.  I created another cluster

    but it is not available When I choose to create a new FabricGroup.  All permissions are the same.                ********************Edit   I rebooted the iaas server and cluster 2 is now available for FabricGroup addition.  Is there a cleaner way to "Refresh" so vcac sees new resources?

2.  If I want to determine which cluster and datastore to provision a vm to based on user input to the custom properties, which wfstub would I use and can I set those properties

    before the build so the deployment uses the designated cluster and datastore?

Thanks again for your help.

0 Kudos
stvkpln
Virtuoso
Virtuoso
Jump to solution

Answer to #1 is pretty straight forward: you should be able to just restart the vSphere Proxy Agent service on the IaaS server. The service name should be something like VMware vCloud Automation Center Agent - <endpoint name>.

The second one is a bit more difficult.. There's a few different ways to approach it, but I don't know if (necessarily) vCO is the best approach here. How do you want to be able to dictate cluster / storage provisioning? It may make more sense to make use of reservation policies mapped to blueprints.. so that you don't have to do it in vCO at all. It's a bit hard to answer without knowing more details about what you're really trying to achieve and what the possible scaling needs will be.

-Steve
CHJamey
Contributor
Contributor
Jump to solution

Hi stvkpln.  Thanks for your reply.  I also found that there is a Data Refresh option in the Compute Resources.  Running the Data Refresh made vCAC discover the changed infrastructure.  I ran a discovery on only the inventory and it then showed up.  This also helped in the case where I changed the specs of a VM I was cloning from within a blueprint.  The new specs were not reflected in the blueprint until I ran that Inventory Data Refresh.

As for #2....  I was going to try a cleaner way but if reservations are the only way then I have no problem using them.  In order to use storage reservations, I will have to have the following configuration.

A little more background...

1.  Each datastore holds certain OS types.  Each datastore is only given access to certain hosts per cluster.

2.  We have sas, sata and ssd datastores and we want to give the option of choosing the speed of the datastore to deploy to.

3.  We have dev and prod clusters.

4.  We will have small, medium and large vms.

A couple config possibilities...

1.  Have a blueprint for each OS\Evironment\Size\Speed.  Like "Deploy Large SAS Windows Development VMs" and "Deploy Small SATA Windows Development VMs".

***Disadvantage of this is tons of blueprints.

2.  Instead of having so many blueprints, I can have different blueprint profiles for each configuration.  Then use custom properties to have the user choose OS, Environment, Storage Speed and VM Size by determining which build profiles to use in a script.  Could I determine which build profiles to use during a build process, based on user input, by passing in the properties\variables to a powershell script in a "build in progress stub" and then use logic to determine which build profile should be used for the specific vm build?  Maybe even determine which storage profile to use in the blueprint as well for the different builds?

Thanks a lot for your help!

Jamey

0 Kudos
stvkpln
Virtuoso
Virtuoso
Jump to solution

You can't "choose" a build profile like that... the build profiles are associated with blueprints... it's fixed. In my vCAC design, we implemented a Service in the catalog for each environmental boundary, and within each service, we had blueprints designated for each O/S we wanted to support for that specific environment. From there, we went into the blueprints and configured min/max values. Each blueprint had three build profiles associated with it (note: no custom properties are EVER set directly at the blueprint): An "all services" build profile which captured all of our baseline user-facing fields (more or less); a build profile with all of the O/S specific values we wanted to capture, and a build profile capturing all of the environmental specific values.

What this approach did (for me) was to delineate entitlements for business groups to the environments they were expected to be able to provision into, each with a catalog of available O/S'es. Using the build profiles in this manner allowed us to control configuration for things in an organized manner, and when troubleshooting needs to occur, we're looking at a build profile, rather than digging into individual blueprints, then having to go back and re-check values across all of the other ones.

For your specific needs, it may make sense to use custom properties to drive these decisions, but my concern would be that if you had to scale this out, it may be difficult to reign the logic and avoid a lot of hard coded configurations -- something I'm working to eradicate as much as I can in our environment. It's very difficult to determine some of this in  vacuum without understanding the decision making process the workflows need to take, or what the naming conventions are (as an example). So many variables involved here.

Have you looked at this article? It may provide some insight into some things you might be able to do: [virtualjad.com]: vCAC Property Dictionary: Customize Service Requests with Dynamic Menus

-Steve
CHJamey
Contributor
Contributor
Jump to solution

Thanks a lot for the information.  Yeah keeping it as simple as possible is certainly a goal of mine.  I was thinking that if I could have the different build profiles for different sizes, and then use simple switch statements to choose the build profile depending on if the user chooses small, medium or large, it would allow one, template per OS to clone from and one custom code in the "building" wfstub.

As you know, there are so many ways to configure this.  Being new to vCAC is one challenge and the other is designing the right solution for a complicated environment.  Thanks for your insight and input stvkpln.  I'll take a look at the link and post back with any progress I make.

Thanks,

Jamey

0 Kudos