Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into ckochhof/dev/master…
Browse files Browse the repository at this point in the history
…/daos-15596

Required-githooks: true
  • Loading branch information
kanard38 authored and Cedric Koch-Hofer committed Oct 14, 2024
2 parents 7e3e54b + 2661ebc commit 8673384
Show file tree
Hide file tree
Showing 13 changed files with 1,263 additions and 973 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/trivy.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
name: Trivy scan

on:
workflow_dispatch:
push:
branches: ["master", "release/**"]
pull_request:
branches: ["master", "release/**"]

Expand Down
1 change: 1 addition & 0 deletions docs/admin/env_variables.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ Environment variables in this section only apply to the server side.
|DAOS\_MD\_CAP |Size of a metadata pmem pool/file in MBs. INTEGER. Default to 128 MB.|
|DAOS\_START\_POOL\_SVC|Determines whether to start existing pool services when starting a daos\_server. BOOL. Default to true.|
|CRT\_DISABLE\_MEM\_PIN|Disable memory pinning workaround on a server side. BOOL. Default to 0.|
|CRT\_EVENT\_DELAY|Delay in seconds before handling each CaRT event. INTEGER. Default to 10 s. A longer delay enables batching of successive CaRT events, leading to fewer pool map changes when multiple engines become unavailable at around the same time.|
|DAOS\_SCHED\_PRIO\_DISABLED|Disable server ULT prioritizing. BOOL. Default to 0.|
|DAOS\_SCHED\_RELAX\_MODE|The mode of CPU relaxing on idle. "disabled":disable relaxing; "net":wait on network request for INTVL; "sleep":sleep for INTVL. STRING. Default to "net"|
|DAOS\_SCHED\_RELAX\_INTVL|CPU relax interval in milliseconds. INTEGER. Default to 1 ms.|
Expand Down
14 changes: 10 additions & 4 deletions src/client/dfuse/pil4dfs/int_dfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -6302,6 +6302,14 @@ new_mmap(void *addr, size_t length, int prot, int flags, int fd, off_t offset)

atomic_fetch_add_relaxed(&num_mmap, 1);

if ((fd < FD_FILE_BASE) && (fd_directed >= FD_FILE_BASE) && d_compatible_mode) {
/* DAOS-14494: Force the kernel to update the size before mapping. */
rc = next_fxstat(1, fd, &stat_buf);
if (rc == -1)
return MAP_FAILED;
return next_mmap(addr, length, prot, flags, fd, offset);
}

addr_ret = next_mmap(addr, length, prot, flags | MAP_ANONYMOUS, -1, offset);
if (addr_ret == MAP_FAILED)
return MAP_FAILED;
Expand Down Expand Up @@ -7086,10 +7094,8 @@ init_myhook(void)

register_a_hook("libc", "fcntl", (void *)new_fcntl, (long int *)(&libc_fcntl));

if (d_compatible_mode == false) {
register_a_hook("libc", "mmap", (void *)new_mmap, (long int *)(&next_mmap));
register_a_hook("libc", "munmap", (void *)new_munmap, (long int *)(&next_munmap));
}
register_a_hook("libc", "mmap", (void *)new_mmap, (long int *)(&next_mmap));
register_a_hook("libc", "munmap", (void *)new_munmap, (long int *)(&next_munmap));

register_a_hook("libc", "exit", (void *)new_exit, (long int *)(&next_exit));
register_a_hook("libc", "dup3", (void *)new_dup3, (long int *)(&libc_dup3));
Expand Down
5 changes: 5 additions & 0 deletions src/client/pydaos/pydaos_shim.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ static daos_handle_t eq;
* Implementations of baseline shim functions
*/

#if 0
static void
child_handler(void)
{
Expand All @@ -84,6 +85,7 @@ child_handler(void)
if (rc)
DL_ERROR(rc, "Failed to re-create global eq");
}
#endif

static PyObject *
__shim_handle__daos_init(PyObject *self, PyObject *args)
Expand All @@ -101,11 +103,14 @@ __shim_handle__daos_init(PyObject *self, PyObject *args)
return PyLong_FromLong(rc);
}

#if 0
/** disabled due to DAOS-16637 */
rc = pthread_atfork(NULL, NULL, &child_handler);
if (rc) {
DL_ERROR(rc, "Failed to set atfork handler");
return PyLong_FromLong(rc);
}
#endif

