mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-09-25 18:53:44 +00:00
runtime: add more debug logs for non-root user operation
Previously the logging was insufficient and made debugging difficult Fixes: #5155 Signed-off-by: Feng Wang <feng.wang@databricks.com>
This commit is contained in:
@@ -1061,13 +1061,26 @@ func (q *qemu) cleanupVM() error {
|
||||
if rootless.IsRootless() {
|
||||
u, err := user.LookupId(strconv.Itoa(int(q.config.Uid)))
|
||||
if err != nil {
|
||||
q.Logger().WithError(err).WithField("uid", q.config.Uid).Warn("failed to find the user")
|
||||
q.Logger().WithError(err).WithFields(
|
||||
logrus.Fields{
|
||||
"user": u.Username,
|
||||
"uid": q.config.Uid,
|
||||
}).Warn("failed to find the user")
|
||||
return nil
|
||||
}
|
||||
|
||||
if err := pkgUtils.RemoveVmmUser(u.Username); err != nil {
|
||||
q.Logger().WithError(err).WithField("user", u.Username).Warn("failed to delete the user")
|
||||
q.Logger().WithError(err).WithFields(
|
||||
logrus.Fields{
|
||||
"user": u.Username,
|
||||
"uid": q.config.Uid,
|
||||
}).Warn("failed to delete the user")
|
||||
}
|
||||
q.Logger().WithFields(
|
||||
logrus.Fields{
|
||||
"user": u.Username,
|
||||
"uid": q.config.Uid,
|
||||
}).Debug("successfully removed the non root user")
|
||||
}
|
||||
|
||||
return nil
|
||||
|
Reference in New Issue
Block a user