Project

General

Profile

Segnalazione #773

Detect e visualizzazione fact ansible per le macchine

Added by Enrico Zini about 5 years ago. Updated over 4 years ago.

Status:
In elaborazione
Priority:
Normale
Assignee:
-
Start date:
06/28/2019
Due date:
% Done:

0%

Estimated time:
(Total: 0.00 h)
Resolution:

Description

Per le macchine per le quali abbiamo accesso come root, possiamo fare un giro di gather fact di ansible e mostrarne alcuni nell'interfaccia.

Questo può avere un'utilità generica e dare un meccanismo estensibile per raccogliere informazioni, tipo anche se una macchina è configurata con fuss-client.


Subtasks

Segnalazione #855: Visualizzazione delle informazioni delle macchineNuovo

Actions

Related issues

Related to fuss-manager - Segnalazione #738: Detect macchine configurate con fuss-clientChiuso02/19/2019

Actions
Related to fuss-manager - Segnalazione #829: Controllare che il caricamento degli stats non pialli l'esistenteChiuso06/03/2019

Actions

Associated revisions

Revision b7ef2212 (diff)
Added by Elena Grandi almost 5 years ago

Start running ansible to get setup data. refs: #773

Revision 56986e90 (diff)
Added by Enrico Zini almost 5 years ago

Prototype a libvirt-based test environment. refs: #773

Revision a93fb9b3 (diff)
Added by Enrico Zini almost 5 years ago

more experiments made with libvirt. refs: #773

Revision 481999d1 (diff)
Added by Enrico Zini almost 5 years ago

Refactored testnet. refs: #773

Revision f338a76d (diff)
Added by Enrico Zini almost 5 years ago

Moved everything to test_network/ except the CLI itself. refs: #773

Revision afe61568 (diff)
Added by Enrico Zini almost 5 years ago

Assign IPs to domains. refs: #773

Revision 4c83eafc (diff)
Added by Enrico Zini almost 5 years ago

Updated test_network README. refs: #773

Revision 07fcfe58 (diff)
Added by Enrico Zini almost 5 years ago

Wait for domains to be started. refs: #773

Revision 2de79d67 (diff)
Added by Enrico Zini almost 5 years ago

More flexible CLI and cleanup stderr noise. refs: #773

Revision 73656018
Added by Enrico Zini almost 5 years ago

Merge remote-tracking branch 'origin/t748' into t773. refs: #773

Revision dab4d894 (diff)
Added by Enrico Zini almost 5 years ago

Added an ansible setup to run tests on the fuss-test-network machines. refs: #773

Revision ee9701d8 (diff)
Added by Enrico Zini almost 5 years ago

Have the mock network activity match the test network hosts. refs: #773

Revision 0bb38c58 (diff)
Added by Enrico Zini almost 5 years ago

Added host/group vars to connect to test machines. refs: #773

Revision 781ee8b9 (diff)
Added by Enrico Zini almost 5 years ago

Moved test playbooks in playbooks/. refs: #773

Revision d928cc10 (diff)
Added by Enrico Zini almost 5 years ago

Refactored playbook running so it can be wired into manager. refs: #773

Revision 95786b4d (diff)
Added by Enrico Zini almost 5 years ago

Started working on running playbooks. refs: #773

Revision 736ca041 (diff)
Added by Enrico Zini almost 5 years ago

remove nondeterminism. refs: #773

Revision e3946f63 (diff)
Added by Enrico Zini almost 5 years ago

Run playbooks and dispatch their output to the hosts involved. refs: #773

Revision ba911919 (diff)
Added by Elena Grandi almost 5 years ago

Start saving a cache of ansible facts. refs: #773

Revision aba68a39 (diff)
Added by Elena Grandi almost 5 years ago

Save a log of facts updates. refs: #773

Revision 7e4f32cf
Added by Enrico Zini almost 5 years ago

Merge branch 't773'. Fixes: #773

Revision 1b626377
Added by Enrico Zini almost 5 years ago

Merge branch 'master' into t773. refs: #773

Revision d5ceec06 (diff)
Added by Enrico Zini almost 5 years ago

Added tabs to machine popup. refs: #773

Revision c7333675 (diff)
Added by Enrico Zini almost 5 years ago

