VMware {code} Community
hcal
Contributor
Contributor
Jump to solution

Persistence with Vsphere plugins

Greetings!

I am basing my plugin off of extjs-chassis (part of the html bridge examples)..

I have added the js plugin to my vsphere/vcenter environment. Although when I restart the server, all the data stored/generated in the plugin gets lost. Is there a way to store this information and make it persistent?

0 Kudos
1 Solution

Accepted Solutions
Peter_Ivanov
VMware Employee
VMware Employee
Jump to solution

The typical scenario would be your plugin to have a separate back-end server.

And that server should provide the persistence that you need.

Every time I log out of my vSphere, I lose the list of names and IP addresses stored in the plugin.

I guess you are storing them in the user session?

I am currently writing the data to a file, and modifying when an object is created, deleted or modified.

If you don't want to deal with databases this is the simplest solution.

Is there a better way of storing objects from a plugin?

There is no public API that the Web Client exposes for persistence.

View solution in original post

0 Kudos
11 Replies
Peter_Ivanov
VMware Employee
VMware Employee
Jump to solution

Can you elaborate further? What kind of information do you want to persist and for how long?

Have you considered using the HTML5 persistence (HTML5 Web Storage)?

Storing data in memory in the Java layer is strongly discouraged.

If you need database persistence, you have to implement it yourself, preferably in another virtual appliance.

0 Kudos
hcal
Contributor
Contributor
Jump to solution

Thank you for your rapid response!

Every time I log out of my vSphere, I lose the list of names and IP addresses stored in the plugin.

I am currently writing the data to a file, and modifying when an object is created, deleted or modified.

I would like the data to persist as long as the plugin is installed.

Also don't want the plugin to be browser specific.

Is there a better way of storing objects from a plugin?

0 Kudos
Peter_Ivanov
VMware Employee
VMware Employee
Jump to solution

The typical scenario would be your plugin to have a separate back-end server.

And that server should provide the persistence that you need.

Every time I log out of my vSphere, I lose the list of names and IP addresses stored in the plugin.

I guess you are storing them in the user session?

I am currently writing the data to a file, and modifying when an object is created, deleted or modified.

If you don't want to deal with databases this is the simplest solution.

Is there a better way of storing objects from a plugin?

There is no public API that the Web Client exposes for persistence.

0 Kudos
hcal
Contributor
Contributor
Jump to solution

Do you suggest the backened server being the VCSA's vPostgres? Or is that what you were referring to: "There is no public API that the Web Client exposes for persistence."

0 Kudos
laurentsd
VMware Employee
VMware Employee
Jump to solution

For persisting small data files or user settings you can follow the Global View SDK sample which provide such an example.

0 Kudos
Peter_Ivanov
VMware Employee
VMware Employee
Jump to solution

Do you suggest the backened server being the VCSA's vPostgres?

Not really. It is not that simple. vCenter can be configured to use external database.

I meant a separate virtual appliance where your core logic would reside.

Or is that what you were referring to: "There is no public API that the Web Client exposes for persistence."

The Web Client is using its own primitive file-based persistence which is not public.

0 Kudos
brianplexxi
Contributor
Contributor
Jump to solution

Hi folks,

If using an external database, what is the recommended way to securely persist the database access credentials? 

0 Kudos
laurentsd
VMware Employee
VMware Employee
Jump to solution

> If using an external database, what is the recommended way to securely persist the database access credentials?

The simplest in my opinion is to persist those credentials in an encrypted local file.  See the globalview sample for read/write access to a local file.

0 Kudos
brianplexxi
Contributor
Contributor
Jump to solution

I noticed the VMWARE_DATA_DIR env variable was introduced in 6.0 - thank you!

Where do I store data in 5.5?  

0 Kudos
laurentsd
VMware Employee
VMware Employee
Jump to solution

hi Brian,

You can follow the code sample in samples/globalview/globalview-service/src/main/java/com/vmware/samples/globalview/GlobalServiceImpl.java. See getGlobalViewDataFolder().

0 Kudos
brianplexxi
Contributor
Contributor
Jump to solution

Now that I found the 5.5 samples I can! :facepalm:

Thanks!

0 Kudos