VMware Cloud Community
St0ked56
Contributor
Contributor
Jump to solution

Session Per User Question

Hi,

In my current workflow setup I have an End user pick their vDC and vApp Template.  From there I initiate the template and once this completes I have a user interaction, to accept or deny the workflow and add what networks to attach the vApp to.  This interaction is accpeted by a Operations group (different from the end user).  Problem I run into is variables do not get passed back and forth between different user input.  Is there a way to make this work on a Session Per User setup?

Thanks,

Mike

0 Kudos
1 Solution

Accepted Solutions
cdecanini_
VMware Employee
VMware Employee
Jump to solution

OK, you are getting close.

I just did the wf to test this. networkID = defaulted to "#vmNetwork1.id" is not working.

Create an action returning the id like the following:

Screen shot 2012-08-17 at 3.34.56 PM.png

Now default networkID like this:

Screen shot 2012-08-17 at 3.36.26 PM.png

(your action path / name / passed parameter will likely be different, please adapt)

If it works correctly your user interaction will look like that.

Screen shot 2012-08-17 at 3.37.10 PM.png

The the scriptable box with the code:

var vcdHost = app.getHost();
prodvAPPNetwork = vcdHost.getEntityById(VclFinderType.ORG_NETWORK, networkId);
System.log(prodvAPPNetwork);                // I get Null
System.log(networkId);                           // I get #vmNetwork1.id

Executes well and gives:

[2012-08-17 15:39:38.365] [I] DynamicWrapper (Instance) : [VclOrgNetwork]-[class com.vmware.vmo.plugin.vcloud.model.OrgNetwork] -- VALUE : com.vmware.vmo.plugin.vcloud.model.OrgNetwork@39fdb480
[2012-08-17 15:39:38.366] [I] urn:vcloud:network:66812df3-3990-4d67-8e87-781eca0faf01

Christophe.

If my answer resolved or helped you, please mark it as Correct or Helpful to award points. Thank you! Visit http://www.vcoteam.info & http://blogs.vmware.com/orchestrator for vCenter Orchestrator tips and tutorials - @vCOTeam on Twitter

View solution in original post

0 Kudos
7 Replies
cdecanini_
VMware Employee
VMware Employee
Jump to solution

I am not sure what you mean by "variables do not get passed back and forth between different user input".

If the problem is that you want the rest of the workflow to run as another user you should use the "change credential" workflow element in the "Basic" tab.

Is the vCloud DIrector plug-in set for per user or for shared session mode ?

Christophe.

If my answer resolved or helped you, please mark it as Correct or Helpful to award points. Thank you! Visit http://www.vcoteam.info & http://blogs.vmware.com/orchestrator for vCenter Orchestrator tips and tutorials - @vCOTeam on Twitter
0 Kudos
St0ked56
Contributor
Contributor
Jump to solution

vCloud Plugin is set to Session per user

Right now if I run through the workflow as User 1 and accept the workflow and add the networks as User 1 everything works fine.

When I run the workflow as User 1 and accept the workflow and add the networks as User 2 it breaks at the "Add a Nic" workflow. 

What I have noticed is that I define the network name string by doing the following

var ProdNetwork = vCDNetwork.name (vCDNetwork being the input provided during the user interaction function)

ProdNetwork will obtain a value if User 1 starts and Accepts the workflow and provides the networks

ProdNetwork will not obtain a value if User 1 starts and User 2 accepts and provides the networks.

Attached is the error I received when User 2 accepts and provides the networks.

0 Kudos
cdecanini_
VMware Employee
VMware Employee
Jump to solution

I think you have the following issue:

When the vCD plug-in use a session per user the same vCD entity has 2 different IDs for 2 different users. If you select a network as the user 2 then it will have a given ID. When you switch back to user 1 it will not know this ID.

Try this:

In the user interaction add a networkId string input

In the presentation property set it to default to #network.id

Add a scriptable box in which you do:

network = vcdHost.getEntityById(VclFinderType.ORG_NETWORK , networkId);

(you can set vcdHost by calling the getHost() method on any object you have as input / attribute)

If this work for you then you can add a hidden presentation property on the networkId user interaction intput.

I hope this will help.

