Skip to content

Commit

Permalink
Merge pull request #15 from baude/getconfigaddpath
Browse files Browse the repository at this point in the history
Add diskpath to GetConfig
  • Loading branch information
baude authored Mar 17, 2023
2 parents 262478c + f547d34 commit 3fddf9a
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions pkg/hypervctl/vm.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import (
"github.com/containers/libhvee/pkg/wmiext"
)


// delete this when close to being done
var (
ErrNotImplemented = errors.New("function not implemented")
Expand Down Expand Up @@ -284,18 +283,27 @@ func (vm *VirtualMachine) list() ([]*HyperVConfig, error) {
return nil, ErrNotImplemented
}

func (vm *VirtualMachine) GetConfig() (*HyperVConfig, error) {
func (vm *VirtualMachine) GetConfig(diskPath string) (*HyperVConfig, error) {
var (
diskSize uint64
)
summary, err := vm.GetSummaryInformation(SummaryRequestCommon)
if err != nil {
return nil, err
}

// Grabbing actual disk size
diskPathInfo, err := os.Stat(diskPath)
if err != nil {
return nil, err
}
diskSize = uint64(diskPathInfo.Size())

config := HyperVConfig{
Hardware: HardwareConfig{
CPUs: summary.NumberOfProcessors,
DiskPath: "",
DiskSize: 0,
DiskPath: diskPath,
DiskSize: diskSize,
Memory: summary.MemoryAvailable,
},
Status: Statuses{
Expand Down

0 comments on commit 3fddf9a

Please sign in to comment.