qemu: allow to run mutable
This commit is contained in:
parent
063df192b4
commit
0529b30558
@ -66,6 +66,8 @@ type System struct {
|
|||||||
kernel Kernel
|
kernel Kernel
|
||||||
drivePath string
|
drivePath string
|
||||||
|
|
||||||
|
Mutable bool
|
||||||
|
|
||||||
Cpus int
|
Cpus int
|
||||||
Memory int
|
Memory int
|
||||||
|
|
||||||
@ -215,7 +217,7 @@ func (q *System) Start() (err error) {
|
|||||||
rand.Seed(time.Now().UnixNano()) // Are you sure?
|
rand.Seed(time.Now().UnixNano()) // Are you sure?
|
||||||
q.sshAddrPort = getFreeAddrPort()
|
q.sshAddrPort = getFreeAddrPort()
|
||||||
hostfwd := fmt.Sprintf("hostfwd=tcp:%s-:22", q.sshAddrPort)
|
hostfwd := fmt.Sprintf("hostfwd=tcp:%s-:22", q.sshAddrPort)
|
||||||
qemuArgs := []string{"-snapshot", "-nographic",
|
qemuArgs := []string{"-nographic",
|
||||||
"-hda", q.drivePath,
|
"-hda", q.drivePath,
|
||||||
"-kernel", q.kernel.KernelPath,
|
"-kernel", q.kernel.KernelPath,
|
||||||
"-smp", fmt.Sprintf("%d", q.Cpus),
|
"-smp", fmt.Sprintf("%d", q.Cpus),
|
||||||
@ -224,6 +226,10 @@ func (q *System) Start() (err error) {
|
|||||||
"-netdev", "user,id=n1," + hostfwd,
|
"-netdev", "user,id=n1," + hostfwd,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if !q.Mutable {
|
||||||
|
qemuArgs = append(qemuArgs, "-snapshot")
|
||||||
|
}
|
||||||
|
|
||||||
if q.debug {
|
if q.debug {
|
||||||
qemuArgs = append(qemuArgs, "-gdb", q.gdb)
|
qemuArgs = append(qemuArgs, "-gdb", q.gdb)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user