Esempio n. 1
0
func gcNetworking(podID *types.UUID) error {
	var flavor string
	// we first try to read the flavor from stage1 for backwards compatibility
	flavor, err := os.Readlink(filepath.Join(common.Stage1RootfsPath("."), "flavor"))
	if err != nil {
		// if we couldn't read the flavor from stage1 it could mean the overlay
		// filesystem is already unmounted (e.g. the system has been rebooted).
		// In that case we try to read it from the pod's root directory
		flavor, err = os.Readlink("flavor")
		if err != nil {
			return errwrap.Wrap(errors.New("failed to get stage1 flavor"), err)
		}
	}

	n, err := networking.Load(".", podID)
	switch {
	case err == nil:
		n.Teardown(flavor, debug)
	case os.IsNotExist(err):
		// probably ran with --net=host
	default:
		return errwrap.Wrap(errors.New("failed loading networking state"), err)
	}

	return nil
}
Esempio n. 2
0
func gcNetworking(podID *types.UUID) error {
	n, err := networking.Load(".", podID)
	switch {
	case err == nil:
		n.Teardown()
	case os.IsNotExist(err):
		// probably ran without --private-net
	default:
		return fmt.Errorf("Failed loading networking state: %v", err)
	}

	return nil
}
Esempio n. 3
0
File: gc.go Progetto: vincentvdk/rkt
func gcNetworking(podID *types.UUID) error {
	flavor, err := os.Readlink(filepath.Join(common.Stage1RootfsPath("."), "flavor"))
	if err != nil {
		return fmt.Errorf("Failed to get stage1 flavor: %v\n", err)
	}

	n, err := networking.Load(".", podID)
	switch {
	case err == nil:
		n.Teardown(flavor)
	case os.IsNotExist(err):
		// probably ran without --private-net
	default:
		return fmt.Errorf("Failed loading networking state: %v", err)
	}

	return nil
}