Host Devices
by Marek Libra
Hi,
I would like to renew the effort on Host Devices for Cockpit [1].
To move forward, let's implement it step by step while opening brand new PR
picking just a subset of the already implemented functionality [1] while
adjusted to generally acceptable form.
Initial implementation would meet:
- PCI support only
- initially read-only: just the List of devices by their Class (according
to [2])
- example: by Audio device, Ethernet Controller, etc
- data source: sysfs
- make use of backward-compatible lspci for data preprocessing (especially
manipulation with HW database)
- monitor for changes by listening kernel uevents
Follow-ups will lead to [3] scope:
- for pci, active actions are allowed for selected device classes, one PR
per each:
- (un)bind VFIO driver
- configure SR-IOV network cards
- vGPU configuration
- additional view by Driver
- What devices is the driver bound to?
- additional view by IOMMU Groups
- For server fine-tuning, what devices are within single IOMMU Group?
- support for other buses, i.e. USB or SCSI
- their views are independent on each other due to fundamental differences
Please let me know your thoughts.
Thanks,
Marek
[1] https://github.com/cockpit-project/cockpit/pull/5523
[2] http://pci-ids.ucw.cz/
[3]
https://github.com/cockpit-project/cockpit/wiki/Feature:-Hardware-Devices
--
Marek Libra
senior software engineer
Red Hat Czech
<https://www.redhat.com>
6 years, 1 month
Does cockpit offer a scp feature?
by Mark Reynolds
Hello,
Is there a cockpit API/feature that allows you to copy files from one
machine to another (like scp)? I didn't seen anything in the docs. I
could do a cockpit.spawn and use scp that way(I think), but I'm
wondering if there is a better way.
Thanks,
Mark
6 years, 3 months
Re: Why would cockpit.spawn() cause my js function to disappear?
Resolved
by Mark Reynolds
On 11/17/2017 01:35 PM, Peter wrote:
> Add some console.log lines to your done and fail functions and before
> your "// Set html paragragh to insts". It might help you get a better
> idea of what is happening.
>
> with the .done call you are providing a callback that gets called when
> the spawn command finishes. At that point you now have the result and
> you can do what you want with it.
>
> So if your goal here is to run that command and then write it to html
> that needs to happen inside the done callback.
Uggggh, of course. It was working earlier because I was actually
updating a HTML from the "done" function, but then I tried to move that
result output to a drop down list. However, I was doing it from outside
of the done callback function.
Thank you very much for clarifying the behavior, and immediately
identifying my misunderstanding of how the done function worked.
Mark
>
> cockpit.spawn(['ls', '/tmp'], { superuser: true})
> .done(function(data) {
> // use data to update html
> }).fail(function(error){
> // write a failure message to html
> });
>
>
> On 11/17/2017 10:24 AM, Mark Reynolds wrote:
>>
>>
>> On 11/17/2017 12:50 PM, Peter wrote:
>>> cockpit.spawn returns a promise. It's asynchronous. get_insts will
>>> return before the callbacks that change the value of insts get run.
>>> You need to rethink what you trying to do here and base your code off
>>> of events or callbacks.
>> But I thought the done() method was supposed to wait? Okay... So please
>> tell me how do I get cockpit to run a os command, and get the
>> results(stdout) from that command?
>>
>> What is weird is that cockpit.spawn().done() is working in other JS
>> functions I have, except this one. Very odd... Still trying to see
>> what I changed that broke things because it was working fine a few hours
>> ago...
>>
>>>
>>>
>>> On 11/17/2017 09:40 AM, Mark Reynolds wrote:
>>>> Okay I'm really stumped because this was just working, but
>>>> cockpit.spawn
>>>> seems to be misbehaving
>>>>
>>>> Here is my js:
>>>>
>>>> function get_insts() {
>>>> var insts = ["None"];
>>>>
>>>> cockpit.spawn(['ls', '/tmp'], { superuser: true
>>>> }).done(function(data) {
>>>> insts= ["okay we actually got here"];
>>>> }).fail(function(error){
>>>> insts = ["FAIL"];
>>>> });
>>>> // Set html paragragh to insts
>>>> ...
>>>> }
>>>>
>>>> $(window.document).ready(function() {
>>>> get_insts();
>>>> $("body").show();
>>>> });
>>>>
>>>>
>>>>
>>>> "insts" is always set to "None". Debugging shows odd behavior.
>>>> When I
>>>> refresh the page cockpit.spawn just doesn't do anything.
>>>>
>>>> cockpit.js
>>>>
>>>> 1832 function(e ,n) <= n is the correct list of arguments
>>>>
>>>> But it does not execute function, then it skips to
>>>>
>>>> 1842 u.close = function(e) {
>>>>
>>>> It does not execute function, then it skips to
>>>>
>>>> 1847 returns u
>>>>
>>>> We don't fail, and we don't succeed, and my js function completes.
>>>> Then... my js function get_insts() gets called again automatically
>>>> (not
>>>> sure how its getting called twice from the page reload), and it does
>>>> appear to succeed the second time, data has expected values, but
>>>> somehow
>>>> after we get the data the debugger stops in a cockpit function listed
>>>> below. It loops a few times in the cockpit function, then my js
>>>> function, get_insts(), just aborts and disappears silently even though
>>>> things seemed to working correctly on the second pass.
>>>>
>>>> cockpit-ws-151-2.fc26
>>>>
>>>> cockpit.js:867
>>>>
>>>> function P(e) {
>>>> var n, t, r;
>>>> r = e.pending;
>>>> e.process_scheduled = false;
>>>> e.pending = undefined;
>>>> for (var o = 0, a = r.length; o < a; ++o) {
>>>> e.pur = true;
>>>> t = r[o][0];
>>>> n = r[o][e.status];
>>>> if (i(n)) {
>>>> t.resolve(n.apply(e.promise, e.values));
>>>> <--
>>>> debugger stops here, then its loops and moves on
>>>> } else if (e.status === 1) {
>>>> t.resolve.apply(t.resolve, e.values);
>>>> } else {
>>>> t.reject.apply(t.reject, e.values);
>>>> }
>>>> }
>>>> }
>>>>
>>>>
>>>> I don't know what to do next, this is very odd behavior. Especially
>>>> since it worked earlier today. I even rebooted my laptop :-( I tried
>>>> different and simple commands to send to cockpit.spawn, but it doesn't
>>>> change this behavior.
>>>>
>>>> Anything else I should be looking at?
>>>>
>>>> Thanks,
>>>> Mark
>>>> _______________________________________________
>>>> cockpit-devel mailing list -- cockpit-devel(a)lists.fedorahosted.org
>>>> To unsubscribe send an email to
>>>> cockpit-devel-leave(a)lists.fedorahosted.org
>>>>
>>>
>>>
>>>
>>
>
6 years, 4 months
Why would cockpit.spawn() cause my js function to disappear?
by Mark Reynolds
Okay I'm really stumped because this was just working, but cockpit.spawn
seems to be misbehaving
Here is my js:
function get_insts() {
var insts = ["None"];
cockpit.spawn(['ls', '/tmp'], { superuser: true }).done(function(data) {
insts= ["okay we actually got here"];
}).fail(function(error){
insts = ["FAIL"];
});
// Set html paragragh to insts
...
}
$(window.document).ready(function() {
get_insts();
$("body").show();
});
"insts" is always set to "None". Debugging shows odd behavior. When I
refresh the page cockpit.spawn just doesn't do anything.
cockpit.js
1832 function(e ,n) <= n is the correct list of arguments
But it does not execute function, then it skips to
1842 u.close = function(e) {
It does not execute function, then it skips to
1847 returns u
We don't fail, and we don't succeed, and my js function completes.
Then... my js function get_insts() gets called again automatically (not
sure how its getting called twice from the page reload), and it does
appear to succeed the second time, data has expected values, but somehow
after we get the data the debugger stops in a cockpit function listed
below. It loops a few times in the cockpit function, then my js
function, get_insts(), just aborts and disappears silently even though
things seemed to working correctly on the second pass.
cockpit-ws-151-2.fc26
cockpit.js:867
function P(e) {
var n, t, r;
r = e.pending;
e.process_scheduled = false;
e.pending = undefined;
for (var o = 0, a = r.length; o < a; ++o) {
e.pur = true;
t = r[o][0];
n = r[o][e.status];
if (i(n)) {
t.resolve(n.apply(e.promise, e.values)); <--
debugger stops here, then its loops and moves on
} else if (e.status === 1) {
t.resolve.apply(t.resolve, e.values);
} else {
t.reject.apply(t.reject, e.values);
}
}
}
I don't know what to do next, this is very odd behavior. Especially
since it worked earlier today. I even rebooted my laptop :-( I tried
different and simple commands to send to cockpit.spawn, but it doesn't
change this behavior.
Anything else I should be looking at?
Thanks,
Mark
6 years, 4 months
Odd cockpit.spawn() behavior
by Mark Reynolds
Basically if I try to use wildcards or pipes things seem to break:
var cmd = ["/usr/bin/ls", "/etc/dirsrv/slapd-*"];
cockpit.spawn(cmd, { superuser: true }).done(function(data) {
insts = new String(data);
$("#Title").text(data); }
).fail(function(error){
$("#Title").text(error);
});
I get this error response: "/usr/bin/ls exited with code 2"
I get the same error when trying this:
var cmd = ["/usr/bin/ls", "/etc/dirsrv/", "|", "/usr/bin/grep",
"slapd"];
But this works fine:
var cmd = ["/usr/bin/ls", "/etc/dirsrv/"];
Is this a bug, or do I need to do something different?
Thanks,
Mark
6 years, 4 months
cannot download diagnostic report
by Fuji San
After I have done running the diagnostic report, the blue "download report" button shows up.
But when I click on it, a popup windows asks me if I want to save the file"sos-report-hostname-20171026143147.tar.xz".
When I click "Save", the popup closes and well nothing else happens! No file is saved.
The browser does not show any downloaded file.
6 years, 4 months
Need help with new package: JS vs CSP
by Mark Reynolds
Hello,
I'm evaluating cockpit to be a potential UI replacement for our database
server (389 directory server). I am also not an experienced web
developer, but regardless I'm going to be writing our new UI.
I've created a sample package(manifest.json file, html files, etc) and I
put it all under ~/.local/share/cockpit/test/
I see my new menu item, and it loads my html page. But I can not get my
custom javascript working on my project page:
Content Security Policy: The page’s settings blocked the loading of a
resource at self (“default-src http://localhost:9090
http://localhost:9090”). Source: onclick attribute on BUTTON element.
I tried putting my javascript in a separate file, and embedding it in
the html page, etc. None it works and it's the CSP that "appears" to be
blocking me every time.
What is the correct way to get my javascript functions working in my
package?
Thanks,
Mark
6 years, 4 months
Cockpit 155 release
by Martin Pitt
http://cockpit-project.org/blog/cockpit-155.html
Cockpit is the modern Linux admin interface. We release regularly. Here
are the release notes from version 155.
NFS client support
------------------
The Storage page now shows currently mounted NFS volumes and offers to
mount/unmount them. Note that this does not yet support Kerberos
authentication; for now this relies on the classic `hosts.allow`/`hosts.deny` ACLs.
Video: https://www.youtube.com/watch?v=PGCBda3Le9Y
Add "Maintenance" switch for oVirt hosts
----------------------------------------
Switching a host to maintenance mode causes all VMs to be migrated to another
running oVirt host.
Screnshot: http://cockpit-project.org/images/ovirt-maintenance.png
Fix Terminal rendering issues in Chrome
---------------------------------------
Console programs like Midnight Commander which use graphical characters
were previously distorted in the Terminal in the Chrome Browser.
Improve Ctrl+W behaviour in the Terminal
----------------------------------------
Ctrl+W is commonly being used in a Terminal shell to delete the last word, but
in web browsers it closes the current window or tab. Cockpit now causes a
confirmation dialog to pop up on Ctrl+W when the Terminal is focussed to avoid
accidental closing.
Support the upcoming OpenShift 3.7 release
------------------------------------------
When available, use the `rbac.authorization` API instead of the `policybinding`
API for determining project permissions. OpenShift 3.7 now properly supports
the former and stops supporting the latter. Cockpit remains compatible with
older OpenShift releases.
Get it
------
You can get Cockpit here:
http://cockpit-project.org/running.html
Cockpit 155 is available in Fedora 27:
https://bodhi.fedoraproject.org/updates/cockpit-155-1.fc27
Or download the tarball here:
https://github.com/cockpit-project/cockpit/releases/tag/155
Take care,
Martin Pitt
6 years, 4 months