diff --git a/go.mod b/go.mod index 5181222bdb..96265c8337 100644 --- a/go.mod +++ b/go.mod @@ -16,7 +16,7 @@ require ( github.com/containers/common v0.55.1-0.20230824140149-b27c2ba2b7e1 github.com/containers/conmon v2.0.20+incompatible github.com/containers/image/v5 v5.26.1-0.20230807184415-3fb422379cfa - github.com/containers/libhvee v0.4.0 + github.com/containers/libhvee v0.4.1-0.20230816135538-b81ee3f10e1e github.com/containers/ocicrypt v1.1.8 github.com/containers/psgo v1.8.0 github.com/containers/storage v1.49.1-0.20230823084450-6902c2df7cca diff --git a/go.sum b/go.sum index 68eb2eaee0..59edd3ad9e 100644 --- a/go.sum +++ b/go.sum @@ -252,8 +252,8 @@ github.com/containers/conmon v2.0.20+incompatible h1:YbCVSFSCqFjjVwHTPINGdMX1F6J github.com/containers/conmon v2.0.20+incompatible/go.mod h1:hgwZ2mtuDrppv78a/cOBNiCm6O0UMWGx1mu7P00nu5I= github.com/containers/image/v5 v5.26.1-0.20230807184415-3fb422379cfa h1:wDfVQtc6ik2MvsUmu/YRSyBAE5YUxdjcEDtuT1q2KDo= github.com/containers/image/v5 v5.26.1-0.20230807184415-3fb422379cfa/go.mod h1:apL4qwq31NV0gsSZQJPxYyTH0yzWavmMCjT8vsQaXSk= -github.com/containers/libhvee v0.4.0 h1:HGHIIExgP2PjwjHKKoQM3B+3qakNIZcmmkiAO4luAZE= -github.com/containers/libhvee v0.4.0/go.mod h1:fyWDxNQccveTdE3Oe+QRuLbwF/iyV0hDxXqRX5Svlic= +github.com/containers/libhvee v0.4.1-0.20230816135538-b81ee3f10e1e h1:j8QuCCOnTxQNtVwARhgUhe3+QYhXpcuoy9YuIgpLWDE= +github.com/containers/libhvee v0.4.1-0.20230816135538-b81ee3f10e1e/go.mod h1:I30im5oKCYBJMEa+r0jffZn+Yb5/8CnYeAJy+vb77Mg= github.com/containers/libtrust v0.0.0-20230121012942-c1716e8a8d01 h1:Qzk5C6cYglewc+UyGf6lc8Mj2UaPTHy/iF2De0/77CA= github.com/containers/libtrust v0.0.0-20230121012942-c1716e8a8d01/go.mod h1:9rfv8iPl1ZP7aqh9YA68wnZv2NUDbXdcdPHVz0pFbPY= github.com/containers/ocicrypt v1.0.1/go.mod h1:MeJDzk1RJHv89LjsH0Sp5KTY3ZYkjXO/C+bKAeWFIrc= diff --git a/vendor/github.com/containers/libhvee/pkg/hypervctl/vm.go b/vendor/github.com/containers/libhvee/pkg/hypervctl/vm.go index 1e14b6f408..1fbff4ee3e 100644 --- a/vendor/github.com/containers/libhvee/pkg/hypervctl/vm.go +++ b/vendor/github.com/containers/libhvee/pkg/hypervctl/vm.go @@ -544,17 +544,6 @@ func (vm *VirtualMachine) remove() (int32, error) { return -1, err } - wmiInst, err := vm.fetchSystemSettingsInstance(srv) - if err != nil { - return -1, err - } - defer wmiInst.Close() - - path, err := wmiInst.Path() - if err != nil { - return -1, err - } - vsms, err := srv.GetSingletonInstance("Msvm_VirtualSystemManagementService") if err != nil { return -1, err @@ -562,15 +551,14 @@ func (vm *VirtualMachine) remove() (int32, error) { defer vsms.Close() var ( - job *wmiext.Instance - resultingSystem string + job *wmiext.Instance ) + // https://learn.microsoft.com/en-us/windows/win32/hyperv_v2/cim-virtualsystemmanagementservice-destroysystem if err := vsms.BeginInvoke("DestroySystem"). - In("AffectedSystem", path). + In("AffectedSystem", vm.Path()). Execute(). Out("Job", &job). - Out("ResultingSystem", &resultingSystem). Out("ReturnValue", &res).End(); err != nil { return -1, err } @@ -583,21 +571,17 @@ func (vm *VirtualMachine) remove() (int32, error) { } func (vm *VirtualMachine) Remove(diskPath string) error { - res, err := vm.remove() - if err != nil { + if _, err := vm.remove(); err != nil { return err } - if DestroySystemResult(res) == VMDestroyCompletedwithNoError { - // Remove disk only if we were given one - if len(diskPath) > 0 { - if err := os.Remove(diskPath); err != nil { - return err - } - } - return nil - } - return fmt.Errorf("failed to destroy system %s: %s", vm.Name, DestroySystemResult(res).Reason()) + // Remove disk only if we were given one + if len(diskPath) > 0 { + if err := os.Remove(diskPath); err != nil { + return err + } + } + return nil } func (vm *VirtualMachine) State() EnabledState { diff --git a/vendor/modules.txt b/vendor/modules.txt index a83012cc5a..92d701e99e 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -286,7 +286,7 @@ github.com/containers/image/v5/transports github.com/containers/image/v5/transports/alltransports github.com/containers/image/v5/types github.com/containers/image/v5/version -# github.com/containers/libhvee v0.4.0 +# github.com/containers/libhvee v0.4.1-0.20230816135538-b81ee3f10e1e ## explicit; go 1.18 github.com/containers/libhvee/pkg/hypervctl github.com/containers/libhvee/pkg/kvp/ginsu