Commit a076e43
authored
Operational logs over API: hypeman.log, vmm.log (#34)
* Operational logs over API: hypeman.log, vmm.log
* Fix test
* Review instance log handler
* Use log not found error
* Don't delete taps when instance state is unknown
* Review fixes
1. Exec endpoint now has logger injection:
2. Simplified InstanceLogHandler - no more file caching:
- Removed `sharedState` struct with mutex and fileCache
- Each write now opens, writes, closes the file
- No cleanup methods needed = no leak possible
- Simpler code, no shared state complexity
The performance impact is negligible since instance operations (start, stop, standby, etc.) are infrequent. The tradeoff of slightly more I/O vs. guaranteed no leaks and simpler code is worth it.
* add logs
* Fix which id
* Reivew fixes
* run cleanup when no vm
* Move resource id, partial id, name resolution to middleware
* Fix response code
* Extra careful checks
1. Fixed `ErrAmbiguousName` to return 409 Conflict (instead of 404)
Changed the HTTP status code from `http.StatusNotFound` to `http.StatusConflict` for ambiguous name errors, restoring the previous ingress behavior.
2. Added nil checks with 500 error responses for all `GetResolved*` calls
Added defensive nil checks to all 14 handlers that use the resolved resource from middleware. If the middleware didn't set the resource (which shouldn't happen in production but could in tests), the handler now returns a 500 error with `"resource not resolved"` message instead of panicking with a nil pointer dereference.
* resource_id instead of id, fix target in ingress to use instance name
$ hypeman ingress create q --hostname 'nginx-test' --port 80 --host-port 8081
Creating ingress nginx-test-wmbi...
e5hbxzwc6cq0tnjchw861exg
$ hypeman ingress list
ID NAME HOSTNAME TARGET TLS CREATED
e5hbxzwc6cq0 nginx-test-wmbi nginx-test nginx-gi7w:80 no 4 seconds ago
Fix is shows "nginx-gi7w:80" instead of "g:80"1 parent 8b92fda commit a076e43
File tree
40 files changed
+1307
-718
lines changed- cmd/api
- api
- lib
- ingress
- instances
- logger
- middleware
- network
- oapi
- paths
- providers
- vmm
40 files changed
+1307
-718
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| 14 | + | |
14 | 15 | | |
15 | 16 | | |
16 | 17 | | |
| |||
98 | 99 | | |
99 | 100 | | |
100 | 101 | | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
101 | 132 | | |
102 | 133 | | |
103 | 134 | | |
| |||
117 | 148 | | |
118 | 149 | | |
119 | 150 | | |
120 | | - | |
121 | | - | |
122 | | - | |
123 | | - | |
124 | | - | |
125 | | - | |
126 | | - | |
127 | | - | |
128 | | - | |
129 | | - | |
130 | | - | |
131 | | - | |
132 | | - | |
133 | | - | |
134 | | - | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
135 | 166 | | |
| 167 | + | |
136 | 168 | | |
137 | | - | |
| 169 | + | |
| 170 | + | |
138 | 171 | | |
139 | 172 | | |
140 | 173 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | | - | |
14 | 13 | | |
15 | 14 | | |
16 | 15 | | |
17 | 16 | | |
| 17 | + | |
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| |||
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
| 39 | + | |
39 | 40 | | |
40 | 41 | | |
41 | | - | |
42 | 42 | | |
| 43 | + | |
43 | 44 | | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
55 | 49 | | |
56 | 50 | | |
57 | 51 | | |
| |||
105 | 99 | | |
106 | 100 | | |
107 | 101 | | |
108 | | - | |
| 102 | + | |
109 | 103 | | |
110 | 104 | | |
111 | 105 | | |
| |||
133 | 127 | | |
134 | 128 | | |
135 | 129 | | |
136 | | - | |
| 130 | + | |
137 | 131 | | |
138 | 132 | | |
139 | 133 | | |
| |||
148 | 142 | | |
149 | 143 | | |
150 | 144 | | |
151 | | - | |
| 145 | + | |
152 | 146 | | |
153 | 147 | | |
154 | 148 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
11 | 12 | | |
12 | 13 | | |
13 | 14 | | |
| |||
91 | 92 | | |
92 | 93 | | |
93 | 94 | | |
94 | | - | |
| 95 | + | |
95 | 96 | | |
96 | 97 | | |
97 | 98 | | |
| |||
152 | 153 | | |
153 | 154 | | |
154 | 155 | | |
155 | | - | |
| 156 | + | |
156 | 157 | | |
157 | 158 | | |
158 | 159 | | |
| |||
211 | 212 | | |
212 | 213 | | |
213 | 214 | | |
214 | | - | |
| 215 | + | |
215 | 216 | | |
216 | 217 | | |
217 | 218 | | |
| |||
280 | 281 | | |
281 | 282 | | |
282 | 283 | | |
283 | | - | |
| 284 | + | |
284 | 285 | | |
285 | 286 | | |
286 | 287 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
9 | 10 | | |
10 | 11 | | |
11 | 12 | | |
| |||
60 | 61 | | |
61 | 62 | | |
62 | 63 | | |
| 64 | + | |
| 65 | + | |
63 | 66 | | |
64 | | - | |
65 | | - | |
66 | | - | |
67 | | - | |
68 | | - | |
69 | | - | |
70 | | - | |
71 | | - | |
72 | | - | |
73 | | - | |
74 | | - | |
75 | | - | |
76 | | - | |
77 | | - | |
78 | | - | |
79 | | - | |
80 | | - | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
81 | 73 | | |
82 | 74 | | |
83 | 75 | | |
84 | 76 | | |
| 77 | + | |
| 78 | + | |
85 | 79 | | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
86 | 87 | | |
87 | 88 | | |
88 | | - | |
| 89 | + | |
89 | 90 | | |
90 | | - | |
91 | | - | |
92 | | - | |
93 | | - | |
94 | | - | |
95 | | - | |
96 | | - | |
97 | | - | |
98 | | - | |
99 | | - | |
100 | | - | |
101 | | - | |
102 | | - | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
103 | 96 | | |
104 | 97 | | |
105 | 98 | | |
| |||
0 commit comments