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
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
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.
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
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.
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
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?