Skip to content

Commit

Permalink
fix: correct regex path name for VM
Browse files Browse the repository at this point in the history
Signed-off-by: Anthony Harivel <aharivel@redhat.com>
  • Loading branch information
aharivel committed Aug 9, 2024
1 parent dd3e88b commit 73367d3
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions pkg/libvirt/resolve_vm.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ const (
)

var (
cacheExist = map[uint64]string{}
cacheNotExist = map[uint64]bool{}
regexFindContainerIDPath = regexp.MustCompile(`machine-qemu.*\.scope`)
cacheExist = map[uint64]string{}
cacheNotExist = map[uint64]bool{}
regexFindVMIDPath = regexp.MustCompile(`machine-qemu.*\.scope`)
)

func GetVMID(pid uint64) (string, error) {
Expand All @@ -57,7 +57,7 @@ func getVMID(pid uint64, fileName string) (string, error) {
return "", err
}

content := regexFindContainerIDPath.FindAllString(string(fileContents), -1)
content := regexFindVMIDPath.FindAllString(string(fileContents), -1)
if len(content) == 0 {
addToNotExistCache(pid)
return utils.EmptyString, fmt.Errorf("pid %d does not have vm ID", pid)
Expand Down

0 comments on commit 73367d3

Please sign in to comment.