@@ -33,7 +33,7 @@ pub(crate) async fn get(
3333 t.free_space, t.free_inodes, t.total_space, t.total_inodes,
3434 gp.p_target_id, gs.s_target_id
3535 FROM targets_ext AS t
36- INNER JOIN nodes_ext AS n USING(node_uid)
36+ LEFT JOIN nodes_ext AS n USING(node_uid)
3737 LEFT JOIN pools_ext AS p USING(node_type, pool_id)
3838 LEFT JOIN buddy_groups AS gp ON gp.p_target_id = t.target_id AND gp.node_type = t.node_type
3939 LEFT JOIN buddy_groups AS gs ON gs.s_target_id = t.target_id AND gs.node_type = t.node_type"
@@ -45,6 +45,19 @@ pub(crate) async fn get(
4545 let is_primary = row. get :: < _ , Option < TargetId > > ( 16 ) ?. is_some ( ) ;
4646 let is_secondary = row. get :: < _ , Option < TargetId > > ( 17 ) ?. is_some ( ) ;
4747
48+ let node = if let Some ( node_id) = row. get :: < _ , Option < NodeId > > ( 6 ) ? {
49+ Some ( pb:: EntityIdSet {
50+ uid : row. get ( 4 ) ?,
51+ legacy_id : Some ( pb:: LegacyId {
52+ num_id : node_id,
53+ node_type,
54+ } ) ,
55+ alias : row. get ( 5 ) ?,
56+ } )
57+ } else {
58+ None
59+ } ;
60+
4861 Ok ( pm:: get_targets_response:: Target {
4962 id : Some ( pb:: EntityIdSet {
5063 uid : row. get ( 0 ) ?,
@@ -55,14 +68,7 @@ pub(crate) async fn get(
5568 alias : row. get ( 1 ) ?,
5669 } ) ,
5770 node_type,
58- node : Some ( pb:: EntityIdSet {
59- uid : row. get ( 4 ) ?,
60- legacy_id : Some ( pb:: LegacyId {
61- num_id : row. get ( 6 ) ?,
62- node_type,
63- } ) ,
64- alias : row. get ( 5 ) ?,
65- } ) ,
71+ node,
6672 storage_pool : if let Some ( uid) = row. get :: < _ , Option < Uid > > ( 7 ) ? {
6773 Some ( pb:: EntityIdSet {
6874 uid : Some ( uid) ,
@@ -219,8 +225,6 @@ pub(crate) async fn delete(
219225
220226 let target = Some ( target. into ( ) ) ;
221227
222- log:: warn!( "{target:?}" ) ;
223-
224228 Ok ( pm:: DeleteTargetResponse { target } )
225229}
226230
0 commit comments