Vsphere_virtual_machine: Delete all network interfaces from template
before added new one. Fixes #3559 and #3560
This commit is contained in:
parent
f1c6673e1b
commit
8dd4b155e0
|
@ -890,6 +890,22 @@ func (vm *virtualMachine) deployVirtualMachine(c *govmomi.Client) error {
|
|||
}
|
||||
log.Printf("[DEBUG] template: %#v", template)
|
||||
|
||||
devices, err := template.Device(context.TODO())
|
||||
if err != nil {
|
||||
log.Printf("[DEBUG] Template devices can't be found")
|
||||
return err
|
||||
}
|
||||
|
||||
for _, dvc := range devices {
|
||||
// Issue 3559/3560: Delete all ethernet devices to add the correct ones later
|
||||
if devices.Type(dvc) == "ethernet" {
|
||||
err := template.RemoveDevice(context.TODO(), dvc)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var resourcePool *object.ResourcePool
|
||||
if vm.resourcePool == "" {
|
||||
if vm.cluster == "" {
|
||||
|
|
Loading…
Reference in New Issue