New RefreshFacts operation. refs: #773

Revision c481621a (diff)
Added by Enrico Zini almost 5 years ago

Export facts in machine data. refs: #773

Revision 4cb35e9f (diff)
Added by Enrico Zini almost 5 years ago

Added a button to refresh facts. refs: #773

Revision c4fc343b (diff)
Added by Enrico Zini almost 5 years ago

Show last collected facts. refs: #773

Revision c24d3b68 (diff)
Added by Enrico Zini almost 5 years ago

Show in the log when an operation is posted via API. refs: #773

Revision 1d8b6a22 (diff)
Added by Enrico Zini almost 5 years ago

Also show facts log in machine modal. refs: #773

Revision 8e3c92cf (diff)
Added by Elena Grandi almost 5 years ago

Add a timestamp to ansible facts data. refs: #773

Revision 4a866454 (diff)
Added by Elena Grandi almost 5 years ago

Find a machine in the store instead of looking up the mac for the name. refs: #773

Revision 4e9672b3
Added by Enrico Zini over 4 years ago

Sync with master. refs: #773

Revision 426f13b0
Added by Enrico Zini over 4 years ago

Merge to master; UI is not finished, but it needs some analysis to see what is the desired way to present facts. Refs: #773

History

#1

Updated by Elena Grandi about 5 years ago

#2

Updated by Elena Grandi about 5 years ago

  • Assignee set to Elena Grandi

Fare caching in memoria dei dati raccolti.

