ddmd's handling of SMF refreshes is incomplete

Aperta
#918 4 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
52/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
rust
Ambito
networking

Direzione di ricerca

Inizia da ddmd/src/signal.rs e ddmd/src/smf.rs, quindi confronta il percorso di refresh con smf/ddm_method_script.sh e refresh_ctrun_child.sh. Traccia quali proprietà SMF vengono caricate all'avvio rispetto al refresh, in particolare sled_uuid, rack_uuid e dns_servers. Il lavoro è completato quando le proprietà aggiornate raggiungono i relativi consumer senza richiedere un riavvio del servizio che ne interrompa l'operatività.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

(This fell out of debugging some multirack bringup bits, where @andrewjstone was trying to test #911, which makes the sled ID arg load bearing, and not being able to tell whether it was actually being set when ddm was launched. All the notes below are from poking around on london, which is running a maghemite commit from main.)

Looking at a subset of the properties currently set on the mg-ddm SMF service via svccfg export mg-ddm, we see reasonable things:

    <!-- ... snip normal SMF preamble stuff ... -->
    <exec_method name='start' type='method' exec='ctrun -l child -o noorphan,regent /opt/oxide/mg-ddm/pkg/ddm_method_script.sh &amp;' timeout_seconds='0'/>
    <exec_method name='refresh' type='method' exec='/opt/oxide/mg-ddm/pkg/refresh_ctrun_child.sh -c %{restarter/contract}' timeout_seconds='0'/>
    <exec_method name='stop' type='method' exec=':kill' timeout_seconds='0'/>
    <property_group name='config' type='application'>
      <propval name='admin_host' type='astring' value='::1'/>
      <propval name='admin_port' type='count' value='8000'/>
      <propval name='dendrite' type='boolean' value='false'/>
      <propval name='dns_servers' type='astring' value='unknown'/>
      <propval name='dpd_host' type='astring' value=''/>
      <propval name='dpd_port' type='astring' value=''/>
      <propval name='log' type='astring' value='info'/>
      <propval name='mode' type='astring' value='server'/>
      <propval name='rack_uuid' type='astring' value='unknown'/>
      <propval name='sled_uuid' type='astring' value='unknown'/>
      <property name='interfaces' type='astring'/>
    </property_group>
    <property_group name='startd' type='framework'>
      <propval name='duration' type='astring' value='contract'/>
    </property_group>
    <instance name='default' enabled='true'>
      <property_group name='config' type='application'>
        <propval name='dendrite' type='astring' value='true'/>
        <propval name='dpd_host' type='astring' value='[::1]'/>
        <propval name='dpd_port' type='astring' value='12224'/>
        <propval name='mode' type='astring' value='transit'/>
        <propval name='rack_uuid' type='astring' value='084476df-a2b7-4770-a379-641caff2a53b'/>
        <propval name='sled_uuid' type='astring' value='6c724e30-d8aa-4376-b5b6-6d8feac8cc19'/>
        <property name='interfaces' type='astring'>
          <astring_list>
            <value_node value='tfportrear0_0/ll'/>
            <value_node value='tfportrear1_0/ll'/>
            <value_node value='tfportrear2_0/ll'/>
            <!-- ... snip lots more interfaces ... -->
            <value_node value='tfportrear30_0/ll'/>
            <value_node value='tfportrear31_0/ll'/>
          </astring_list>
        </property>
        <property name='dns_servers' type='astring'>
          <astring_list>
            <value_node value='[fddf:fb6c:24f9:1::1]:53'/>
            <value_node value='[fddf:fb6c:24f9:2::1]:53'/>
            <value_node value='[fddf:fb6c:24f9:3::1]:53'/>
          </astring_list>
        </property>
      </property_group>
    </instance>

However, looking at the arguments ddmd was launched with doesn't really match this in a few ways:

[london]root@oxz_switch0:~# pargs $(pgrep ddmd)
argv[0]: /opt/oxide/mg-ddm/bin/ddmd
argv[1]: --with-stats
argv[2]: --admin-port
argv[3]: 8000
argv[4]: --admin-addr
argv[5]: ::1
argv[6]: --kind
argv[7]: transit
argv[8]: --dendrite
argv[9]: --dpd-host
argv[10]: [::1]
argv[11]: --dpd-port
argv[12]: 12224
argv[13]: -a
argv[14]: tfportrear0_0/ll
argv[15]: -a
argv[16]: tfportrear1_0/ll
argv[17]: -a
argv[18]: tfportrear2_0/ll
... snip lots more interface args ...
argv[75]: -a
argv[76]: tfportrear31_0/ll
argv[77]: --dns-servers
argv[78]: unknown

In particular:

  • We don't see the --sled-uuid or --rack-uuid args at all
  • We're passing --dns-servers unknown even though the SMF properties have values for them (This is probably a separate bug in the method script - we should presumably be omitting this argument instead of passing unknown)

This is confusing at first because we've obviously picked up some of the instance-level properties: all the interfaces and the --dpd-port, for example, and the method script appears to read all the properties the same way.

My understanding of what's happening here is:

  1. sled-agent initially launches the zone with only some of these properties set (e.g., if the rack is pre-RSS, it doesn't yet know the rack or sled ID or DNS servers, so won't include those).
  2. Once it knows the values for them, it will set these properties then issue an SMF refresh inside the zone: https://github.com/oxidecomputer/omicron/blob/46ca0a6978b480610b9b341f8931f8532fb4658d/sled-agent/src/services.rs#L3561-L3598
  3. mg-ddm's manifest specifies that refreshes should execute this repo's refresh_ctrun_child.sh, which issues a kill -USR1 ... to ddmd
  4. The signal handler for ddmd waits for USR1 and then calls its internal smf_refresh() function, but that function only reloads the properties relevant to the oximeter stats server; it won't handle any changes to other properties (critically for #911 testing: the sled ID)

I assume the default SMF refresh behavior of "restart the service" is too disruptive for ddmd, but I think that means the signal handler needs to read all the SMF properties and update any relevant consumers of them; it can't assume all of them were present as CLI args.

(I don't know how much it matters in practice, but at a glance it looks like mgd has this same pattern and would similarly miss any changed SMF properties except those that affect its oximeter stats server.)

Lingua principale
Rust
Stelle
100
Fork
8
Merge medio
2g 1h
PR unite (30g)
18

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di oxidecomputer/maghemite

Tutte le issue di oxidecomputer/maghemite

Issue simili

Altre issue su Rust

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.