Skip to content

Commit

Permalink
api: rest: Update storage information Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
taking committed Jun 11, 2024
1 parent 71cdda9 commit c4c8bd0
Showing 1 changed file with 27 additions and 27 deletions.
54 changes: 27 additions & 27 deletions agent/driver/infra/compute_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,21 @@ package infra
import (
"errors"
"fmt"
"io"
"os"
"strings"
"time"
"unsafe"

"github.com/cloud-barista/cm-honeybee/agent/pkg/api/rest/model/onprem/infra"
"github.com/jaypipes/ghw"
"github.com/jollaman999/utils/logger"
"github.com/shirou/gopsutil/v3/cpu"
"github.com/shirou/gopsutil/v3/host"
"github.com/yumaojun03/dmidecode"
"github.com/yumaojun03/dmidecode/parser/memory"
"golang.org/x/sys/windows"
"golang.org/x/sys/windows/registry"
"io"
"os"
"strings"
"time"
"unsafe"
)

func getWindowsReleaseVersion() (string, error) {
Expand Down Expand Up @@ -343,31 +345,29 @@ func GetComputeInfo() (infra.Compute, error) {
}
}

// TODO
// storage information

//block, err := ghw.Block()
//if err != nil {
// return infra.Compute{}, err
//}

rootDisk := infra.Disk{
Label: "Windows 11 (TODO: DUMMY DATA)",
Type: "SSD",
Size: 50,
block, err := ghw.Block()
if err != nil {
return infra.Compute{}, err
}

dataDisk := []infra.Disk{
{
Label: "Storage 1 (TODO: DUMMY DATA)",
Type: "HDD",
Size: 100,
},
{
Label: "Storage 2 (TODO: DUMMY DATA)",
Type: "HDD",
Size: 200,
},
rootDisk := infra.Disk{}
dataDisk := []infra.Disk{}
for _, disk := range block.Disks {
for _, part := range disk.Partitions {
if strings.EqualFold(part.Type, "Installable File System") {
rootDisk = infra.Disk{
Label: part.Name,
Type: disk.DriveType.String(),
Size: uint(float64(part.SizeBytes) / float64(1000*1000*1000))}
} else {
dataDisk = append(dataDisk, infra.Disk{
Label: part.Name,
Type: disk.DriveType.String(),
Size: uint(float64(part.SizeBytes) / float64(1000*1000*1000)),
})
}
}
}

// All of compute information
Expand Down

0 comments on commit c4c8bd0

Please sign in to comment.