mirror of
https://github.com/optim-enterprises-bv/kubernetes.git
synced 2025-11-25 10:55:11 +00:00
vSphere Cloud Provider: update vmware/gomvomi godeps
This commit is contained in:
30
vendor/github.com/vmware/govmomi/simulator/virtual_machine.go
generated
vendored
30
vendor/github.com/vmware/govmomi/simulator/virtual_machine.go
generated
vendored
@@ -17,11 +17,13 @@ limitations under the License.
|
||||
package simulator
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"log"
|
||||
"net"
|
||||
"os"
|
||||
"path"
|
||||
"strconv"
|
||||
"strings"
|
||||
"sync/atomic"
|
||||
"time"
|
||||
@@ -63,7 +65,7 @@ func NewVirtualMachine(parent types.ManagedObjectReference, spec *types.VirtualM
|
||||
MemoryAllocation: &rspec.MemoryAllocation,
|
||||
CpuAllocation: &rspec.CpuAllocation,
|
||||
}
|
||||
vm.Snapshot = &types.VirtualMachineSnapshotInfo{}
|
||||
vm.Snapshot = nil // intentionally set to nil until a snapshot is created
|
||||
vm.Storage = &types.VirtualMachineStorageInfo{
|
||||
Timestamp: time.Now(),
|
||||
}
|
||||
@@ -420,6 +422,28 @@ func (vm *VirtualMachine) generateMAC() string {
|
||||
return mac.String()
|
||||
}
|
||||
|
||||
func numberToString(n int64, sep rune) string {
|
||||
buf := &bytes.Buffer{}
|
||||
if n < 0 {
|
||||
n = -n
|
||||
buf.WriteRune('-')
|
||||
}
|
||||
s := strconv.FormatInt(n, 10)
|
||||
pos := 3 - (len(s) % 3)
|
||||
for i := 0; i < len(s); i++ {
|
||||
if pos == 3 {
|
||||
if i != 0 {
|
||||
buf.WriteRune(sep)
|
||||
}
|
||||
pos = 0
|
||||
}
|
||||
pos++
|
||||
buf.WriteByte(s[i])
|
||||
}
|
||||
|
||||
return buf.String()
|
||||
}
|
||||
|
||||
func (vm *VirtualMachine) configureDevice(devices object.VirtualDeviceList, spec *types.VirtualDeviceConfigSpec) types.BaseMethodFault {
|
||||
device := spec.Device
|
||||
d := device.GetVirtualDevice()
|
||||
@@ -469,6 +493,7 @@ func (vm *VirtualMachine) configureDevice(devices object.VirtualDeviceList, spec
|
||||
c.MacAddress = vm.generateMAC()
|
||||
}
|
||||
case *types.VirtualDisk:
|
||||
summary = fmt.Sprintf("%s KB", numberToString(x.CapacityInKB, ','))
|
||||
switch b := d.Backing.(type) {
|
||||
case types.BaseVirtualDeviceFileBackingInfo:
|
||||
info := b.GetVirtualDeviceFileBackingInfo()
|
||||
@@ -991,8 +1016,7 @@ func (vm *VirtualMachine) RemoveAllSnapshotsTask(req *types.RemoveAllSnapshots_T
|
||||
|
||||
refs := allSnapshotsInTree(vm.Snapshot.RootSnapshotList)
|
||||
|
||||
vm.Snapshot.CurrentSnapshot = nil
|
||||
vm.Snapshot.RootSnapshotList = nil
|
||||
vm.Snapshot = nil
|
||||
|
||||
for _, ref := range refs {
|
||||
Map.Remove(ref)
|
||||
|
||||
Reference in New Issue
Block a user