@@ -314,24 +314,6 @@ func (d *Driver) Start() error {
314314 log .Debugf ("starting domain XML:\n %s" , domXML )
315315 }
316316
317- // libvirt/qemu creates a console log file owned by root:root and permissions 0600,
318- // so we pre-create it (and close it immediately), just to be able to read it later
319- logPath := consoleLogPath (* d )
320- f , err := os .Create (logPath )
321- if err != nil {
322- log .Debugf ("failed to create console log file %q: %v" , logPath , err )
323- } else {
324- f .Close ()
325- }
326- // ensure console log file is cleaned up
327- defer func () {
328- if _ , err := os .Stat (logPath ); err == nil {
329- if err := os .Remove (logPath ); err != nil {
330- log .Debugf ("failed removing console log file %q: %v" , logPath , err )
331- }
332- }
333- }()
334-
335317 if err := dom .Create (); err != nil {
336318 return errors .Wrap (err , "creating domain" )
337319 }
@@ -355,12 +337,6 @@ func (d *Driver) Start() error {
355337 return nil
356338}
357339
358- // consoleLogPath returns the path to the console log file for the given machine name.
359- func consoleLogPath (d Driver ) string {
360- // return fmt.Sprintf("%s-console.log", machineName)
361- return d .ResolveStorePath ("console.log" )
362- }
363-
364340// waitForDomainState waits maxTime for the domain to reach a target state.
365341func (d * Driver ) waitForDomainState (targetState state.State , maxTime time.Duration ) error {
366342 query := func () error {
@@ -377,27 +353,11 @@ func (d *Driver) waitForDomainState(targetState state.State, maxTime time.Durati
377353 return fmt .Errorf ("last domain state: %q" , currentState .String ())
378354 }
379355 if err := retry .Local (query , maxTime ); err != nil {
380- dumpConsoleLogs (consoleLogPath (* d ))
381356 return fmt .Errorf ("timed out waiting %v for domain to reach %q state: %w" , maxTime , targetState .String (), err )
382357 }
383358 return nil
384359}
385360
386- // dumpConsoleLogs prints out the console log.
387- func dumpConsoleLogs (logPath string ) {
388- if _ , err := os .Stat (logPath ); err != nil {
389- log .Debugf ("failed checking console log file %q: %v" , logPath , err )
390- return
391- }
392-
393- data , err := os .ReadFile (logPath )
394- if err != nil {
395- log .Debugf ("failed dumping console log file %q: %v" , logPath , err )
396- return
397- }
398- log .Debugf ("console log:\n %s" , data )
399- }
400-
401361// waitForStaticIP waits for IP address of domain that has been created & starting and then makes that IP static.
402362func (d * Driver ) waitForStaticIP (conn * libvirt.Connect , maxTime time.Duration ) error {
403363 query := func () error {
@@ -416,7 +376,6 @@ func (d *Driver) waitForStaticIP(conn *libvirt.Connect, maxTime time.Duration) e
416376 return nil
417377 }
418378 if err := retry .Local (query , maxTime ); err != nil {
419- dumpConsoleLogs (consoleLogPath (* d ))
420379 return fmt .Errorf ("domain %s didn't return IP after %v" , d .MachineName , maxTime )
421380 }
422381
0 commit comments