-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add optional Virtual Switch #46
Conversation
return err | ||
} | ||
|
||
if d.VirtualSwitch == "" { | ||
if err := cmd("Hyper-V\\Remove-VMNetworkAdapter", "-VMName", d.MachineName); err != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@guillaumerose this logic is here just to remove the crc named network adapter in case o there is no virtualswitch provided? Is this virtualswitch present by default?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hyper-V\New-VM
always attach a network adapter. I didn't found an argument to disable it. I had to remove it by hand just after.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Attach a network adapter as name of the machine? @gbraad you have any idea around it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
New-vm might enforce an interface, just not aware this was the case. Will check
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there is no way around this
b84bb76
to
3628d9c
Compare
PR rebased |
drivers/hyperv/hyperv.go
Outdated
"-MemoryStartupBytes", toMb(d.Memory), | ||
} | ||
if d.VirtualSwitch != "" { | ||
log.Infof("Creating VM...") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this creating VM message is not part of the switch check.... ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
return err | ||
} | ||
|
||
if d.VirtualSwitch == "" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can't this move up and be part of the else clause of:
if d.VirtualSwitch != "" {
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
VM is created line 229 here in cmd(args...)
. else
is before and too early in the process.
@@ -398,6 +410,10 @@ func (d *Driver) Kill() error { | |||
} | |||
|
|||
func (d *Driver) GetIP() (string, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
over time we could get rid of these functions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
minor issues, related to ordering of code
3628d9c
to
f670502
Compare
Release is done. Merging it. |
In CRC, VirtualSwitch is always set. When it's empty, we can remove the network interface instead of guessing a name.
https://github.com/code-ready/crc/blob/master/pkg/crc/machine/hyperv/driver_windows.go#L20