return PyLong_FromLong(rc);
}
Expand Down
192 changes: 0 additions & 192 deletions src/control/cmd/dmg/pretty/storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,8 @@ import (
"io"
"strings"

"github.com/dustin/go-humanize"
"github.com/pkg/errors"

"github.com/daos-stack/daos/src/control/lib/control"
"github.com/daos-stack/daos/src/control/lib/txtfmt"
"github.com/daos-stack/daos/src/control/server/storage"
)

// printHostStorageMapVerbose generates a human-readable representation of the supplied
Expand Down Expand Up @@ -85,44 +81,6 @@ func PrintHostStorageMap(hsm control.HostStorageMap, out io.Writer, opts ...Prin
return nil
}

// PrintHostStorageUsageMap generates a human-readable representation of the supplied
// HostStorageMap struct and writes utilization info to the supplied io.Writer.
func PrintHostStorageUsageMap(hsm control.HostStorageMap, out io.Writer) error {
if len(hsm) == 0 {
return nil
}

hostsTitle := "Hosts"
scmTitle := "SCM-Total"
scmFreeTitle := "SCM-Free"
scmUsageTitle := "SCM-Used"
nvmeTitle := "NVMe-Total"
nvmeFreeTitle := "NVMe-Free"
nvmeUsageTitle := "NVMe-Used"

tablePrint := txtfmt.NewTableFormatter(hostsTitle, scmTitle, scmFreeTitle,
scmUsageTitle, nvmeTitle, nvmeFreeTitle, nvmeUsageTitle)
tablePrint.InitWriter(out)
table := []txtfmt.TableRow{}

for _, key := range hsm.Keys() {
hss := hsm[key]
hosts := getPrintHosts(hss.HostSet.RangedString())
row := txtfmt.TableRow{hostsTitle: hosts}
storage := hss.HostStorage
row[scmTitle] = humanize.Bytes(storage.ScmNamespaces.Total())
row[scmFreeTitle] = humanize.Bytes(storage.ScmNamespaces.Free())
row[scmUsageTitle] = storage.ScmNamespaces.PercentUsage()
row[nvmeTitle] = humanize.Bytes(storage.NvmeDevices.Total())
row[nvmeFreeTitle] = humanize.Bytes(storage.NvmeDevices.Free())
row[nvmeUsageTitle] = storage.NvmeDevices.PercentUsage()
table = append(table, row)
}

tablePrint.Format(table)
return nil
}

