Merge pull request #2413 from nubificus/fix_jailed_fc-stable-2.1

stable-2.1 | virtcontainers: fc: properly remove jailed block device
This commit is contained in:
Fabiano Fidêncio 2021-08-10 14:42:23 +02:00 committed by GitHub
commit d20ba7da17
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1057,7 +1057,12 @@ func (fc *firecracker) hotplugBlockDevice(ctx context.Context, drive config.Bloc
fc.umountResource(driveID) fc.umountResource(driveID)
// use previous raw file created at createDiskPool, that way // use previous raw file created at createDiskPool, that way
// the resource is released by firecracker and it can be destroyed in the host // the resource is released by firecracker and it can be destroyed in the host
path = filepath.Join(fc.jailerRoot, driveID) if fc.jailed {
// use path relative to the jail
path = filepath.Join("/", driveID)
} else {
path = filepath.Join(fc.jailerRoot, driveID)
}
} }
return nil, fc.fcUpdateBlockDrive(ctx, path, driveID) return nil, fc.fcUpdateBlockDrive(ctx, path, driveID)