@@ -33,7 +33,7 @@ pub(crate) async fn get(
33
33
t.free_space, t.free_inodes, t.total_space, t.total_inodes,
34
34
gp.p_target_id, gs.s_target_id
35
35
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)
37
37
LEFT JOIN pools_ext AS p USING(node_type, pool_id)
38
38
LEFT JOIN buddy_groups AS gp ON gp.p_target_id = t.target_id AND gp.node_type = t.node_type
39
39
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(
45
45
let is_primary = row. get :: < _ , Option < TargetId > > ( 16 ) ?. is_some ( ) ;
46
46
let is_secondary = row. get :: < _ , Option < TargetId > > ( 17 ) ?. is_some ( ) ;
47
47
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
+
48
61
Ok ( pm:: get_targets_response:: Target {
49
62
id : Some ( pb:: EntityIdSet {
50
63
uid : row. get ( 0 ) ?,
@@ -55,14 +68,7 @@ pub(crate) async fn get(
55
68
alias : row. get ( 1 ) ?,
56
69
} ) ,
57
70
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,
66
72
storage_pool : if let Some ( uid) = row. get :: < _ , Option < Uid > > ( 7 ) ? {
67
73
Some ( pb:: EntityIdSet {
68
74
uid : Some ( uid) ,
@@ -219,8 +225,6 @@ pub(crate) async fn delete(
219
225
220
226
let target = Some ( target. into ( ) ) ;
221
227
222
- log:: warn!( "{target:?}" ) ;
223
-
224
228
Ok ( pm:: DeleteTargetResponse { target } )
225
229
}
226
230
0 commit comments