Skip to content

Commit 22336da

Browse files
CP-54217: Add a new pool level field to limit the vnc console access
This change introduces a new pool-level parameter that restricts VNC console access to a single active session per VM/host. This prevents multiple users from simultaneously connecting to the same VM console, preventing one user 'watching' another user operating a session. Signed-off-by: Stephen Cheng <[email protected]>
1 parent cc2f09e commit 22336da

File tree

6 files changed

+16
-2
lines changed

6 files changed

+16
-2
lines changed

ocaml/idl/datamodel_lifecycle.ml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,8 @@ let prototyped_of_field = function
137137
Some "23.18.0"
138138
| "VM", "actions__after_softreboot" ->
139139
Some "23.1.0"
140+
| "pool", "limit_console_sessions" ->
141+
Some "25.29.0"
140142
| "pool", "ha_reboot_vm_on_internal_shutdown" ->
141143
Some "25.16.0"
142144
| "pool", "license_server" ->

ocaml/idl/datamodel_pool.ml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2250,6 +2250,10 @@ let t =
22502250
"Indicates whether an HA-protected VM that is shut down from \
22512251
inside (not through the API) should be automatically rebooted \
22522252
when HA is enabled"
2253+
; field ~writer_roles:_R_POOL_OP ~qualifier:RW ~lifecycle:[] ~ty:Bool
2254+
~default_value:(Some (VBool false)) "limit_console_sessions"
2255+
"Indicate whether the console concurrent limit is set for the pool \
2256+
(false means no limit)"
22532257
]
22542258
)
22552259
()

ocaml/idl/schematest.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ let hash x = Digest.string x |> Digest.to_hex
33
(* BEWARE: if this changes, check that schema has been bumped accordingly in
44
ocaml/idl/datamodel_common.ml, usually schema_minor_vsn *)
55

6-
let last_known_schema_hash = "7586cb039918e573594fc358e90b0f04"
6+
let last_known_schema_hash = "f546a0d01815608cbcf04cdb90c1be9f"
77

88
let current_schema_hash : string =
99
let open Datamodel_types in

ocaml/tests/common/test_common.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,7 @@ let make_pool ~__context ~master ?(name_label = "") ?(name_description = "")
326326
~ext_auth_cache_enabled:false ~ext_auth_cache_size:50L
327327
~ext_auth_cache_expiry:300L ~update_sync_frequency ~update_sync_day
328328
~update_sync_enabled ~recommendations ~license_server
329-
~ha_reboot_vm_on_internal_shutdown ;
329+
~ha_reboot_vm_on_internal_shutdown ~limit_console_sessions:false ;
330330
pool_ref
331331

332332
let default_sm_features =

ocaml/xapi-cli-server/records.ml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1595,6 +1595,13 @@ let pool_record rpc session_id pool =
15951595
~value:(safe_bool_of_string "ssh-auto-mode" value)
15961596
)
15971597
()
1598+
; make_field ~name:"limit-console-sessions"
1599+
~get:(fun () -> string_of_bool (x ()).API.pool_limit_console_sessions)
1600+
~set:(fun x ->
1601+
Client.Pool.set_limit_console_sessions ~rpc ~session_id ~self:pool
1602+
~value:(bool_of_string x)
1603+
)
1604+
()
15981605
]
15991606
}
16001607

ocaml/xapi/dbsync_master.ml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ let create_pool_record ~__context =
5555
~ext_auth_max_threads:1L ~ext_auth_cache_enabled:false
5656
~ext_auth_cache_size:50L ~ext_auth_cache_expiry:300L ~recommendations:[]
5757
~license_server:[] ~ha_reboot_vm_on_internal_shutdown:true
58+
~limit_console_sessions:false
5859

5960
let set_master_ip ~__context =
6061
let ip =

0 commit comments

Comments
 (0)