X Tutup
Skip to content

Commit b97ae51

Browse files
committed
Upgrade to govmomi 0.6.2, use WaitFotNetIP to get correct host IP. Note includes mass deletion of other presumably no longer needed deps
Signed-off-by: tristan.keen@gmail.com <tristan.keen@gmail.com>
1 parent c19d866 commit b97ae51

File tree

1,013 files changed

+1843
-42785
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,013 files changed

+1843
-42785
lines changed

Godeps/Godeps.json

Lines changed: 35 additions & 33 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

drivers/vmwarevsphere/vsphere.go

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -239,13 +239,26 @@ func (d *Driver) GetIP() (string, error) {
239239
return "", err
240240
}
241241

242-
rawIP, err := vm.WaitForIP(ctx)
242+
configuredMacIPs, err := vm.WaitForNetIP(ctx, false)
243243
if err != nil {
244244
return "", err
245245
}
246246

247-
ip := strings.Trim(strings.Split(rawIP, "\n")[0], " ")
248-
return ip, nil
247+
for _, ips := range configuredMacIPs {
248+
if len(ips) >= 0 {
249+
// Prefer IPv4 address, but fall back to first/IPv6
250+
preferredIP := ips[0]
251+
for _, ip := range ips {
252+
if net.ParseIP(ip).To4() != nil {
253+
preferredIP = ip
254+
break
255+
}
256+
}
257+
return preferredIP, nil
258+
}
259+
}
260+
261+
return "", errors.New("No IP despite waiting for one - check DHCP status")
249262
}
250263

251264
func (d *Driver) GetState() (state.State, error) {
@@ -404,7 +417,7 @@ func (d *Driver) Create() error {
404417
Name: d.MachineName,
405418
GuestId: "otherLinux64Guest",
406419
Files: &types.VirtualMachineFileInfo{VmPathName: fmt.Sprintf("[%s]", dss.Name())},
407-
NumCPUs: d.CPU,
420+
NumCPUs: int32(d.CPU),
408421
MemoryMB: int64(d.Memory),
409422
}
410423

@@ -455,7 +468,8 @@ func (d *Driver) Create() error {
455468
return err
456469
}
457470

458-
disk := devices.CreateDisk(controller, dss.Path(fmt.Sprintf("%s/%s.vmdk", d.MachineName, d.MachineName)))
471+
disk := devices.CreateDisk(controller, dss.Reference(),
472+
dss.Path(fmt.Sprintf("%s/%s.vmdk", d.MachineName, d.MachineName)))
459473

460474
// Convert MB to KB
461475
disk.CapacityInKB = int64(d.DiskSize) * 1024
@@ -864,8 +878,8 @@ type FileAttrFlag struct {
864878
}
865879

866880
func (f *FileAttrFlag) SetPerms(owner, group, perms int) {
867-
f.OwnerId = owner
868-
f.GroupId = group
881+
f.OwnerId = int32(owner)
882+
f.GroupId = int32(group)
869883
f.Permissions = int64(perms)
870884
}
871885

0 commit comments

Comments
 (0)
X Tutup