Merge pull request #1458 from amshinde/pass-vsock-as-kernel-option

vsock: Pass info about vsock being used or not to the agent.
This commit is contained in:
Eric Ernst
2019-04-02 16:18:41 -07:00
committed by GitHub
2 changed files with 9 additions and 3 deletions

View File

@@ -94,8 +94,9 @@ const (
qmpExecCatCmd = "exec:cat"
qmpMigrationWaitTimeout = 5 * time.Second
scsiControllerID = "scsi0"
rngID = "rng0"
scsiControllerID = "scsi0"
rngID = "rng0"
vsockKernelOption = "agent.use_vsock"
)
var qemuMajorVersion int
@@ -152,6 +153,11 @@ func (q *qemu) kernelParameters() string {
// set the maximum number of vCPUs
params = append(params, Param{"nr_cpus", fmt.Sprintf("%d", q.config.DefaultMaxVCPUs)})
// Add a kernel param to indicate if vsock is being used.
// This will be consumed by the agent to determine if it needs to listen on
// a serial or vsock channel
params = append(params, Param{vsockKernelOption, strconv.FormatBool(q.config.UseVSock)})
// add the params specified by the provided config. As the kernel
// honours the last parameter value set and since the config-provided
// params are added here, they will take priority over the defaults.

View File

@@ -56,7 +56,7 @@ func testQemuKernelParameters(t *testing.T, kernelParams []Param, expected strin
}
func TestQemuKernelParameters(t *testing.T) {
expectedOut := fmt.Sprintf("panic=1 nr_cpus=%d foo=foo bar=bar", MaxQemuVCPUs())
expectedOut := fmt.Sprintf("panic=1 nr_cpus=%d agent.use_vsock=false foo=foo bar=bar", MaxQemuVCPUs())
params := []Param{
{
Key: "foo",