feat: add correct qemu inspect status method#4465
Open
fatelei wants to merge 1 commit intolima-vm:masterfrom
Open
feat: add correct qemu inspect status method#4465fatelei wants to merge 1 commit intolima-vm:masterfrom
fatelei wants to merge 1 commit intolima-vm:masterfrom
Conversation
2f0b6dd to
d924fb3
Compare
Member
typo |
Member
|
The commit message has the typo too |
Signed-off-by: fatelei <fatelei@gmail.com>
Author
fixed |
Member
|
Note that when returning "", the store will check the PID files. So it is the default implementation. StatusUnknown Status = "" if status == "" {
inspectStatusWithPIDFiles(instDir, inst, y)
return
}current code: var err error
inst.DriverPID, err = ReadPIDFile(filepath.Join(instDir, filenames.PIDFile(*y.VMType)))
if err != nil {
inst.Status = limatype.StatusBroken
inst.Errors = append(inst.Errors, err)
}
if inst.Status == limatype.StatusUnknown {
switch {
case inst.HostAgentPID > 0 && inst.DriverPID > 0:
inst.Status = limatype.StatusRunning
case inst.HostAgentPID == 0 && inst.DriverPID == 0:
inst.Status = limatype.StatusStopped
case inst.HostAgentPID > 0 && inst.DriverPID == 0:
inst.Errors = append(inst.Errors, errors.New("host agent is running but driver is not"))
inst.Status = limatype.StatusBroken
default:
inst.Errors = append(inst.Errors, fmt.Errorf("%s driver is running but host agent is not", inst.VMType))
inst.Status = limatype.StatusBroken
}
}this PR: qemuPIDPath := filepath.Join(instance.Dir, filenames.PIDFile(limatype.QEMU))
if _, statErr := os.Stat(qemuPIDPath); statErr != nil {
if errors.Is(statErr, os.ErrNotExist) {
return ""
}
return limatype.StatusBroken
}
pid, err := store.ReadPIDFile(qemuPIDPath)
if err != nil {
return limatype.StatusBroken
}
if pid == 0 {
return limatype.StatusBroken
} |
afbjorklund
requested changes
Dec 19, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fix #125