Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion internal/guest/runtime/hcsv2/uvm.go
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@ func newInvalidRequestTypeError(rt prot.ModifyRequestType) error {
func modifyMappedVirtualDisk(ctx context.Context, rt prot.ModifyRequestType, mvd *prot.MappedVirtualDiskV2) (err error) {
switch rt {
case prot.MreqtAdd:
mountCtx, cancel := context.WithTimeout(ctx, time.Second*4)
mountCtx, cancel := context.WithTimeout(ctx, time.Second*5)
defer cancel()
if mvd.MountPath != "" {
return scsi.Mount(mountCtx, mvd.Controller, mvd.Lun, mvd.MountPath, mvd.ReadOnly, false, mvd.Options)
Expand Down
4 changes: 4 additions & 0 deletions internal/guest/runtime/runc/runc.go
Original file line number Diff line number Diff line change
Expand Up @@ -498,6 +498,9 @@ func (p *process) Wait() (int, error) {
if p.pipeRelay != nil {
p.pipeRelay.Wait()
}

l.WithField("pid", p.pid).Debug("relay wait completed")

return exitCode, err
}

Expand All @@ -524,6 +527,7 @@ func (c *container) Wait() (int, error) {
}
}
exitCode, err := c.init.Wait()
logrus.WithField("cid", c.id).Debug("runc.container::init process wait completed")
if err != nil {
return -1, err
}
Expand Down
17 changes: 9 additions & 8 deletions internal/guest/storage/scsi/scsi.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ var (
controllerLunToName = ControllerLunToName
)

const (
scsiDevicesPath = "/sys/bus/scsi/devices"
)

// Mount creates a mount from the SCSI device on `controller` index `lun` to
// `target`
//
Expand All @@ -38,7 +42,7 @@ var (
// If `encrypted` is set to true, the SCSI device will be encrypted using
// dm-crypt.
func Mount(ctx context.Context, controller, lun uint8, target string, readonly bool, encrypted bool, options []string) (err error) {
ctx, span := trace.StartSpan(ctx, "scsi::Mount")
spnCtx, span := trace.StartSpan(ctx, "scsi::Mount")
Comment thread
anmaxvl marked this conversation as resolved.
defer span.End()
defer func() { oc.SetSpanStatus(span, err) }()

Expand All @@ -54,7 +58,7 @@ func Mount(ctx context.Context, controller, lun uint8, target string, readonly b
osRemoveAll(target)
}
}()
source, err := controllerLunToName(ctx, controller, lun)
source, err := controllerLunToName(spnCtx, controller, lun)
if err != nil {
return err
}
Expand All @@ -68,7 +72,7 @@ func Mount(ctx context.Context, controller, lun uint8, target string, readonly b
}

if encrypted {
encryptedSource, err := crypt.EncryptDevice(ctx, source)
encryptedSource, err := crypt.EncryptDevice(spnCtx, source)
if err != nil {
return errors.Wrapf(err, "failed to mount encrypted device: "+source)
}
Expand Down Expand Up @@ -149,7 +153,7 @@ func ControllerLunToName(ctx context.Context, controller, lun uint8) (_ string,

// Devices matching the given SCSI code should each have a subdirectory
// under /sys/bus/scsi/devices/<scsiID>/block.
blockPath := filepath.Join("/sys/bus/scsi/devices", scsiID, "block")
blockPath := filepath.Join(scsiDevicesPath, scsiID, "block")
var deviceNames []os.FileInfo
for {
deviceNames, err = ioutil.ReadDir(blockPath)
Expand All @@ -168,9 +172,6 @@ func ControllerLunToName(ctx context.Context, controller, lun uint8) (_ string,
break
}

if len(deviceNames) == 0 {
return "", errors.Errorf("no matching device names found for SCSI ID \"%s\"", scsiID)
}
if len(deviceNames) > 1 {
return "", errors.Errorf("more than one block device could match SCSI ID \"%s\"", scsiID)
}
Expand All @@ -194,7 +195,7 @@ func UnplugDevice(ctx context.Context, controller, lun uint8) (err error) {
trace.Int64Attribute("lun", int64(lun)))

scsiID := fmt.Sprintf("0:0:%d:%d", controller, lun)
f, err := os.OpenFile(filepath.Join("/sys/bus/scsi/devices", scsiID, "delete"), os.O_WRONLY, 0644)
f, err := os.OpenFile(filepath.Join(scsiDevicesPath, scsiID, "delete"), os.O_WRONLY, 0644)
if err != nil {
if os.IsNotExist(err) {
return nil
Expand Down