Vsphere_virtual_machine: Delete all network interfaces from template

before added new one. Fixes #3559 and #3560
This commit is contained in:
Eloy Coto 2015-10-27 09:43:01 +00:00
parent f1c6673e1b
commit 8dd4b155e0
1 changed files with 16 additions and 0 deletions

View File

@ -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 == "" {