vm: networks: enable on create

This commit is contained in:
hayzamjs
2026-05-23 16:06:01 +05:30
parent cc9ffba15b
commit 69a97393a6
3 changed files with 3 additions and 0 deletions
@@ -290,6 +290,7 @@ func (s *Service) NetworkAttach(req libvirtServiceInterfaces.NetworkAttachReques
SwitchType: swType,
MacID: &macObjId,
Emulation: req.Emulation,
Enable: true,
}
if err := s.DB.Create(&network).Error; err != nil {
+1
View File
@@ -1003,6 +1003,7 @@ func (s *Service) createVMFromTemplateTarget(
SwitchID: switchID,
SwitchType: strings.ToLower(strings.TrimSpace(network.SwitchType)),
Emulation: network.Emulation,
Enable: true,
}
if err := tx.Create(&createdNetwork).Error; err != nil {
return fmt.Errorf("failed_to_create_vm_network_from_template: %w", err)
+1
View File
@@ -1058,6 +1058,7 @@ func (s *Service) CreateVM(data libvirtServiceInterfaces.CreateVMRequest, ctx co
SwitchID: switchId,
SwitchType: swType,
Emulation: data.SwitchEmulationType,
Enable: true,
})
}