mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-07-14 23:55:49 +00:00
runtime: direct-volume stats use correct name
Today the shim does a translation when doing direct-volume stats where it takes the source and returns the mount path within the guest. The source for a direct-assigned volume is actually the device path on the host and not the publish volume path. This change will perform a lookup of the mount info during direct-volume stats to ensure that the device path is provided to the shim for querying the volume stats. Fixes: #4297 Signed-off-by: Yibo Zhuang <yibzhuang@gmail.com>
This commit is contained in:
parent
338c9f2b0b
commit
d1848523d3
@ -130,8 +130,14 @@ func Stats(volumePath string) ([]byte, error) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
urlSafeDevicePath := url.PathEscape(volumePath)
|
volumeMountInfo, err := volume.VolumeMountInfo(volumePath)
|
||||||
body, err := shimclient.DoGet(sandboxId, defaultTimeout, containerdshim.DirectVolumeStatUrl+"/"+urlSafeDevicePath)
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
urlSafeDevicePath := url.PathEscape(volumeMountInfo.Device)
|
||||||
|
body, err := shimclient.DoGet(sandboxId, defaultTimeout,
|
||||||
|
fmt.Sprintf("%s?%s=%s", containerdshim.DirectVolumeStatUrl, containerdshim.DirectVolumePathKey, urlSafeDevicePath))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -144,8 +150,13 @@ func Resize(volumePath string, size uint64) error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
volumeMountInfo, err := volume.VolumeMountInfo(volumePath)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
resizeReq := containerdshim.ResizeRequest{
|
resizeReq := containerdshim.ResizeRequest{
|
||||||
VolumePath: volumePath,
|
VolumePath: volumeMountInfo.Device,
|
||||||
Size: size,
|
Size: size,
|
||||||
}
|
}
|
||||||
encoded, err := json.Marshal(resizeReq)
|
encoded, err := json.Marshal(resizeReq)
|
||||||
|
Loading…
Reference in New Issue
Block a user