vz icon indicating copy to clipboard operation
vz copied to clipboard

Support for VirtualMachine.networkDevices

Open balajiv113 opened this issue 3 years ago • 9 comments

Is your feature request related to a problem? Please describe. Currently there are some network issues. Mostly this happens in cases where system is put on sleep. This support help to debug network issues better and also mostly resolve by reconnecting

Describe the solution you'd like Support for VirtualMachine.networkDevices. With this support, we can use attachmentWasDisconnectedWithError to understand what went wrong and also this provides support for updating the network attachment on the fly.

Additional context https://developer.apple.com/documentation/virtualization/vzvirtualmachinedelegate/3869835-virtualmachine?language=objc https://developer.apple.com/documentation/virtualization/vznetworkdevice/3869833-attachment?language=objc

balajiv113 avatar Jan 10 '23 10:01 balajiv113

@balajiv113 Thanks for creating a new issue! I didn't know that! Thanks.

I will work for it in Sat (JST) because I'm a little busy 🙏

Code-Hex avatar Jan 12 '23 03:01 Code-Hex

I'm sorry too late.

This is a delegate method which meant that the method will be held by a different object than VZVirtualMachine, which has VZVirtualMachine as a property. So I may take a little time to design...

Code-Hex avatar Jan 22 '23 15:01 Code-Hex

Note that this understanding is wrong. They are not dependent on each other.

Support for VirtualMachine.networkDevices. With this support, we can use attachmentWasDisconnectedWithError to understand

Here is a good example. I use the delegate to use the GUI; the object we specify for delegate is not a VZVirtualMachine object.

Code-Hex avatar Jan 22 '23 15:01 Code-Hex

This is one idea, although the long method names are annoying.

vm, err := vz.NewVirtualMachine(config)
if err != nil {
  return err
}

vm.WatchNetworkDeviceAttachmentWasDisconnected(func(networkDevice *vz.NetworkDevice, err error) {
  // Do something here...
})

vm.Start()

Code-Hex avatar Jan 22 '23 16:01 Code-Hex

@balajiv113 Do you have any idea about this method signature?

Code-Hex avatar Apr 15 '23 04:04 Code-Hex

@Code-Hex you mean the signature of attachmentWasDisconnectedWithError ??

balajiv113 avatar Apr 15 '23 04:04 balajiv113

@balajiv113 Yes, I think this usage is may difficult 🤔 https://github.com/Code-Hex/vz/issues/118#issuecomment-1399531495

Code-Hex avatar Apr 15 '23 04:04 Code-Hex

True but this was better compared to creating delegate object as a whole in go.

This will be extensible as well when new methods comes up as far as i see. Internally we will manage the delegate and users doesn't have to know much about it.

One thing to watch out is, we need to support both this and GUI delegate.

balajiv113 avatar Apr 15 '23 04:04 balajiv113

@balajiv113 Thanks.

Yeah I think so :D

One thing to watch out is, we need to support both this and GUI delegate.

Code-Hex avatar Apr 15 '23 05:04 Code-Hex