Skip to content

Commit cfc2dc7

Browse files
authored
fix(host,region): container rootfs use sub directory (#23289)
1 parent e85643a commit cfc2dc7

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

pkg/compute/container_drivers/volume_mount/disk.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,8 +145,9 @@ func (d disk) ToHostRootFs(rootFs *apis.ContainerRootfs) (*hostapi.ContainerRoot
145145
return &hostapi.ContainerRootfs{
146146
Type: rootFs.Type,
147147
Disk: &hostapi.ContainerVolumeMountDisk{
148-
Index: disk.Index,
149-
Id: disk.Id,
148+
Index: disk.Index,
149+
Id: disk.Id,
150+
SubDirectory: disk.SubDirectory,
150151
},
151152
}, nil
152153
}

pkg/hostman/container/snapshot_service/snapshot_service.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,8 @@ func (s *overlayRootFsUpperSnapshotter) Prepare(ctx context.Context, key string,
8585
if err != nil {
8686
return nil, errors.Wrapf(err, "Prepare with %s", key)
8787
}
88+
infoJson := jsonutils.Marshal(mounts)
89+
log.Debugf("prepare request key: %s, parent: %s, mounts: %s", key, parent, infoJson.String())
8890
mounts, err = s.changeUpper(ctx, key, mounts)
8991
if err != nil {
9092
return nil, errors.Wrapf(err, "Prepare.changeUpper with %s", key)
@@ -97,6 +99,8 @@ func (s *overlayRootFsUpperSnapshotter) View(ctx context.Context, key string, pa
9799
if err != nil {
98100
return nil, errors.Wrapf(err, "View with %s", key)
99101
}
102+
infoJson := jsonutils.Marshal(mounts)
103+
log.Debugf("view request key: %s, parent: %s, info: %s", key, parent, infoJson.String())
100104
mounts, err = s.changeUpper(ctx, key, mounts)
101105
if err != nil {
102106
return nil, errors.Wrapf(err, "View.changeUpper with %s", key)
@@ -112,6 +116,7 @@ func (s *overlayRootFsUpperSnapshotter) changeUpper(ctx context.Context, key str
112116
if err != nil {
113117
return nil, errors.Wrapf(err, "Stat with %s", key)
114118
}
119+
log.Debugf("change upper key: %s, info: %s", key, jsonutils.Marshal(info))
115120
serverId, ok := info.Labels[LabelServerId]
116121
if !ok || serverId == "" {
117122
return mounts, nil
@@ -128,6 +133,7 @@ func (s *overlayRootFsUpperSnapshotter) changeUpper(ctx context.Context, key str
128133
if err != nil {
129134
return mounts, errors.Wrapf(err, "GetRootFsMountPath with %s, %s", serverId, containerId)
130135
}
136+
log.Debugf("changeUpper: rootFsPath: %s , container: %s", rootFsPath, containerId)
131137
upperPath := path.Join(rootFsPath, "upper")
132138
workPath := path.Join(rootFsPath, "work")
133139
for _, dir := range []string{upperPath, workPath} {

0 commit comments

Comments
 (0)