diff --git a/internal/guest/runtime/hcsv2/uvm.go b/internal/guest/runtime/hcsv2/uvm.go index 64d47cb764..49229db24b 100644 --- a/internal/guest/runtime/hcsv2/uvm.go +++ b/internal/guest/runtime/hcsv2/uvm.go @@ -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) diff --git a/internal/guest/runtime/runc/runc.go b/internal/guest/runtime/runc/runc.go index d3c9086913..e6d929f5d1 100644 --- a/internal/guest/runtime/runc/runc.go +++ b/internal/guest/runtime/runc/runc.go @@ -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 } @@ -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 } diff --git a/internal/guest/storage/scsi/scsi.go b/internal/guest/storage/scsi/scsi.go index 5ea3f56211..6cdada713d 100644 --- a/internal/guest/storage/scsi/scsi.go +++ b/internal/guest/storage/scsi/scsi.go @@ -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` // @@ -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") defer span.End() defer func() { oc.SetSpanStatus(span, err) }() @@ -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 } @@ -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) } @@ -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//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) @@ -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) } @@ -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