Christophe.

If my answer resolved or helped you, please mark it as Correct or Helpful to award points. Thank you! Visit http://www.vcoteam.info & http://blogs.vmware.com/orchestrator for vCenter Orchestrator tips and tutorials - @vCOTeam on Twitter
St0ked56
Contributor
Contributor
Jump to solution

This was helpful but I still seem to get an error.  This is what I have.

User Interaction inputs:

vmNetwork1 = Prod network

networkID =  Presentation default value set to #networkID

Scriptable task

var vcdHost = vAppNew.getHost();
prodvAPPNetwork = vcdHost.getEntityById(VclFinderType.vmNetwork1, networkID);
I get the below error
Property named 'vmNetwork1' not found on object: _VclFinderType
my prodvAPPNetwork stays at a null value as well.
0 Kudos
cdecanini_
VMware Employee
VMware Employee
Jump to solution

First thing you need to check if when you select a network, the networkID field is set with an ID.

You mentioned it is set to #networkID wich would not give the ID of the network, but then this may be a typo.

Once you get to this point the networkID attribute will be filled with the network ID.

Next VclFinderType should be of the type you have set for your network. i.e ORG_NETWORK. To get a list of all the types search VclFinderType in the API search.

Christophe.

If my answer resolved or helped you, please mark it as Correct or Helpful to award points. Thank you! Visit http://www.vcoteam.info & http://blogs.vmware.com/orchestrator for vCenter Orchestrator tips and tutorials - @vCOTeam on Twitter
St0ked56
Contributor
Contributor
Jump to solution

Still having some trouble... Not exactly sure what I am doing wrong.

User 2 Inputs

vmNetwork1 = Prod Network

networkID = defaulted to "#vmNetwork1.id"

In my scriptable task I have

var vcdHost = vAppNew.getHost();
prodvAPPNetwork = vcdHost.getEntityById(VclFinderType.ORG_NETWORK, networkID);
System.log(prodvAPPNetwork);                // I get Null
System.log(networkID);                           // I get #vmNetwork1.id

System.log("vapp" + vAppNew);                //returns the vApp
System.log("vmnetwork.id" + vmNetwork1.id);  // Undefined
Now when I run the User interaction as User 1  I get the following

System.log(prodvAPPNetwork);                // I get Null
System.log(networkID);                           // I get #vmNetwork1.id

System.log("vapp" + vAppNew);                //returns the vApp
System.log("vmnetwork.id" + vmNetwork1.id);  // returns network id
In both cases this allows the NIC to be added but it doesn't attach to the network since prodvAPPNetwork returns null.

0 Kudos
cdecanini_
VMware Employee
VMware Employee
Jump to solution

OK, you are getting close.

I just did the wf to test this. networkID = defaulted to "#vmNetwork1.id" is not working.

Create an action returning the id like the following:

Screen shot 2012-08-17 at 3.34.56 PM.png

Now default networkID like this:

Screen shot 2012-08-17 at 3.36.26 PM.png

(your action path / name / passed parameter will likely be different, please adapt)

If it works correctly your user interaction will look like that.

Screen shot 2012-08-17 at 3.37.10 PM.png

The the scriptable box with the code:

var vcdHost = app.getHost();
prodvAPPNetwork = vcdHost.getEntityById(VclFinderType.ORG_NETWORK, networkId);
System.log(prodvAPPNetwork);                // I get Null
System.log(networkId);                           // I get #vmNetwork1.id

Executes well and gives:

[2012-08-17 15:39:38.365] [I] DynamicWrapper (Instance) : [VclOrgNetwork]-[class com.vmware.vmo.plugin.vcloud.model.OrgNetwork] -- VALUE : com.vmware.vmo.plugin.vcloud.model.OrgNetwork@39fdb480
[2012-08-17 15:39:38.366] [I] urn:vcloud:network:66812df3-3990-4d67-8e87-781eca0faf01

Christophe.

If my answer resolved or helped you, please mark it as Correct or Helpful to award points. Thank you! Visit http://www.vcoteam.info & http://blogs.vmware.com/orchestrator for vCenter Orchestrator tips and tutorials - @vCOTeam on Twitter
0 Kudos