Enabled network over vsock

podman machine with Microsoft HyperV will use hvsock on the guest and
vsock on the guest for its networking.  this pr enables the basics for
this to happen as well as changes to ignition to automatically set this
up with network manager.

the vm binary referenced in this pr is in containers/gvisor-tap-vsock
and will need to be added to distributions.

[NO NEW TESTS NEEDED]
Signed-off-by: Brent Baude <bbaude@redhat.com>
This commit is contained in:
Brent Baude
2023-04-14 13:44:41 -05:00
parent ef4dbc27b0
commit 3222545ad5
10 changed files with 257 additions and 106 deletions

View File

@@ -395,9 +395,6 @@ func (vmm *VirtualMachineManager) NewVirtualMachine(name string, config *Hardwar
return err
}
//if err := vmm.CreateVhdxFile(config.DiskPath, config.DiskSize*1024*1024*1024); err != nil {
// return err
//}
if err := NewDriveSettingsBuilder(systemSettings).
AddScsiController().
AddSyntheticDiskDrive(0).
@@ -416,13 +413,15 @@ func (vmm *VirtualMachineManager) NewVirtualMachine(name string, config *Hardwar
return err
}
// Add default network connection
if err := NewNetworkSettingsBuilder(systemSettings).
AddSyntheticEthernetPort(nil).
AddEthernetPortAllocation(""). // "" = connect to default switch
Finish(). // allocation
Finish(). // port
Complete(); err != nil {
return err
if config.Network {
if err := NewNetworkSettingsBuilder(systemSettings).
AddSyntheticEthernetPort(nil).
AddEthernetPortAllocation(""). // "" = connect to default switch
Finish(). // allocation
Finish(). // port
Complete(); err != nil {
return err
}
}
return nil
}

View File

@@ -98,6 +98,9 @@ type HardwareConfig struct {
DiskSize uint64
// Memory in megabytes assigned to the vm
Memory int32
// Network is bool to add a Network Connection to the
// default network switch in Microsoft HyperV
Network bool
}
type Statuses struct {