Merge pull request #1558 from amshinde/ignore-floppy-drives

devices: Skip floppy drives while passing devices to guest
This commit is contained in:
Graham Whaley 2019-05-03 17:34:11 +01:00 committed by GitHub
commit ea71133d1a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -51,6 +51,10 @@ var cdromMajors = map[int64]string{
32: "CM206_CDROM_MAJOR",
}
// https://github.com/torvalds/linux/blob/master/include/uapi/linux/major.h
// #define FLOPPY_MAJOR 2
const floppyMajor = int64(2)
// Process gathers data related to a container process.
type Process struct {
// Token is the process execution context ID. It must be
@ -626,6 +630,14 @@ func filterDevices(c *Container, devices []ContainerDevice) (ret []ContainerDevi
}).Info("Not attach device because it is a CDROM")
continue
}
if major == floppyMajor {
c.Logger().WithFields(logrus.Fields{
"device": dev.ContainerPath,
}).Info("Not attaching device because it is a floppy drive")
continue
}
ret = append(ret, dev)
}
return