Commit 78389bb
committed
<fix>[compute]: handle empty string dstHostUuid in host allocator
When performing "change host and primary storage"
without specifying a target host, the frontend sends
dstHostUuid="" (empty string) instead of null.
1. Why is this change necessary?
DesignatedHostAllocatorFlow only checked hostUuid for
null, not empty string. Empty string caused SQL to
generate "h.uuid = ''" which matched no hosts, making
all storage migrations without a specified host fail.
2. How does it address the problem?
Normalize empty string hostUuid, zoneUuid, and
clusterUuids to null in
DesignatedHostAllocatorFlow.allocate() before any
filtering logic. This treats empty string as "not
specified", which is the correct semantic. Also fix
a pre-existing NPE in the error-message path where
clusterUuids.isEmpty() was called without null check.
3. Are there any side effects?
None. A valid UUID is never an empty string. All
existing callers passing null or valid UUIDs are
unaffected.
# Summary of changes (by module):
- compute: normalize empty strings to null for
hostUuid, zoneUuid, and clusterUuids in
DesignatedHostAllocatorFlow.allocate(); fix NPE
in error-message path
Related: ZSTAC-83733
Change-Id: Ib669b3f7087e9fcda7f5dd5aa6362c5e653d803d1 parent 226b20b commit 78389bb
1 file changed
Lines changed: 21 additions & 6 deletions
Lines changed: 21 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
4 | 5 | | |
5 | 6 | | |
6 | 7 | | |
| |||
81 | 82 | | |
82 | 83 | | |
83 | 84 | | |
84 | | - | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
85 | 100 | | |
86 | 101 | | |
87 | 102 | | |
88 | 103 | | |
89 | 104 | | |
90 | | - | |
| 105 | + | |
91 | 106 | | |
92 | | - | |
| 107 | + | |
93 | 108 | | |
94 | 109 | | |
95 | 110 | | |
96 | 111 | | |
97 | 112 | | |
98 | 113 | | |
99 | 114 | | |
100 | | - | |
| 115 | + | |
101 | 116 | | |
102 | 117 | | |
103 | 118 | | |
104 | 119 | | |
105 | 120 | | |
106 | | - | |
107 | | - | |
| 121 | + | |
| 122 | + | |
108 | 123 | | |
109 | 124 | | |
110 | 125 | | |
| |||
0 commit comments