Skip to content

Commit 040a633

Browse files
authored
Merge pull request #3686 from dougm/ignore-resourceConfigSpecDetailed
Add ResourcePool.resourceConfigSpecDetailed to missingSet filter
2 parents 13cb119 + ca8c642 commit 040a633

File tree

2 files changed

+44
-15
lines changed

2 files changed

+44
-15
lines changed

vim25/mo/retrieve.go

+8-15
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,6 @@
1-
/*
2-
Copyright (c) 2014-2024 VMware, Inc. All Rights Reserved.
3-
4-
Licensed under the Apache License, Version 2.0 (the "License");
5-
you may not use this file except in compliance with the License.
6-
You may obtain a copy of the License at
7-
8-
http://www.apache.org/licenses/LICENSE-2.0
9-
10-
Unless required by applicable law or agreed to in writing, software
11-
distributed under the License is distributed on an "AS IS" BASIS,
12-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13-
See the License for the specific language governing permissions and
14-
limitations under the License.
15-
*/
1+
// © Broadcom. All Rights Reserved.
2+
// The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries.
3+
// SPDX-License-Identifier: Apache-2.0
164

175
package mo
186

@@ -36,6 +24,11 @@ func ignoreMissingProperty(ref types.ManagedObjectReference, p types.MissingProp
3624
// Seen with vApp child VM
3725
return true
3826
}
27+
case "ResourcePool":
28+
switch p.Path {
29+
case "resourceConfigSpecDetailed":
30+
return true
31+
}
3932
}
4033

4134
return false

vim25/mo/retrieve_test.go

+36
Original file line numberDiff line numberDiff line change
@@ -238,3 +238,39 @@ func TestDatastoreInfoURL(t *testing.T) {
238238
t.Errorf("info.name=%s", info.Name)
239239
}
240240
}
241+
242+
func TestIgnoreMissingProperty(t *testing.T) {
243+
// subset of RetrievePropertiesEx response, see ignoreMissingProperty()
244+
content := []types.ObjectContent{{
245+
Obj: types.ManagedObjectReference{Type: "ResourcePool", Value: "ha-root-pool"},
246+
PropSet: []types.DynamicProperty{{
247+
Name: "config",
248+
Val: types.ResourceConfigSpec{
249+
CpuAllocation: types.ResourceAllocationInfo{
250+
Reservation: types.NewInt64(5585),
251+
Limit: types.NewInt64(5585),
252+
},
253+
MemoryAllocation: types.ResourceAllocationInfo{
254+
Reservation: types.NewInt64(13652),
255+
Limit: types.NewInt64(13652),
256+
},
257+
},
258+
}},
259+
MissingSet: []types.MissingProperty{
260+
{
261+
Path: "resourceConfigSpecDetailed",
262+
Fault: types.LocalizedMethodFault{
263+
Fault: &types.SystemError{
264+
Reason: "unexpected error reading property",
265+
},
266+
},
267+
},
268+
},
269+
}}
270+
271+
var pool ResourcePool
272+
273+
if err := LoadObjectContent(content, &pool); err != nil {
274+
t.Fatal(err)
275+
}
276+
}

0 commit comments

Comments
 (0)