@@ -137,9 +137,16 @@ fn parse_crdt(src: &str) -> Result<[u16; TARGET_CRDT_LEN], String> {
137
137
version = version_info_str!( ) ,
138
138
) ]
139
139
pub struct MayastorCliArgs {
140
- #[ clap( short = 'g' , default_value = grpc:: default_endpoint_str( ) ) ]
140
+ #[ clap( short = 'g' , long = "grpc-endpoint" ) ]
141
+ #[ deprecated = "Use grpc_ip and grpc_port instead" ]
141
142
/// IP address and port (optional) for the gRPC server to listen on.
142
- pub grpc_endpoint : String ,
143
+ pub deprecated_grpc_endpoint : Option < String > ,
144
+ #[ clap( default_value_t = std:: net:: IpAddr :: V6 ( std:: net:: Ipv6Addr :: UNSPECIFIED ) ) ]
145
+ /// IP address for the gRPC server to listen on.
146
+ pub grpc_ip : std:: net:: IpAddr ,
147
+ #[ clap( default_value_t = 10124 ) ]
148
+ /// Port for the gRPC server to listen on.
149
+ pub grpc_port : u16 ,
143
150
#[ clap( short = 'R' ) ]
144
151
/// Registration grpc endpoint
145
152
pub registration_endpoint : Option < Uri > ,
@@ -308,8 +315,11 @@ impl MayastorFeatures {
308
315
/// Defaults are redefined here in case of using it during tests
309
316
impl Default for MayastorCliArgs {
310
317
fn default ( ) -> Self {
318
+ #[ allow( deprecated) ]
311
319
Self {
312
- grpc_endpoint : grpc:: default_endpoint ( ) . to_string ( ) ,
320
+ deprecated_grpc_endpoint : None ,
321
+ grpc_ip : std:: net:: IpAddr :: V6 ( std:: net:: Ipv6Addr :: UNSPECIFIED ) ,
322
+ grpc_port : 10124 ,
313
323
ps_endpoint : None ,
314
324
ps_timeout : Duration :: from_secs ( 10 ) ,
315
325
ps_retries : 30 ,
@@ -353,6 +363,15 @@ impl MayastorCliArgs {
353
363
pub fn make_hostnqn ( & self ) -> Option < String > {
354
364
make_hostnqn ( self . node_name . as_ref ( ) )
355
365
}
366
+
367
+ pub fn grpc_endpoint ( & self ) -> std:: net:: SocketAddr {
368
+ #[ allow( deprecated) ]
369
+ if let Some ( deprecated_endpoint) = & self . deprecated_grpc_endpoint {
370
+ grpc:: endpoint_from_str ( deprecated_endpoint, self . grpc_port )
371
+ } else {
372
+ std:: net:: SocketAddr :: new ( self . grpc_ip , self . grpc_port )
373
+ }
374
+ }
356
375
}
357
376
358
377
/// Global exit code of the program, initially set to -1 to capture double
@@ -586,7 +605,7 @@ static MAYASTOR_DEFAULT_ENV: OnceCell<parking_lot::Mutex<MayastorEnvironment>> =
586
605
impl MayastorEnvironment {
587
606
pub fn new ( args : MayastorCliArgs ) -> Self {
588
607
Self {
589
- grpc_endpoint : Some ( grpc :: endpoint ( args. grpc_endpoint ) ) ,
608
+ grpc_endpoint : Some ( args. grpc_endpoint ( ) ) ,
590
609
registration_endpoint : args. registration_endpoint ,
591
610
ps_endpoint : args. ps_endpoint ,
592
611
ps_timeout : args. ps_timeout ,
0 commit comments