(nota: riassegnare poi ad Enrico per l'interfaccia)

#3

Updated by Enrico Zini almost 5 years ago

I dettagli su dove trovare i fact sono in #738

#4

Updated by Elena Grandi almost 5 years ago

  • Status changed from Nuovo to In elaborazione
#5

Updated by Elena Grandi almost 5 years ago

  • Assignee changed from Elena Grandi to Enrico Zini

Implementata la raccolta dei fact, branch t773. I test controllano la presenza di alcuni fact che mi paiono particolarmente utili, (quindi sono un posto dove è documentato come reperirli).

Ti ripasso il ticket per review, e per la parte di inserimento nell'interfaccia.

#6

Updated by Enrico Zini almost 5 years ago

  • Assignee changed from Enrico Zini to Elena Grandi

Grazie! Ho fatto refactoring per incastrare il tutto nel manager, in modo da poter mandare richieste e ricevere risultati.

Mi piacerebbe fare cache dei fact di ansible in un qualche storage, in modo da poterli sempre mostrare, ed eventualmente dare la possibilità di aggiornarli o aggiornarli periodicamente.

In teoria, lo store che immagazzina i dati effimeri potrebbe ascoltare HostFactsEvent e salvarsi facts. Se ti sembra una buona idea, puoi implementarlo?

#7

Updated by Enrico Zini almost 5 years ago

In questo branch c'è il test tests.test_playbook.TestPlaybook.test_run_playbook che dipende da fuss-test-network, e viene saltato se fuss-test-network non è su.

Per tirare su la rete di test: fuss-test-network --start --verbose. Serve che l'utente sia nel gruppo libvirt, e che la directory indicata dall'opzione --storage
sia accessibile e scrivibile dal gruppo libvirt. Dovrebbe dipendere solo da libvirt-clients.

Siccome i test sono opzionali, non importa tirare su fuss-test-network; se un giorno hai un momento per provarlo, però, magari mi dici se da te parte senza problemi.

Ho cambiato la mock data source per produrre nomi, IP e MAC corrispondenti a quelli usati da fuss-test-network, cosí usando runserver si potranno effettivamente far girare playbook sulle macchine di prova.

#8

Updated by Elena Grandi almost 5 years ago

  • Target version changed from 0.5 Run di playbook sui client to 0.6 Gestione di macchine spente

Sposto alla versione successiva per fare la release 0.5; qui manca da fare caching dei dati e poi ripassare ad enrico per l'interfaccia.

Al momento i fact vengono comunque visualizzati quando si è lanciato un playbook.

#9

Updated by Elena Grandi almost 5 years ago

  • Assignee changed from Elena Grandi to Enrico Zini

Backend del caching dei facts implementato, riassegno per review && merge (credo valga la pena mergiarlo per avere un "punto fisso") e poi implementazione dell'interfaccia.

#10

Updated by Enrico Zini almost 5 years ago

Visto, discusso, mergiato su master. Lascio aperto il ticket assegnato a me per la parte di visualizzazione

#11

Updated by Anonymous almost 5 years ago

  • Status changed from In elaborazione to Risolto
  • % Done changed from 0 to 100
#12

Updated by Enrico Zini almost 5 years ago

  • Status changed from Risolto to In elaborazione
#13

Updated by Enrico Zini almost 5 years ago

  • Assignee changed from Enrico Zini to Elena Grandi

In facts_loaded, the log is filled with information not taken from the event:

    @asyncio.coroutine 
    def facts_loaded(self, evt):
        ip = yield from self.name_to_ip(evt.name)
        mac = yield from self.ip_to_mac(ip)
        machine = self.machines.get(mac)
        old_facts_log = machine.facts_log.copy()
        machine.facts_log.append({
            'timestamp': time.time(),  
            'result': 'SUCCESS', 
            'details': {},
        })

Is it intentional? Ideally, I'd like to take the timestamp from the event, and set details to the actual facts.

#14

Updated by Enrico Zini almost 5 years ago

Ah, I get it, the facts are stored only in the machine and not in the log, fair enough.

Would it make sense however to take the timestamp from the event, so it matches when the facts were actually collected?

#15

Updated by Enrico Zini almost 5 years ago

Also, is it intentional that "facts" is not in STATS_MACHINE_FIELDS ?

#16

Updated by Enrico Zini almost 5 years ago

Another feature request for the backend: machine.facts currently contains only the key ansible_facts; I'd like to have in it also the timestamp of its facts log, so that I can see how old are the facts and to which facts log they refer.

Presumably, they refer to the last successful entry in the facts log; still it would be nice to have the timestamp to see how old are the facts without iterating the facts log backwards.

#17

Updated by Enrico Zini almost 5 years ago

Another issue: if the machine is switched off, facts_failed tries to look up its mac address to get the machine record to update. However, when the machine is off, IP to MAC resolution does not work, the mac variable is None, self.machines.get(mac) returns None and the rest of the method fails.

Would it be possible / a good idea to look up the machine in the store by name directly, both in facts_loaded and in facts_failed, instead of trying to resolve its ip and mac?

#18

Updated by Elena Grandi almost 5 years ago

Enrico Zini ha scritto:

Also, is it intentional that "facts" is not in STATS_MACHINE_FIELDS ?

intenzionale sì, non sono sicura che sia la scelta giusta sul lungo periodo.

Se salvare o meno i facts su file credo che possa dipendere da quanto spesso li si richiede: se si tende a chiederli spesso forse non val la pena salvarli su file, se invece li si vuole richiedere più raramente vale sicuramente la pena.

Per il momento, credo che faccia comodo non averli salvati per non rendere completamente illeggibile lo stats file, cosa che di tanto in tanto è utile aprire per fare debugging.

#19

Updated by Elena Grandi almost 5 years ago

  • Related to Segnalazione #829: Controllare che il caricamento degli stats non pialli l'esistente added
#20

Updated by Elena Grandi almost 5 years ago

  • Assignee changed from Elena Grandi to Enrico Zini

Pushato t773 con le modifiche al backend:

  • il timestamp è generato sul server in un momento solo e passato dalle varie parti
  • la macchina a cui associare i facts è cercata per nome nello store anziché cercare di calcolarne l'ip.

Ho cercato di vedere se fosse facile ricevere già il mac dall'evento facts loaded, ma mi pareva che spostasse solo la ricerca anziché eliminarla, e quindi non ne valesse la pena.

#21

Updated by Enrico Zini over 4 years ago

  • Target version changed from 0.6 Gestione di macchine spente to 0.10 Prima validazione interfaccia
#22

Updated by Enrico Zini over 4 years ago

  • Assignee deleted (Enrico Zini)

Fatto merge in master. I fact rimangono mostrati in modo grezzo, servirà capire in fase di ulteriore studio/validazione dell'interfaccia quale sia il modo piú utile per mostrare i fact.

Tolgo l'assegnazione del ticket finché non arriviamo a quella fase.

Also available in: Atom PDF