From b3b0a6e08c4dcab512c214dc28702233d128ef74 Mon Sep 17 00:00:00 2001 From: Doug MacEachern Date: Fri, 17 Jan 2025 15:17:47 -0800 Subject: [PATCH 1/2] vcsim: fix save+load of Alarm objects govc object.save includes Alarm objects, but vcsim -load did not wrap the Alarm objects. This causes panic when trying to call CreateAlarm() which expects wrapped Alarm objects. Signed-off-by: Doug MacEachern --- simulator/model.go | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/simulator/model.go b/simulator/model.go index e590838e6..a69827b97 100644 --- a/simulator/model.go +++ b/simulator/model.go @@ -1,18 +1,6 @@ -/* -Copyright (c) 2017-2024 VMware, Inc. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - -http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ +// © Broadcom. All Rights Reserved. +// The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. +// SPDX-License-Identifier: Apache-2.0 package simulator @@ -232,6 +220,7 @@ func (*Model) fmtName(prefix string, num int) string { // kinds maps managed object types to their vcsim wrapper types var kinds = map[string]reflect.Type{ + "Alarm": reflect.TypeOf((*Alarm)(nil)).Elem(), "AlarmManager": reflect.TypeOf((*AlarmManager)(nil)).Elem(), "AuthorizationManager": reflect.TypeOf((*AuthorizationManager)(nil)).Elem(), "ClusterComputeResource": reflect.TypeOf((*ClusterComputeResource)(nil)).Elem(), From 8aefcdd87b3967cc3d2fe2595da0d76fa3de7ecf Mon Sep 17 00:00:00 2001 From: Doug MacEachern Date: Fri, 17 Jan 2025 15:19:47 -0800 Subject: [PATCH 2/2] fix: add DirectPathProfileManager to mo registry Signed-off-by: Doug MacEachern --- vim25/mo/registry.go | 36 +++++++++++++++++++++--------------- 1 file changed, 21 insertions(+), 15 deletions(-) diff --git a/vim25/mo/registry.go b/vim25/mo/registry.go index deacf508b..ed5b5e359 100644 --- a/vim25/mo/registry.go +++ b/vim25/mo/registry.go @@ -1,21 +1,27 @@ -/* -Copyright (c) 2014 VMware, Inc. All Rights Reserved. +// © Broadcom. All Rights Reserved. +// The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. +// SPDX-License-Identifier: Apache-2.0 -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at +package mo - http://www.apache.org/licenses/LICENSE-2.0 +import ( + "reflect" -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ + "github.com/vmware/govmomi/vim25/types" +) -package mo +var t = map[string]reflect.Type{} -import "reflect" +// TODO: 9.0 mo below, not included in the generate mo/mo.go, since the generator still uses older rbvmomi vmodl.db -var t = map[string]reflect.Type{} +type DirectPathProfileManager struct { + Self types.ManagedObjectReference `json:"self"` +} + +func (m DirectPathProfileManager) Reference() types.ManagedObjectReference { + return m.Self +} + +func init() { + t["DirectPathProfileManager"] = reflect.TypeOf((*DirectPathProfileManager)(nil)).Elem() +}