File tree Expand file tree Collapse file tree 13 files changed +71
-4
lines changed Expand file tree Collapse file tree 13 files changed +71
-4
lines changed Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ open Datamodel_roles
10
10
to leave a gap for potential hotfixes needing to increment the schema version.*)
11
11
let schema_major_vsn = 5
12
12
13
- let schema_minor_vsn = 788
13
+ let schema_minor_vsn = 789
14
14
15
15
(* Historical schema versions just in case this is useful later *)
16
16
let rio_schema_major_vsn = 5
Original file line number Diff line number Diff line change @@ -2046,6 +2046,9 @@ let _ =
2046
2046
error Api_errors. set_console_timeout_partially_failed [" hosts" ]
2047
2047
~doc: " Some hosts failed to set console timeout." () ;
2048
2048
2049
+ error Api_errors. set_ssh_auto_mode_partially_failed [" hosts" ]
2050
+ ~doc: " Some hosts failed to set SSH auto mode." () ;
2051
+
2049
2052
error Api_errors. host_driver_no_hardware [" driver variant" ]
2050
2053
~doc: " No hardware present for this host driver variant" () ;
2051
2054
@@ -2055,6 +2058,12 @@ let _ =
2055
2058
enable it in XC or run xe pool-enable-tls-verification instead."
2056
2059
() ;
2057
2060
2061
+ error Api_errors. ssh_auto_mode_conflict []
2062
+ ~doc:
2063
+ " Cannot enable SSH auto mode while SSH is already enabled, as it \
2064
+ conflicts with the current SSH configuration."
2065
+ () ;
2066
+
2058
2067
message
2059
2068
(fst Api_messages. ha_pool_overcommitted)
2060
2069
~doc:
Original file line number Diff line number Diff line change @@ -2440,6 +2440,16 @@ let set_console_idle_timeout =
2440
2440
]
2441
2441
~allowed_roles: _R_POOL_ADMIN ()
2442
2442
2443
+ let set_ssh_auto_mode =
2444
+ call ~name: " set_ssh_auto_mode" ~lifecycle: []
2445
+ ~doc: " Set the SSH auto mode for the host"
2446
+ ~params:
2447
+ [
2448
+ (Ref _host, " self" , " The host" )
2449
+ ; (Bool , " value" , " The SSH auto mode for the host" )
2450
+ ]
2451
+ ~allowed_roles: _R_POOL_ADMIN ()
2452
+
2443
2453
let latest_synced_updates_applied_state =
2444
2454
Enum
2445
2455
( " latest_synced_updates_applied_state"
@@ -2601,6 +2611,7 @@ let t =
2601
2611
; disable_ssh
2602
2612
; set_ssh_enabled_timeout
2603
2613
; set_console_idle_timeout
2614
+ ; set_ssh_auto_mode
2604
2615
]
2605
2616
~contents:
2606
2617
([
@@ -3056,6 +3067,10 @@ let t =
3056
3067
" console_idle_timeout"
3057
3068
" The timeout in seconds after which idle console will be \
3058
3069
automatically terminated (0 means never)"
3070
+ ; field ~qualifier: DynamicRO ~lifecycle: [] ~ty: Bool
3071
+ ~default_value: (Some (VBool Constants. default_ssh_auto_mode))
3072
+ " ssh_auto_mode"
3073
+ " Reflects whether SSH auto mode is enabled for the host"
3059
3074
]
3060
3075
)
3061
3076
()
Original file line number Diff line number Diff line change @@ -1606,6 +1606,16 @@ let set_console_idle_timeout =
1606
1606
]
1607
1607
~allowed_roles: _R_POOL_ADMIN ()
1608
1608
1609
+ let set_ssh_auto_mode =
1610
+ call ~name: " set_ssh_auto_mode" ~lifecycle: []
1611
+ ~doc: " Set the SSH auto mode for all hosts in the pool"
1612
+ ~params:
1613
+ [
1614
+ (Ref _pool, " self" , " The pool" )
1615
+ ; (Bool , " value" , " The SSH auto mode for all hosts in the pool" )
1616
+ ]
1617
+ ~allowed_roles: _R_POOL_ADMIN ()
1618
+
1609
1619
(* * A pool class *)
1610
1620
let t =
1611
1621
create_obj ~in_db: true
@@ -1704,6 +1714,7 @@ let t =
1704
1714
; disable_ssh
1705
1715
; set_ssh_enabled_timeout
1706
1716
; set_console_idle_timeout
1717
+ ; set_ssh_auto_mode
1707
1718
]
1708
1719
~contents:
1709
1720
([
Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ let hash x = Digest.string x |> Digest.to_hex
3
3
(* BEWARE: if this changes, check that schema has been bumped accordingly in
4
4
ocaml/idl/datamodel_common.ml, usually schema_minor_vsn *)
5
5
6
- let last_known_schema_hash = " 8bf2b9ab509301baf138820cf34608d3 "
6
+ let last_known_schema_hash = " 7c52d11789dea3ab3167c5d0e3e7fa89 "
7
7
8
8
let current_schema_hash : string =
9
9
let open Datamodel_types in
Original file line number Diff line number Diff line change @@ -219,7 +219,7 @@ let make_host2 ~__context ?(ref = Ref.make ()) ?(uuid = make_uuid ())
219
219
~recommended_guidances: [] ~latest_synced_updates_applied: `unknown
220
220
~pending_guidances_recommended: [] ~pending_guidances_full: []
221
221
~last_update_hash: " " ~ssh_enabled: true ~ssh_enabled_timeout: 0L
222
- ~ssh_expiry: Date. epoch ~console_idle_timeout: 0L ;
222
+ ~ssh_expiry: Date. epoch ~console_idle_timeout: 0L ~ssh_auto_mode: true ;
223
223
ref
224
224
225
225
let make_pif ~__context ~network ~host ?(device = " eth0" )
Original file line number Diff line number Diff line change @@ -1426,7 +1426,12 @@ let set_ssh_timeout_partially_failed =
1426
1426
let set_console_timeout_partially_failed =
1427
1427
add_error " SET_CONSOLE_TIMEOUT_PARTIALLY_FAILED"
1428
1428
1429
+ let set_ssh_auto_mode_partially_failed =
1430
+ add_error " SET_SSH_AUTO_MODE_PARTIALLY_FAILED"
1431
+
1429
1432
let host_driver_no_hardware = add_error " HOST_DRIVER_NO_HARDWARE"
1430
1433
1431
1434
let tls_verification_not_enabled_in_pool =
1432
1435
add_error " TLS_VERIFICATION_NOT_ENABLED_IN_POOL"
1436
+
1437
+ let ssh_auto_mode_conflict = add_error " SSH_AUTO_MODE_CONFLICT"
Original file line number Diff line number Diff line change @@ -428,3 +428,5 @@ let default_ssh_enabled = true
428
428
let default_ssh_enabled_timeout = 0L
429
429
430
430
let default_console_idle_timeout = 0L
431
+
432
+ let default_ssh_auto_mode = true
Original file line number Diff line number Diff line change @@ -1197,6 +1197,12 @@ functor
1197
1197
(pool_uuid ~__context self)
1198
1198
value ;
1199
1199
Local.Pool. set_console_idle_timeout ~__context ~self ~value
1200
+
1201
+ let set_ssh_auto_mode ~__context ~self ~value =
1202
+ info " Pool.set_ssh_auto_mode: pool='%s' value='%b'"
1203
+ (pool_uuid ~__context self)
1204
+ value ;
1205
+ Local.Pool. set_ssh_auto_mode ~__context ~self ~value
1200
1206
end
1201
1207
1202
1208
module VM = struct
@@ -4063,6 +4069,14 @@ functor
4063
4069
let local_fn = Local.Host. set_console_idle_timeout ~self ~value in
4064
4070
let remote_fn = Client.Host. set_console_idle_timeout ~self ~value in
4065
4071
do_op_on ~local_fn ~__context ~host: self ~remote_fn
4072
+
4073
+ let set_ssh_auto_mode ~__context ~self ~value =
4074
+ info " Host.set_ssh_auto_mode: host='%s' value='%b'"
4075
+ (host_uuid ~__context self)
4076
+ value ;
4077
+ let local_fn = Local.Host. set_ssh_auto_mode ~self ~value in
4078
+ let remote_fn = Client.Host. set_ssh_auto_mode ~self ~value in
4079
+ do_op_on ~local_fn ~__context ~host: self ~remote_fn
4066
4080
end
4067
4081
4068
4082
module Host_crashdump = struct
Original file line number Diff line number Diff line change @@ -1044,7 +1044,8 @@ let create ~__context ~uuid ~name_label ~name_description:_ ~hostname ~address
1044
1044
~tls_verification_enabled ~last_software_update ~last_update_hash
1045
1045
~recommended_guidances: [] ~latest_synced_updates_applied: `unknown
1046
1046
~pending_guidances_recommended: [] ~pending_guidances_full: [] ~ssh_enabled
1047
- ~ssh_enabled_timeout ~ssh_expiry ~console_idle_timeout ;
1047
+ ~ssh_enabled_timeout ~ssh_expiry ~console_idle_timeout
1048
+ ~ssh_auto_mode: Constants. default_ssh_auto_mode ;
1048
1049
(* If the host we're creating is us, make sure its set to live *)
1049
1050
Db.Host_metrics. set_last_updated ~__context ~self: metrics ~value: (Date. now () ) ;
1050
1051
Db.Host_metrics. set_live ~__context ~self: metrics ~value: host_is_us ;
@@ -3243,3 +3244,5 @@ let set_console_idle_timeout ~__context ~self ~value =
3243
3244
error " Failed to configure console timeout: %s" (Printexc. to_string e) ;
3244
3245
Helpers. internal_error " Failed to set console timeout: %Ld: %s" value
3245
3246
(Printexc. to_string e)
3247
+
3248
+ let set_ssh_auto_mode ~__context ~self :_ ~value :_ = ()
You can’t perform that action at this time.
0 commit comments