+Sahina, Sac

On 01/10/2017 04:14 PM, Stef Walter wrote:
On 10.01.2017 08:09, Ramesh Nachimuthu wrote:

We are working with oVirt team to integrate Gluster deployment in
cockpit-ovirt plugin. We are using an ansible based tool called
gdeploy to do the actual deployment. We have few requirements in
cockpit to support this flow in UI.

1. Listing all available storage devices in the system. We would like
to show a list of available free storage devices in the system so
that user can pick any of them for gluster deployment. I know cockpit
already shows this in the storage section. But we need it in the
gluster deployment wizard. Is there an API which we can use to show a
similar list in our wizard?.
Yes, there's a "Storaged" API that we use to list the devices. Marius
would be the one to ping (mvollmer on #cockpit FreeNode IRC) for some
example code on how to list the devices with a bit of Javascript.


Let me explore this.

2. Setting up password less SSH to communicate with other nodes. 
Ansible needs password less SSH to access other nodes. Is there way
to setup this through cockpit?.
So you'd want to:

 1. set up the authorized_keys files on the target systems with the
appropriate keys
 2. gather the host keys into the /etc/ssh/known_hosts on the Ansible

Is that correct?

Most people working on this want to write a script or tool that's usable
without the UI ... and then drive that script from the UI. This is so
that the same workflow is usable both with and without a UI.

However, if you want to implement these things via UI javascript code,
you can:

Get known hosts:

 * Use the "host" option to connect to alternate systems:


 * Use the "host-key" option (undocumented) to force retrieval of
   the host key and receive it in the "close" message on the channel

Set up authorized_keys:

 * Use a "user" and "password" option in a channel to set a password
   for just the first connection to the "host" (undocumented)

 * Use cockpit.file() to write an appropriate authorized_keys file

On the accounts page there is code that sets up authorized SSH keys for
various accounts on various systems. See the
pkg/users/authorized-keys.js file.

As noted some of this is documented only internally here:


So your best bet is to talk with us on #cockpit on IRC on Freenode and
we can work on this together.

But again, think about whether you want people to also be able to
perform this task without the UI. If so a putting together a script
callable from both the UI and the command line is your best bet.

A script which is callable from from UI and command line seems the best thing to do. Let us discuss this over #cockpit channel.

3. Task Runner Is there a way to create long running tasks and track
them through cockpit UI?. To me more specific, in our case, whole
gluster deployment take long time like more than hour when we have to
install more package. So instead of keeping the user waiting and
watching the wizard, we would like to close the wizard and create a
task and show it some where in the UI(Top right corner?). When user
wants to see the status, he can click and open the task and see the
status. We can also show a notification when it completes.
This is an interesting topic.

We do have long running tasks, such as formatting disks or rebuilding
RAIDs. We haven't yet propagated these to the top level display in the
notification bar.

But lets take one step back. When implementing such a feature you'd want
to be sure that if the user disconnects and reconnects to Cockpit the
task still continues.

The long running tasks we have today (RAID rebuilding) are managed by a
system component, and if the user disconnects and reconnects to Cockpit
they see the task continuing its state periodically updated.

So that's the first step. The creation of the long running tasks should
be done outside of the Cockpit session. Tracking and display is then
something we should discuss further.

Does that make sense?

Yeap. I think I  should come up with a better way to handle user disconnects while deploying gluster.


cockpit-devel mailing list -- cockpit-devel@lists.fedorahosted.org
To unsubscribe send an email to cockpit-devel-leave@lists.fedorahosted.org