mirror of
https://github.com/linuxkit/linuxkit.git
synced 2025-07-21 10:09:07 +00:00
Only create qemu runner state dir if it is going to be used.
Signed-off-by: Ian Campbell <ian.campbell@docker.com>
This commit is contained in:
parent
58d61d0846
commit
e2eb17ef6c
@ -118,8 +118,12 @@ func runQemu(args []string) {
|
|||||||
if *state == "" {
|
if *state == "" {
|
||||||
*state = prefix + "-state"
|
*state = prefix + "-state"
|
||||||
}
|
}
|
||||||
if err := os.MkdirAll(*state, 0755); err != nil {
|
var mkstate func()
|
||||||
log.Fatalf("Could not create state directory: %v", err)
|
mkstate = func() {
|
||||||
|
if err := os.MkdirAll(*state, 0755); err != nil {
|
||||||
|
log.Fatalf("Could not create state directory: %v", err)
|
||||||
|
}
|
||||||
|
mkstate = func() {}
|
||||||
}
|
}
|
||||||
|
|
||||||
isoPath := ""
|
isoPath := ""
|
||||||
@ -133,6 +137,7 @@ func runQemu(args []string) {
|
|||||||
log.Fatalf("Cannot read user data: %v", err)
|
log.Fatalf("Cannot read user data: %v", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
mkstate()
|
||||||
isoPath = filepath.Join(*state, "data.iso")
|
isoPath = filepath.Join(*state, "data.iso")
|
||||||
if err := WriteMetadataISO(isoPath, d); err != nil {
|
if err := WriteMetadataISO(isoPath, d); err != nil {
|
||||||
log.Fatalf("Cannot write user data ISO: %v", err)
|
log.Fatalf("Cannot write user data ISO: %v", err)
|
||||||
@ -148,6 +153,7 @@ func runQemu(args []string) {
|
|||||||
d.Format = "qcow2"
|
d.Format = "qcow2"
|
||||||
}
|
}
|
||||||
if d.Size != 0 && d.Path == "" {
|
if d.Size != 0 && d.Path == "" {
|
||||||
|
mkstate()
|
||||||
d.Path = filepath.Join(*state, "disk"+id+".img")
|
d.Path = filepath.Join(*state, "disk"+id+".img")
|
||||||
}
|
}
|
||||||
if d.Path == "" {
|
if d.Path == "" {
|
||||||
|
Loading…
Reference in New Issue
Block a user