func printStorageFormatMapVerbose(hsm control.HostStorageMap, out io.Writer, opts ...PrintConfigOption) error {
for _, key := range hsm.Keys() {
hss := hsm[key]
Expand Down Expand Up @@ -176,153 +134,3 @@ func PrintStorageFormatMap(hsm control.HostStorageMap, out io.Writer, opts ...Pr
tablePrint.Format(table)
return nil
}

// NVMe controller namespace ID (NSID) should only be displayed if >= 1. Zero value should be
// ignored in display output.
func printSmdDevice(dev *storage.SmdDevice, iw io.Writer, opts ...PrintConfigOption) error {
fc := getPrintConfig(opts...)

trAddr := fmt.Sprintf("TrAddr:%s", dev.Ctrlr.PciAddr)
nsID := fmt.Sprintf("NSID:%d", dev.CtrlrNamespaceID)
uid := fmt.Sprintf("UUID:%s", dev.UUID)
led := fmt.Sprintf("LED:%s", dev.Ctrlr.LedState)

if fc.LEDInfoOnly {
out := trAddr
if dev.CtrlrNamespaceID > 0 {
out = fmt.Sprintf("%s %s", out, nsID)
}
if dev.UUID != "" {
out = fmt.Sprintf("%s [%s]", out, uid)
}

_, err := fmt.Fprintf(iw, "%s %s\n", out, led)
return err
}

out := fmt.Sprintf("%s [%s", uid, trAddr)
if dev.CtrlrNamespaceID > 0 {
out = fmt.Sprintf("%s %s", out, nsID)
}
if _, err := fmt.Fprintf(iw, "%s]\n", out); err != nil {
return err
}

var hasSysXS string
if dev.HasSysXS {
hasSysXS = "SysXS "
}
if _, err := fmt.Fprintf(txtfmt.NewIndentWriter(iw),
"Roles:%s %sTargets:%+v Rank:%d State:%s LED:%s\n", &dev.Roles, hasSysXS,
dev.TargetIDs, dev.Rank, dev.Ctrlr.NvmeState, dev.Ctrlr.LedState); err != nil {
return err
}

return nil
}

func printSmdPool(pool *control.SmdPool, out io.Writer, opts ...PrintConfigOption) error {
ew := txtfmt.NewErrWriter(out)
fmt.Fprintf(ew, "Rank:%d Targets:%+v", pool.Rank, pool.TargetIDs)
cfg := getPrintConfig(opts...)
if cfg.Verbose {
fmt.Fprintf(ew, " Blobs:%+v", pool.Blobs)
}
fmt.Fprintln(ew)
return ew.Err
}

// PrintSmdInfoMap generates a human-readable representation of the supplied
// HostStorageMap, with a focus on presenting the per-server metadata (SMD) information.
func PrintSmdInfoMap(omitDevs, omitPools bool, hsm control.HostStorageMap, out io.Writer, opts ...PrintConfigOption) error {
w := txtfmt.NewErrWriter(out)

for _, key := range hsm.Keys() {
hss := hsm[key]
hosts := getPrintHosts(hss.HostSet.RangedString(), opts...)
lineBreak := strings.Repeat("-", len(hosts))
fmt.Fprintf(out, "%s\n%s\n%s\n", lineBreak, hosts, lineBreak)

iw := txtfmt.NewIndentWriter(out)
if hss.HostStorage.SmdInfo == nil {
fmt.Fprintln(iw, "No SMD info returned")
continue
}

if !omitDevs {
if len(hss.HostStorage.SmdInfo.Devices) > 0 {
fmt.Fprintln(iw, "Devices")

for _, device := range hss.HostStorage.SmdInfo.Devices {
iw1 := txtfmt.NewIndentWriter(iw)
if err := printSmdDevice(device, iw1, opts...); err != nil {
return err
}
if device.Ctrlr.HealthStats == nil {
continue
}
if err := printNvmeHealth(device.Ctrlr.HealthStats,
txtfmt.NewIndentWriter(iw1), opts...); err != nil {
return err
}
fmt.Fprintln(out)
}
} else {
fmt.Fprintln(iw, "No devices found")
}
}

if !omitPools {
if len(hss.HostStorage.SmdInfo.Pools) > 0 {
fmt.Fprintln(iw, "Pools")

for uuid, poolSet := range hss.HostStorage.SmdInfo.Pools {
iw1 := txtfmt.NewIndentWriter(iw)
fmt.Fprintf(iw1, "UUID:%s\n", uuid)
iw2 := txtfmt.NewIndentWriter(iw1)
for _, pool := range poolSet {
if err := printSmdPool(pool, iw2, opts...); err != nil {
return err
}
}
fmt.Fprintln(out)
}
} else {
fmt.Fprintln(iw, "No pools with NVMe found")
}
}
}

return w.Err
}

// PrintSmdManageResp generates a human-readable representation of the supplied response.
func PrintSmdManageResp(op control.SmdManageOpcode, resp *control.SmdResp, out, outErr io.Writer, opts ...PrintConfigOption) error {
switch op {
case control.SetFaultyOp, control.DevReplaceOp:
if resp.ResultCount() > 1 {
return errors.Errorf("smd-manage %s: unexpected number of results, "+
"want %d got %d", op, 1, resp.ResultCount())
}

hem := resp.GetHostErrors()
if len(hem) > 0 {
for errStr, hostSet := range hem {
fmt.Fprintln(outErr, fmt.Sprintf("%s operation failed on %s: %s",
op, hostSet.HostSet, errStr))
}
return nil
}

return PrintHostStorageSuccesses(fmt.Sprintf("%s operation performed", op),
resp.HostStorage, out)
case control.LedCheckOp, control.LedBlinkOp, control.LedResetOp:
if err := PrintResponseErrors(resp, outErr, opts...); err != nil {
return err
}

return PrintSmdInfoMap(false, true, resp.HostStorage, out, opts...)
default:
return errors.Errorf("unsupported opcode %d", op)
}
}
Loading

0 comments on commit 8673384

Please sign in to comment.