diff --git a/app/app.go b/app/app.go index a0a71ef..f204750 100644 --- a/app/app.go +++ b/app/app.go @@ -13,7 +13,7 @@ import ( "github.com/luthermonson/go-proxmox" ) -const APIVersion string = "0.0.2" +const APIVersion string = "0.0.3" var client ProxmoxClient diff --git a/app/model.go b/app/model.go index ce86541..56515c8 100644 --- a/app/model.go +++ b/app/model.go @@ -238,5 +238,7 @@ func (instance *Instance) RebuildDevice(host *Node, deviceid string) error { // sub function assignment not supported yet } + instance.Devices[InstanceDeviceID(instanceDeviceBusID)].Value = instanceDevice + return nil } diff --git a/app/proxmox.go b/app/proxmox.go index d9cf799..4287e97 100644 --- a/app/proxmox.go +++ b/app/proxmox.go @@ -82,17 +82,17 @@ func (pve ProxmoxClient) Node(nodeName string) (*Node, error) { functionid := FunctionID(x[1]) if _, ok := host.Devices[deviceid]; !ok { host.Devices[deviceid] = &Device{ - DeviceID: deviceid, - DeviceName: device.DeviceName, - VendorName: device.VendorName, - Functions: make(map[FunctionID]*Function), + Device_ID: deviceid, + Device_Name: device.Device_Name, + Vendor_Name: device.Vendor_Name, + Functions: make(map[FunctionID]*Function), } } host.Devices[deviceid].Functions[functionid] = &Function{ - FunctionID: functionid, - FunctionName: device.SubsystemDeviceName, - VendorName: device.SubsystemVendorName, - Reserved: false, + Function_ID: functionid, + Function_Name: device.Subsystem_Device_Name, + Vendor_Name: device.Subsystem_Vendor_Name, + Reserved: false, } } @@ -225,7 +225,7 @@ func GetVolumeInfo(host *Node, volume string) (*Volume, error) { volumeData.Storage = storageID volumeData.Format = c.Format volumeData.Size = uint64(c.Size) - volumeData.Volid = VolumeID(volumeID) + volumeData.File = volumeID } } diff --git a/app/types.go b/app/types.go index c4e9bfd..52d4e0c 100644 --- a/app/types.go +++ b/app/types.go @@ -59,11 +59,11 @@ var VolumeTypes = []string{ type VolumeID string type Volume struct { - Type string `json:"type"` - Storage string `json:"storage"` - Format string `json:"format"` - Size uint64 `json:"size"` - Volid VolumeID `json:"volid"` + Type string `json:"type"` + Storage string `json:"storage"` + Format string `json:"format"` + Size uint64 `json:"size"` + File string `json:"file"` } type NetID uint64 @@ -74,27 +74,28 @@ type Net struct { } type PVEDevice struct { - ID string `json:"id"` - DeviceName string `json:"device_name"` - VendorName string `json:"vendor_name"` - SubsystemDeviceName string `json:"subsystem_device_name"` - SubsystemVendorName string `json:"subsystem_vendor_name"` + ID string `json:"id"` + Device_Name string `json:"device_name"` + Vendor_Name string `json:"vendor_name"` + Subsystem_Device_Name string `json:"subsystem_device_name"` + Subsystem_Vendor_Name string `json:"subsystem_vendor_name"` } type DeviceID string type InstanceDeviceID uint64 type Device struct { - DeviceID DeviceID `json:"device_id"` - DeviceName string `json:"device_name"` - VendorName string `json:"vendor_name"` - Functions map[FunctionID]*Function `json:"functions"` - Reserved bool `json:"reserved"` + Device_ID DeviceID `json:"device_id"` + Device_Name string `json:"device_name"` + Vendor_Name string `json:"vendor_name"` + Functions map[FunctionID]*Function `json:"functions"` + Reserved bool `json:"reserved"` + Value string } type FunctionID string type Function struct { - FunctionID FunctionID `json:"function_id"` - FunctionName string `json:"subsystem_device_name"` - VendorName string `json:"subsystem_vendor_name"` - Reserved bool `json:"reserved"` + Function_ID FunctionID `json:"function_id"` + Function_Name string `json:"subsystem_device_name"` + Vendor_Name string `json:"subsystem_vendor_name"` + Reserved bool `json:"reserved"` }