-
Notifications
You must be signed in to change notification settings - Fork 1.2k
API to list console sessions #11016
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
API to list console sessions #11016
Conversation
@blueorangutan package |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #11016 +/- ##
============================================
+ Coverage 16.57% 16.59% +0.02%
- Complexity 13968 13999 +31
============================================
Files 5743 5745 +2
Lines 510470 510802 +332
Branches 62074 62092 +18
============================================
+ Hits 84615 84793 +178
- Misses 416393 416539 +146
- Partials 9462 9470 +8
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
@blueorangutan package |
@bernardodemarco a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress. |
Packaging result [SF]: ✖️ el8 ✖️ el9 ✖️ debian ✖️ suse15. SL-JID 13755 |
79f6d2d
to
ad7af57
Compare
@blueorangutan package |
@bernardodemarco a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clgtm, only doubt, is the active parameter needed? would we ever want to list no longer available sessions?
Packaging result [SF]: ✖️ el8 ✖️ el9 ✖️ debian ✖️ suse15. SL-JID 13766 |
Packaging result [SF]: ✖️ el8 ✖️ el9 ✖️ debian ✖️ suse15. SL-JID 13771 |
@DaanHoogland, thanks for the review!
Yes, listing removed sessions is useful for audit and analysis purposes, as it allows users to track who generated a console endpoint, who accessed it, and when it was generated, acquired, and removed. Listing only active sessions, on the other hand, is helpful for verifying whether someone is currently using a VM. |
Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ debian ✔️ suse15. SL-JID 13777 |
@blueorangutan test |
@DaanHoogland a [SL] Trillian-Jenkins test job (ol8 mgmt + kvm-ol8) has been kicked to run smoke tests |
[SF] Trillian test result (tid-13527)
|
@blueorangutan test ol8 vmware-70u3 keepEnv |
@DaanHoogland a [SL] Trillian-Jenkins test job (ol8 mgmt + vmware-70u3) has been kicked to run smoke tests |
@blueorangutan package |
@bernardodemarco a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress. |
Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ debian ✔️ suse15. SL-JID 13902 |
@blueorangutan test ol8 vmware-70u3 keepEnv |
@DaanHoogland a [SL] Trillian-Jenkins test job (ol8 mgmt + vmware-70u3) has been kicked to run smoke tests |
[SF] Trillian test result (tid-13599)
|
@bernardodemarco , I am trying this in a vmware lab env ^ but get an empty result. Is there some setting that I should apply first? I am doing the very basic test:
I’d expect an extry on the second list command. |
maybe in step2, create a console endpoint using a cmk ? |
@bernardodemarco I did some basic tests with the admin user only, and accessing console through the CloudStack UI and so far no issues listing the console sessions, will continue testing with other user types. |
shouldn’t all sessions be listed?
So in your case you did see a session in the output, @nvazquez ? (/me not) |
@DaanHoogland, thanks for testing!
It is important to note that there is the So, if the console session is still active (i.e., marked as If the console session is not active, then the |
thanks @bernardodemarco , I’ll double check. |
@nvazquez, thanks for testing!
Sure, I'll try to send a patch to the CloudMonkey repo adding support for autocompletion for the |
ok, the problem is that a console created in the ui is not marked as active somehow. nothing to do with this PR I’ll investigate (only a little) and create a fresh issue if needed. |
actually
note how removed field is not present in the newer session but still it is not shown without can you explain this @bernardodemarco ? |
btw, the acquired field is null in the DB for both session. Maybe this has to do with it. |
@DaanHoogland, yes. I've already investigated this behavior when I was developing this patch. The console session is (or should be) marked as
That happens because it is not marked as |
#11096 (for reference @bernardodemarco ) I think we need not scope creep this PR with this. |
api/src/main/java/org/apache/cloudstack/api/response/ConsoleSessionResponse.java
Show resolved
Hide resolved
@DaanHoogland, okay, thanks! |
@blueorangutan package |
@bernardodemarco a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress. |
@blueorangutan package |
@sureshanaparti a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress. |
Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ debian ✔️ suse15. SL-JID 13934 |
@blueorangutan test |
@DaanHoogland a [SL] Trillian-Jenkins test job (ol8 mgmt + kvm-ol8) has been kicked to run smoke tests |
Description
Currently, details about console sessions are stored in the
cloud.console_session
table in the database. Operators can only access this information by querying the database directly, while end users have no way to view console session data at all.To address this, this PR proposes to create the
listConsoleSessions
API. It allows listing the console sessions, with optional filters by domain, account, user, host, instance, IP address, and date. The API is accessible to all account types and, thus, performs proper access validation on the queried resources.The API supports the following parameters:
id
activeonly
true
. Active sessions are the ones that have been acquired and have not been removed.isrecursive
false
.clientaddress
consoleendpointcreatoraddress
hostid
instanceid
startdate
enddate
domainid
accountid
userid
page
pagesize
.pagesize
page
.This PR only encompasses the creation of the API
listConsoleSessions
API. UI support will be implemented in a future PR.Types of changes
Feature/Enhancement Scale or Bug Severity
Feature/Enhancement Scale
Screenshots (if appropriate):
How Has This Been Tested?
Tests Setup
listConsoleSessions
testsadmin
account, verified that the API lists console sessions correctly according to the specified parametersu1
account, verified that it is only possible to access the account's console sessionsd2-admin
account, verified that it is only possible to list the console sessions of thed2
domaind1-admin
account, verified that it is only possible to list the console sessions of thed1
andd1/d1-d1
domainsd1-user
account, verified that it is only possible to list thed1-user
console sessionsd1-d1-admin
account, verified that it is only possible to list the console sessions of thed1/d1-d1
domaind1-d1-user
account, verified that it is only possible to list thed1-d1-user
console sessionsUser
type, verified that thehostid
parameter is not considered in the API workflowUser
type, verified that thehostid
andhostname
response attributes are not included in the API's return