Skip to content
This repository has been archived by the owner on Feb 24, 2020. It is now read-only.

stage1/kvm: Refactor generateMounts #2380

Open
alban opened this issue Apr 5, 2016 · 4 comments
Open

stage1/kvm: Refactor generateMounts #2380

alban opened this issue Apr 5, 2016 · 4 comments

Comments

@alban
Copy link
Member

alban commented Apr 5, 2016

Capturing comment #2328 (comment) about stage1/init/common/kvm_mount.go and generateMounts:


I know it was already like that before, but the mapification of the volume array into a map is done in both calls of generateMounts (both in the kvm stage1 and the non-kvm stage1). For factorisation, should generateMounts accept an array of volumes as parameter instead?

Both calls of generateMounts use the following pattern:

    vols := make(map[types.ACName]types.Volume)
    for _, v := range p.Manifest.Volumes {
        vols[v.Name] = v
    }

    mounts := generateMounts(ra, vols)
    for _, m := range mounts {
        vol := vols[m.Volume]
        ...
    }

Instead, it could be

    mounts := generateMounts(ra, vols, func(m Mount, v Volume){
        ...
    })

(Not necessarily for this PR though)


@jjlakis
Copy link
Contributor

jjlakis commented Sep 13, 2016

@jellonek Is this issue still valid?

@jellonek
Copy link
Contributor

Yes (but forgotten).
Code for this starts at https://github.com/coreos/rkt/blob/427f47a3ddde4c3c8d167ba3133215540354cf23/stage1/init/common/pod.go#L921

Do you want to reassign it to you?

@jjlakis
Copy link
Contributor

jjlakis commented Sep 13, 2016

Just asking, don't have much time to refactor this now.

@jellonek
Copy link
Contributor

Exactly like me ;)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
Development

Successfully merging a pull request may close this issue.

4 participants