mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-07-16 16:32:03 +00:00
Merge pull request #2226 from snir911/backporting-2.1
stable 2.1 | Backports
This commit is contained in:
commit
8de95b7c3b
2
.github/workflows/snap-release.yaml
vendored
2
.github/workflows/snap-release.yaml
vendored
@ -9,6 +9,8 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- name: Check out Git repository
|
- name: Check out Git repository
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
- name: Install Snapcraft
|
- name: Install Snapcraft
|
||||||
uses: samuelmeuli/action-snapcraft@v1
|
uses: samuelmeuli/action-snapcraft@v1
|
||||||
|
2
.github/workflows/snap.yaml
vendored
2
.github/workflows/snap.yaml
vendored
@ -6,6 +6,8 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- name: Check out
|
- name: Check out
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
- name: Install Snapcraft
|
- name: Install Snapcraft
|
||||||
uses: samuelmeuli/action-snapcraft@v1
|
uses: samuelmeuli/action-snapcraft@v1
|
||||||
|
2
.github/workflows/static-checks.yaml
vendored
2
.github/workflows/static-checks.yaml
vendored
@ -13,7 +13,7 @@ jobs:
|
|||||||
TRAVIS_PULL_REQUEST_BRANCH: ${{ github.head_ref }}
|
TRAVIS_PULL_REQUEST_BRANCH: ${{ github.head_ref }}
|
||||||
TRAVIS_PULL_REQUEST_SHA : ${{ github.event.pull_request.head.sha }}
|
TRAVIS_PULL_REQUEST_SHA : ${{ github.event.pull_request.head.sha }}
|
||||||
RUST_BACKTRACE: "1"
|
RUST_BACKTRACE: "1"
|
||||||
target_branch: ${TRAVIS_BRANCH}
|
target_branch: ${{ github.base_ref }}
|
||||||
steps:
|
steps:
|
||||||
- name: Install Go
|
- name: Install Go
|
||||||
uses: actions/setup-go@v2
|
uses: actions/setup-go@v2
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
export tests_repo="${tests_repo:-github.com/kata-containers/tests}"
|
export tests_repo="${tests_repo:-github.com/kata-containers/tests}"
|
||||||
export tests_repo_dir="$GOPATH/src/$tests_repo"
|
export tests_repo_dir="$GOPATH/src/$tests_repo"
|
||||||
export branch="${branch:-main}"
|
export branch="${target_branch:-main}"
|
||||||
|
|
||||||
# Clones the tests repository and checkout to the branch pointed out by
|
# Clones the tests repository and checkout to the branch pointed out by
|
||||||
# the global $branch variable.
|
# the global $branch variable.
|
||||||
|
1
src/agent/.gitignore
vendored
1
src/agent/.gitignore
vendored
@ -1 +1,2 @@
|
|||||||
tarpaulin-report.html
|
tarpaulin-report.html
|
||||||
|
vendor/
|
||||||
|
62
src/agent/Cargo.lock
generated
62
src/agent/Cargo.lock
generated
@ -472,8 +472,8 @@ dependencies = [
|
|||||||
"libc",
|
"libc",
|
||||||
"log",
|
"log",
|
||||||
"logging",
|
"logging",
|
||||||
"netlink-packet-utils 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"netlink-packet-utils",
|
||||||
"netlink-sys 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"netlink-sys",
|
||||||
"nix 0.17.0",
|
"nix 0.17.0",
|
||||||
"oci",
|
"oci",
|
||||||
"prctl",
|
"prctl",
|
||||||
@ -579,9 +579,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "mio"
|
name = "mio"
|
||||||
version = "0.7.6"
|
version = "0.7.13"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "f33bc887064ef1fd66020c9adfc45bb9f33d75a42096c81e7c56c65b75dd1a8b"
|
checksum = "8c2bdb6314ec10835cd3293dd268473a835c02b7b352e788be788b3c6ca6bb16"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"libc",
|
"libc",
|
||||||
"log",
|
"log",
|
||||||
@ -609,43 +609,34 @@ checksum = "2eb04b9f127583ed176e163fb9ec6f3e793b87e21deedd5734a69386a18a0151"
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "netlink-packet-core"
|
name = "netlink-packet-core"
|
||||||
version = "0.2.4"
|
version = "0.2.4"
|
||||||
source = "git+https://github.com/little-dude/netlink?rev=a9367bc4700496ddebc088110c28f40962923326#a9367bc4700496ddebc088110c28f40962923326"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "ac48279d5062bdf175bdbcb6b58ff1d6b0ecd54b951f7a0ff4bc0550fe903ccb"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"byteorder",
|
"byteorder",
|
||||||
"libc",
|
"libc",
|
||||||
"netlink-packet-utils 0.4.0 (git+https://github.com/little-dude/netlink?rev=a9367bc4700496ddebc088110c28f40962923326)",
|
"netlink-packet-utils",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "netlink-packet-route"
|
name = "netlink-packet-route"
|
||||||
version = "0.7.0"
|
version = "0.7.1"
|
||||||
source = "git+https://github.com/little-dude/netlink?rev=a9367bc4700496ddebc088110c28f40962923326#a9367bc4700496ddebc088110c28f40962923326"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "4c92a86a6528fe6d0a811c48d28213ca896a2b8bf2f6cadf2ab5bb12d32ec0f1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"bitflags",
|
"bitflags",
|
||||||
"byteorder",
|
"byteorder",
|
||||||
"libc",
|
"libc",
|
||||||
"netlink-packet-core",
|
"netlink-packet-core",
|
||||||
"netlink-packet-utils 0.4.0 (git+https://github.com/little-dude/netlink?rev=a9367bc4700496ddebc088110c28f40962923326)",
|
"netlink-packet-utils",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "netlink-packet-utils"
|
name = "netlink-packet-utils"
|
||||||
version = "0.4.0"
|
version = "0.4.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "6c2afb159d0e3ac700e85f0df25b8438b99d43ed0c0b685242fcdf1b5673e54d"
|
checksum = "5fcfb6f758b66e964b2339596d94078218d96aad5b32003e8e2a1d23c27a6784"
|
||||||
dependencies = [
|
|
||||||
"anyhow",
|
|
||||||
"byteorder",
|
|
||||||
"paste",
|
|
||||||
"thiserror",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "netlink-packet-utils"
|
|
||||||
version = "0.4.0"
|
|
||||||
source = "git+https://github.com/little-dude/netlink?rev=a9367bc4700496ddebc088110c28f40962923326#a9367bc4700496ddebc088110c28f40962923326"
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"byteorder",
|
"byteorder",
|
||||||
@ -655,34 +646,24 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "netlink-proto"
|
name = "netlink-proto"
|
||||||
version = "0.6.0"
|
version = "0.7.0"
|
||||||
source = "git+https://github.com/little-dude/netlink?rev=a9367bc4700496ddebc088110c28f40962923326#a9367bc4700496ddebc088110c28f40962923326"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "ddd06e90449ae973fe3888c1ff85949604ef5189b4ac9a2ae39518da1e00762d"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bytes 1.0.1",
|
"bytes 1.0.1",
|
||||||
"futures",
|
"futures",
|
||||||
"log",
|
"log",
|
||||||
"netlink-packet-core",
|
"netlink-packet-core",
|
||||||
"netlink-sys 0.6.0 (git+https://github.com/little-dude/netlink?rev=a9367bc4700496ddebc088110c28f40962923326)",
|
"netlink-sys",
|
||||||
"tokio",
|
"tokio",
|
||||||
"tokio-util",
|
"tokio-util",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "netlink-sys"
|
name = "netlink-sys"
|
||||||
version = "0.6.0"
|
version = "0.7.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "d61c5374735aa0cd07cb7fd820b656062b187b5588d79517f72956b57c6de9ef"
|
checksum = "f48ea34ea0678719815c3753155067212f853ad2d8ef4a49167bae7f7c254188"
|
||||||
dependencies = [
|
|
||||||
"futures",
|
|
||||||
"libc",
|
|
||||||
"log",
|
|
||||||
"tokio",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "netlink-sys"
|
|
||||||
version = "0.6.0"
|
|
||||||
source = "git+https://github.com/little-dude/netlink?rev=a9367bc4700496ddebc088110c28f40962923326#a9367bc4700496ddebc088110c28f40962923326"
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"futures",
|
"futures",
|
||||||
"libc",
|
"libc",
|
||||||
@ -1144,8 +1125,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rtnetlink"
|
name = "rtnetlink"
|
||||||
version = "0.7.0"
|
version = "0.8.0"
|
||||||
source = "git+https://github.com/little-dude/netlink?rev=a9367bc4700496ddebc088110c28f40962923326#a9367bc4700496ddebc088110c28f40962923326"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "279f7e9a312496b3e726e776cbd1f3102bd5ffe66503c3f44d642f7327995919"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"byteordered",
|
"byteordered",
|
||||||
"futures",
|
"futures",
|
||||||
|
@ -23,13 +23,11 @@ regex = "1"
|
|||||||
async-trait = "0.1.42"
|
async-trait = "0.1.42"
|
||||||
tokio = { version = "1.2.0", features = ["rt", "rt-multi-thread", "sync", "macros", "io-util", "time", "signal", "io-std", "process", "fs"] }
|
tokio = { version = "1.2.0", features = ["rt", "rt-multi-thread", "sync", "macros", "io-util", "time", "signal", "io-std", "process", "fs"] }
|
||||||
futures = "0.3.12"
|
futures = "0.3.12"
|
||||||
netlink-sys = { version = "0.6.0", features = ["tokio_socket",]}
|
|
||||||
tokio-vsock = "0.3.1"
|
tokio-vsock = "0.3.1"
|
||||||
# Because the author has no time to maintain the crate, we switch the dependency to github,
|
|
||||||
# Once the new version released on crates.io, we switch it back.
|
netlink-sys = { version = "0.7.0", features = ["tokio_socket",]}
|
||||||
# https://github.com/little-dude/netlink/issues/161
|
rtnetlink = "0.8.0"
|
||||||
rtnetlink = { git = "https://github.com/little-dude/netlink", rev = "a9367bc4700496ddebc088110c28f40962923326" }
|
netlink-packet-utils = "0.4.1"
|
||||||
netlink-packet-utils = "0.4.0"
|
|
||||||
ipnetwork = "0.17.0"
|
ipnetwork = "0.17.0"
|
||||||
|
|
||||||
# slog:
|
# slog:
|
||||||
|
@ -923,12 +923,12 @@ pub fn get_mounts() -> Result<HashMap<String, String>> {
|
|||||||
let paths = get_paths()?;
|
let paths = get_paths()?;
|
||||||
|
|
||||||
for l in fs::read_to_string(MOUNTS)?.lines() {
|
for l in fs::read_to_string(MOUNTS)?.lines() {
|
||||||
let p: Vec<&str> = l.split(" - ").collect();
|
let p: Vec<&str> = l.splitn(2, " - ").collect();
|
||||||
let pre: Vec<&str> = p[0].split(' ').collect();
|
let pre: Vec<&str> = p[0].split(' ').collect();
|
||||||
let post: Vec<&str> = p[1].split(' ').collect();
|
let post: Vec<&str> = p[1].split(' ').collect();
|
||||||
|
|
||||||
if post.len() != 3 {
|
if post.len() != 3 {
|
||||||
warn!(sl!(), "mountinfo corrupted!");
|
warn!(sl!(), "can't parse {} line {:?}", MOUNTS, l);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1557,6 +1557,7 @@ mod tests {
|
|||||||
use std::os::unix::fs::MetadataExt;
|
use std::os::unix::fs::MetadataExt;
|
||||||
use std::os::unix::io::AsRawFd;
|
use std::os::unix::io::AsRawFd;
|
||||||
use tempfile::tempdir;
|
use tempfile::tempdir;
|
||||||
|
use tokio::process::Command;
|
||||||
|
|
||||||
macro_rules! sl {
|
macro_rules! sl {
|
||||||
() => {
|
() => {
|
||||||
@ -1564,12 +1565,27 @@ mod tests {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async fn which(cmd: &str) -> String {
|
||||||
|
let output: std::process::Output = Command::new("which")
|
||||||
|
.arg(cmd)
|
||||||
|
.output()
|
||||||
|
.await
|
||||||
|
.expect("which command failed to run");
|
||||||
|
|
||||||
|
match String::from_utf8(output.stdout) {
|
||||||
|
Ok(v) => v.trim_end_matches('\n').to_string(),
|
||||||
|
Err(e) => panic!("Invalid UTF-8 sequence: {}", e),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
async fn test_execute_hook() {
|
async fn test_execute_hook() {
|
||||||
|
let xargs = which("xargs").await;
|
||||||
|
|
||||||
execute_hook(
|
execute_hook(
|
||||||
&slog_scope::logger(),
|
&slog_scope::logger(),
|
||||||
&Hook {
|
&Hook {
|
||||||
path: "/usr/bin/xargs".to_string(),
|
path: xargs,
|
||||||
args: vec![],
|
args: vec![],
|
||||||
env: vec![],
|
env: vec![],
|
||||||
timeout: None,
|
timeout: None,
|
||||||
@ -1589,10 +1605,12 @@ mod tests {
|
|||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
async fn test_execute_hook_with_timeout() {
|
async fn test_execute_hook_with_timeout() {
|
||||||
|
let sleep = which("sleep").await;
|
||||||
|
|
||||||
let res = execute_hook(
|
let res = execute_hook(
|
||||||
&slog_scope::logger(),
|
&slog_scope::logger(),
|
||||||
&Hook {
|
&Hook {
|
||||||
path: "/usr/bin/sleep".to_string(),
|
path: sleep,
|
||||||
args: vec!["2".to_string()],
|
args: vec!["2".to_string()],
|
||||||
env: vec![],
|
env: vec![],
|
||||||
timeout: Some(1),
|
timeout: Some(1),
|
||||||
|
@ -905,6 +905,11 @@ func (s *service) Shutdown(ctx context.Context, r *taskAPI.ShutdownRequest) (_ *
|
|||||||
|
|
||||||
s.cancel()
|
s.cancel()
|
||||||
|
|
||||||
|
// Since we only send an shutdown qmp command to qemu when do stopSandbox, and
|
||||||
|
// didn't wait until qemu process's exit, thus we'd better to make sure it had
|
||||||
|
// exited when shimv2 terminated. Thus here to do the last cleanup of the hypervisor.
|
||||||
|
syscall.Kill(int(s.hpid), syscall.SIGKILL)
|
||||||
|
|
||||||
os.Exit(0)
|
os.Exit(0)
|
||||||
|
|
||||||
// This will never be called, but this is only there to make sure the
|
// This will never be called, but this is only there to make sure the
|
||||||
|
@ -13,8 +13,14 @@ import (
|
|||||||
"github.com/kata-containers/kata-containers/src/runtime/pkg/katautils"
|
"github.com/kata-containers/kata-containers/src/runtime/pkg/katautils"
|
||||||
)
|
)
|
||||||
|
|
||||||
func startContainer(ctx context.Context, s *service, c *container) error {
|
func startContainer(ctx context.Context, s *service, c *container) (retErr error) {
|
||||||
//start a container
|
defer func() {
|
||||||
|
if retErr != nil {
|
||||||
|
// notify the wait goroutine to continue
|
||||||
|
c.exitCh <- exitCode255
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
// start a container
|
||||||
if c.cType == "" {
|
if c.cType == "" {
|
||||||
err := fmt.Errorf("Bug, the container %s type is empty", c.id)
|
err := fmt.Errorf("Bug, the container %s type is empty", c.id)
|
||||||
return err
|
return err
|
||||||
@ -87,8 +93,8 @@ func startContainer(ctx context.Context, s *service, c *container) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func startExec(ctx context.Context, s *service, containerID, execID string) (*exec, error) {
|
func startExec(ctx context.Context, s *service, containerID, execID string) (e *exec, retErr error) {
|
||||||
//start an exec
|
// start an exec
|
||||||
c, err := s.getContainer(containerID)
|
c, err := s.getContainer(containerID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -99,6 +105,13 @@ func startExec(ctx context.Context, s *service, containerID, execID string) (*ex
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
defer func() {
|
||||||
|
if retErr != nil {
|
||||||
|
// notify the wait goroutine to continue
|
||||||
|
execs.exitCh <- exitCode255
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
|
||||||
_, proc, err := s.sandbox.EnterContainer(ctx, containerID, *execs.cmds)
|
_, proc, err := s.sandbox.EnterContainer(ctx, containerID, *execs.cmds)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
err := fmt.Errorf("cannot enter container %s, with err %s", containerID, err)
|
err := fmt.Errorf("cannot enter container %s, with err %s", containerID, err)
|
||||||
|
@ -30,7 +30,7 @@ require (
|
|||||||
github.com/gogo/googleapis v1.4.0 // indirect
|
github.com/gogo/googleapis v1.4.0 // indirect
|
||||||
github.com/gogo/protobuf v1.3.1
|
github.com/gogo/protobuf v1.3.1
|
||||||
github.com/hashicorp/go-multierror v1.0.0
|
github.com/hashicorp/go-multierror v1.0.0
|
||||||
github.com/kata-containers/govmm v0.0.0-20210428163604-f0e9a35308ee
|
github.com/kata-containers/govmm v0.0.0-20210722115311-0173713ea912
|
||||||
github.com/mdlayher/vsock v0.0.0-20191108225356-d9c65923cb8f
|
github.com/mdlayher/vsock v0.0.0-20191108225356-d9c65923cb8f
|
||||||
github.com/opencontainers/image-spec v1.0.1 // indirect
|
github.com/opencontainers/image-spec v1.0.1 // indirect
|
||||||
github.com/opencontainers/runc v1.0.0-rc9.0.20200102164712-2b52db75279c
|
github.com/opencontainers/runc v1.0.0-rc9.0.20200102164712-2b52db75279c
|
||||||
|
@ -268,8 +268,8 @@ github.com/juju/errors v0.0.0-20180806074554-22422dad46e1/go.mod h1:W54LbzXuIE0b
|
|||||||
github.com/juju/loggo v0.0.0-20190526231331-6e530bcce5d8/go.mod h1:vgyd7OREkbtVEN/8IXZe5Ooef3LQePvuBm9UWj6ZL8U=
|
github.com/juju/loggo v0.0.0-20190526231331-6e530bcce5d8/go.mod h1:vgyd7OREkbtVEN/8IXZe5Ooef3LQePvuBm9UWj6ZL8U=
|
||||||
github.com/juju/testing v0.0.0-20190613124551-e81189438503/go.mod h1:63prj8cnj0tU0S9OHjGJn+b1h0ZghCndfnbQolrYTwA=
|
github.com/juju/testing v0.0.0-20190613124551-e81189438503/go.mod h1:63prj8cnj0tU0S9OHjGJn+b1h0ZghCndfnbQolrYTwA=
|
||||||
github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w=
|
github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w=
|
||||||
github.com/kata-containers/govmm v0.0.0-20210428163604-f0e9a35308ee h1:M4N7AdSHgWz/ubV5AZQdeqmK+9Ztpea6oqeXgk8GCHk=
|
github.com/kata-containers/govmm v0.0.0-20210722115311-0173713ea912 h1:Ejn4L5OXYbdgnh1ghmlKvTPEC1b415PQDsNhzA2kWLQ=
|
||||||
github.com/kata-containers/govmm v0.0.0-20210428163604-f0e9a35308ee/go.mod h1:VmAHbsL5lLfzHW/MNL96NVLF840DNEV5i683kISgFKk=
|
github.com/kata-containers/govmm v0.0.0-20210722115311-0173713ea912/go.mod h1:A6QaNB6N6PRQ9mTRpFtUxiF5T5CJpzLALjxBrUQPlFI=
|
||||||
github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00=
|
github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00=
|
||||||
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
|
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
|
||||||
github.com/konsorten/go-windows-terminal-sequences v1.0.1 h1:mweAR1A6xJ3oS2pRaGiHgQ4OO8tzTaLawm8vnODuwDk=
|
github.com/konsorten/go-windows-terminal-sequences v1.0.1 h1:mweAR1A6xJ3oS2pRaGiHgQ4OO8tzTaLawm8vnODuwDk=
|
||||||
|
357
src/runtime/vendor/github.com/kata-containers/govmm/qemu/qemu.go
generated
vendored
357
src/runtime/vendor/github.com/kata-containers/govmm/qemu/qemu.go
generated
vendored
@ -258,6 +258,9 @@ type Object struct {
|
|||||||
|
|
||||||
// File is the device file
|
// File is the device file
|
||||||
File string
|
File string
|
||||||
|
|
||||||
|
// ReadOnly specifies whether `MemPath` is opened read-only or read/write (default)
|
||||||
|
ReadOnly bool
|
||||||
}
|
}
|
||||||
|
|
||||||
// Valid returns true if the Object structure is valid and complete.
|
// Valid returns true if the Object structure is valid and complete.
|
||||||
@ -287,30 +290,39 @@ func (object Object) QemuParams(config *Config) []string {
|
|||||||
var qemuParams []string
|
var qemuParams []string
|
||||||
|
|
||||||
deviceParams = append(deviceParams, string(object.Driver))
|
deviceParams = append(deviceParams, string(object.Driver))
|
||||||
deviceParams = append(deviceParams, fmt.Sprintf(",id=%s", object.DeviceID))
|
deviceParams = append(deviceParams, fmt.Sprintf("id=%s", object.DeviceID))
|
||||||
|
|
||||||
switch object.Type {
|
switch object.Type {
|
||||||
case MemoryBackendFile:
|
case MemoryBackendFile:
|
||||||
objectParams = append(objectParams, string(object.Type))
|
objectParams = append(objectParams, string(object.Type))
|
||||||
objectParams = append(objectParams, fmt.Sprintf(",id=%s", object.ID))
|
objectParams = append(objectParams, fmt.Sprintf("id=%s", object.ID))
|
||||||
objectParams = append(objectParams, fmt.Sprintf(",mem-path=%s", object.MemPath))
|
objectParams = append(objectParams, fmt.Sprintf("mem-path=%s", object.MemPath))
|
||||||
objectParams = append(objectParams, fmt.Sprintf(",size=%d", object.Size))
|
objectParams = append(objectParams, fmt.Sprintf("size=%d", object.Size))
|
||||||
|
|
||||||
deviceParams = append(deviceParams, fmt.Sprintf(",memdev=%s", object.ID))
|
deviceParams = append(deviceParams, fmt.Sprintf("memdev=%s", object.ID))
|
||||||
|
if object.ReadOnly {
|
||||||
|
objectParams = append(objectParams, "readonly=on")
|
||||||
|
deviceParams = append(deviceParams, "unarmed=on")
|
||||||
|
}
|
||||||
case TDXGuest:
|
case TDXGuest:
|
||||||
objectParams = append(objectParams, string(object.Type))
|
objectParams = append(objectParams, string(object.Type))
|
||||||
objectParams = append(objectParams, fmt.Sprintf(",id=%s", object.ID))
|
objectParams = append(objectParams, fmt.Sprintf("id=%s", object.ID))
|
||||||
if object.Debug {
|
if object.Debug {
|
||||||
objectParams = append(objectParams, ",debug=on")
|
objectParams = append(objectParams, "debug=on")
|
||||||
}
|
}
|
||||||
deviceParams = append(deviceParams, fmt.Sprintf(",file=%s", object.File))
|
deviceParams = append(deviceParams, fmt.Sprintf("file=%s", object.File))
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
qemuParams = append(qemuParams, "-device")
|
if len(deviceParams) > 0 {
|
||||||
qemuParams = append(qemuParams, strings.Join(deviceParams, ""))
|
qemuParams = append(qemuParams, "-device")
|
||||||
|
qemuParams = append(qemuParams, strings.Join(deviceParams, ","))
|
||||||
|
}
|
||||||
|
|
||||||
qemuParams = append(qemuParams, "-object")
|
if len(objectParams) > 0 {
|
||||||
qemuParams = append(qemuParams, strings.Join(objectParams, ""))
|
qemuParams = append(qemuParams, "-object")
|
||||||
|
qemuParams = append(qemuParams, strings.Join(objectParams, ","))
|
||||||
|
}
|
||||||
|
|
||||||
return qemuParams
|
return qemuParams
|
||||||
}
|
}
|
||||||
@ -425,34 +437,34 @@ func (fsdev FSDevice) QemuParams(config *Config) []string {
|
|||||||
|
|
||||||
deviceParams = append(deviceParams, fsdev.deviceName(config))
|
deviceParams = append(deviceParams, fsdev.deviceName(config))
|
||||||
if s := fsdev.Transport.disableModern(config, fsdev.DisableModern); s != "" {
|
if s := fsdev.Transport.disableModern(config, fsdev.DisableModern); s != "" {
|
||||||
deviceParams = append(deviceParams, fmt.Sprintf(",%s", s))
|
deviceParams = append(deviceParams, s)
|
||||||
}
|
}
|
||||||
deviceParams = append(deviceParams, fmt.Sprintf(",fsdev=%s", fsdev.ID))
|
deviceParams = append(deviceParams, fmt.Sprintf("fsdev=%s", fsdev.ID))
|
||||||
deviceParams = append(deviceParams, fmt.Sprintf(",mount_tag=%s", fsdev.MountTag))
|
deviceParams = append(deviceParams, fmt.Sprintf("mount_tag=%s", fsdev.MountTag))
|
||||||
if fsdev.Transport.isVirtioPCI(config) && fsdev.ROMFile != "" {
|
if fsdev.Transport.isVirtioPCI(config) && fsdev.ROMFile != "" {
|
||||||
deviceParams = append(deviceParams, fmt.Sprintf(",romfile=%s", fsdev.ROMFile))
|
deviceParams = append(deviceParams, fmt.Sprintf("romfile=%s", fsdev.ROMFile))
|
||||||
}
|
}
|
||||||
if fsdev.Transport.isVirtioCCW(config) {
|
if fsdev.Transport.isVirtioCCW(config) {
|
||||||
if config.Knobs.IOMMUPlatform {
|
if config.Knobs.IOMMUPlatform {
|
||||||
deviceParams = append(deviceParams, ",iommu_platform=on")
|
deviceParams = append(deviceParams, ",iommu_platform=on")
|
||||||
}
|
}
|
||||||
deviceParams = append(deviceParams, fmt.Sprintf(",devno=%s", fsdev.DevNo))
|
deviceParams = append(deviceParams, fmt.Sprintf("devno=%s", fsdev.DevNo))
|
||||||
}
|
}
|
||||||
|
|
||||||
fsParams = append(fsParams, string(fsdev.FSDriver))
|
fsParams = append(fsParams, string(fsdev.FSDriver))
|
||||||
fsParams = append(fsParams, fmt.Sprintf(",id=%s", fsdev.ID))
|
fsParams = append(fsParams, fmt.Sprintf("id=%s", fsdev.ID))
|
||||||
fsParams = append(fsParams, fmt.Sprintf(",path=%s", fsdev.Path))
|
fsParams = append(fsParams, fmt.Sprintf("path=%s", fsdev.Path))
|
||||||
fsParams = append(fsParams, fmt.Sprintf(",security_model=%s", fsdev.SecurityModel))
|
fsParams = append(fsParams, fmt.Sprintf("security_model=%s", fsdev.SecurityModel))
|
||||||
|
|
||||||
if fsdev.Multidev != "" {
|
if fsdev.Multidev != "" {
|
||||||
fsParams = append(fsParams, fmt.Sprintf(",multidevs=%s", fsdev.Multidev))
|
fsParams = append(fsParams, fmt.Sprintf("multidevs=%s", fsdev.Multidev))
|
||||||
}
|
}
|
||||||
|
|
||||||
qemuParams = append(qemuParams, "-device")
|
qemuParams = append(qemuParams, "-device")
|
||||||
qemuParams = append(qemuParams, strings.Join(deviceParams, ""))
|
qemuParams = append(qemuParams, strings.Join(deviceParams, ","))
|
||||||
|
|
||||||
qemuParams = append(qemuParams, "-fsdev")
|
qemuParams = append(qemuParams, "-fsdev")
|
||||||
qemuParams = append(qemuParams, strings.Join(fsParams, ""))
|
qemuParams = append(qemuParams, strings.Join(fsParams, ","))
|
||||||
|
|
||||||
return qemuParams
|
return qemuParams
|
||||||
}
|
}
|
||||||
@ -551,41 +563,41 @@ func (cdev CharDevice) QemuParams(config *Config) []string {
|
|||||||
deviceParams = append(deviceParams, cdev.deviceName(config))
|
deviceParams = append(deviceParams, cdev.deviceName(config))
|
||||||
if cdev.Driver == VirtioSerial {
|
if cdev.Driver == VirtioSerial {
|
||||||
if s := cdev.Transport.disableModern(config, cdev.DisableModern); s != "" {
|
if s := cdev.Transport.disableModern(config, cdev.DisableModern); s != "" {
|
||||||
deviceParams = append(deviceParams, fmt.Sprintf(",%s", s))
|
deviceParams = append(deviceParams, s)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if cdev.Bus != "" {
|
if cdev.Bus != "" {
|
||||||
deviceParams = append(deviceParams, fmt.Sprintf(",bus=%s", cdev.Bus))
|
deviceParams = append(deviceParams, fmt.Sprintf("bus=%s", cdev.Bus))
|
||||||
}
|
}
|
||||||
deviceParams = append(deviceParams, fmt.Sprintf(",chardev=%s", cdev.ID))
|
deviceParams = append(deviceParams, fmt.Sprintf("chardev=%s", cdev.ID))
|
||||||
deviceParams = append(deviceParams, fmt.Sprintf(",id=%s", cdev.DeviceID))
|
deviceParams = append(deviceParams, fmt.Sprintf("id=%s", cdev.DeviceID))
|
||||||
if cdev.Name != "" {
|
if cdev.Name != "" {
|
||||||
deviceParams = append(deviceParams, fmt.Sprintf(",name=%s", cdev.Name))
|
deviceParams = append(deviceParams, fmt.Sprintf("name=%s", cdev.Name))
|
||||||
}
|
}
|
||||||
if cdev.Driver == VirtioSerial && cdev.Transport.isVirtioPCI(config) && cdev.ROMFile != "" {
|
if cdev.Driver == VirtioSerial && cdev.Transport.isVirtioPCI(config) && cdev.ROMFile != "" {
|
||||||
deviceParams = append(deviceParams, fmt.Sprintf(",romfile=%s", cdev.ROMFile))
|
deviceParams = append(deviceParams, fmt.Sprintf("romfile=%s", cdev.ROMFile))
|
||||||
}
|
}
|
||||||
|
|
||||||
if cdev.Driver == VirtioSerial && cdev.Transport.isVirtioCCW(config) {
|
if cdev.Driver == VirtioSerial && cdev.Transport.isVirtioCCW(config) {
|
||||||
if config.Knobs.IOMMUPlatform {
|
if config.Knobs.IOMMUPlatform {
|
||||||
deviceParams = append(deviceParams, ",iommu_platform=on")
|
deviceParams = append(deviceParams, "iommu_platform=on")
|
||||||
}
|
}
|
||||||
deviceParams = append(deviceParams, fmt.Sprintf(",devno=%s", cdev.DevNo))
|
deviceParams = append(deviceParams, fmt.Sprintf("devno=%s", cdev.DevNo))
|
||||||
}
|
}
|
||||||
|
|
||||||
cdevParams = append(cdevParams, string(cdev.Backend))
|
cdevParams = append(cdevParams, string(cdev.Backend))
|
||||||
cdevParams = append(cdevParams, fmt.Sprintf(",id=%s", cdev.ID))
|
cdevParams = append(cdevParams, fmt.Sprintf("id=%s", cdev.ID))
|
||||||
if cdev.Backend == Socket {
|
if cdev.Backend == Socket {
|
||||||
cdevParams = append(cdevParams, fmt.Sprintf(",path=%s,server=on,wait=off", cdev.Path))
|
cdevParams = append(cdevParams, fmt.Sprintf("path=%s,server=on,wait=off", cdev.Path))
|
||||||
} else {
|
} else {
|
||||||
cdevParams = append(cdevParams, fmt.Sprintf(",path=%s", cdev.Path))
|
cdevParams = append(cdevParams, fmt.Sprintf("path=%s", cdev.Path))
|
||||||
}
|
}
|
||||||
|
|
||||||
qemuParams = append(qemuParams, "-device")
|
qemuParams = append(qemuParams, "-device")
|
||||||
qemuParams = append(qemuParams, strings.Join(deviceParams, ""))
|
qemuParams = append(qemuParams, strings.Join(deviceParams, ","))
|
||||||
|
|
||||||
qemuParams = append(qemuParams, "-chardev")
|
qemuParams = append(qemuParams, "-chardev")
|
||||||
qemuParams = append(qemuParams, strings.Join(cdevParams, ""))
|
qemuParams = append(qemuParams, strings.Join(cdevParams, ","))
|
||||||
|
|
||||||
return qemuParams
|
return qemuParams
|
||||||
}
|
}
|
||||||
@ -781,7 +793,7 @@ func (netdev NetDevice) Valid() bool {
|
|||||||
// multi-queue option mq needs to be activated. See comment in libvirt code at
|
// multi-queue option mq needs to be activated. See comment in libvirt code at
|
||||||
// https://github.com/libvirt/libvirt/blob/6e7e965dcd3d885739129b1454ce19e819b54c25/src/qemu/qemu_command.c#L3633
|
// https://github.com/libvirt/libvirt/blob/6e7e965dcd3d885739129b1454ce19e819b54c25/src/qemu/qemu_command.c#L3633
|
||||||
func (netdev NetDevice) mqParameter(config *Config) string {
|
func (netdev NetDevice) mqParameter(config *Config) string {
|
||||||
p := []string{",mq=on"}
|
p := []string{"mq=on"}
|
||||||
|
|
||||||
if netdev.Transport.isVirtioPCI(config) {
|
if netdev.Transport.isVirtioPCI(config) {
|
||||||
// https://www.linux-kvm.org/page/Multiqueue
|
// https://www.linux-kvm.org/page/Multiqueue
|
||||||
@ -794,10 +806,10 @@ func (netdev NetDevice) mqParameter(config *Config) string {
|
|||||||
// The agent implementation should do this to ensure that it is
|
// The agent implementation should do this to ensure that it is
|
||||||
// always set
|
// always set
|
||||||
vectors := len(netdev.FDs)*2 + 2
|
vectors := len(netdev.FDs)*2 + 2
|
||||||
p = append(p, fmt.Sprintf(",vectors=%d", vectors))
|
p = append(p, fmt.Sprintf("vectors=%d", vectors))
|
||||||
}
|
}
|
||||||
|
|
||||||
return strings.Join(p, "")
|
return strings.Join(p, ",")
|
||||||
}
|
}
|
||||||
|
|
||||||
// QemuDeviceParams returns the -device parameters for this network device
|
// QemuDeviceParams returns the -device parameters for this network device
|
||||||
@ -810,21 +822,21 @@ func (netdev NetDevice) QemuDeviceParams(config *Config) []string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
deviceParams = append(deviceParams, fmt.Sprintf("driver=%s", driver))
|
deviceParams = append(deviceParams, fmt.Sprintf("driver=%s", driver))
|
||||||
deviceParams = append(deviceParams, fmt.Sprintf(",netdev=%s", netdev.ID))
|
deviceParams = append(deviceParams, fmt.Sprintf("netdev=%s", netdev.ID))
|
||||||
deviceParams = append(deviceParams, fmt.Sprintf(",mac=%s", netdev.MACAddress))
|
deviceParams = append(deviceParams, fmt.Sprintf("mac=%s", netdev.MACAddress))
|
||||||
|
|
||||||
if netdev.Bus != "" {
|
if netdev.Bus != "" {
|
||||||
deviceParams = append(deviceParams, fmt.Sprintf(",bus=%s", netdev.Bus))
|
deviceParams = append(deviceParams, fmt.Sprintf("bus=%s", netdev.Bus))
|
||||||
}
|
}
|
||||||
|
|
||||||
if netdev.Addr != "" {
|
if netdev.Addr != "" {
|
||||||
addr, err := strconv.Atoi(netdev.Addr)
|
addr, err := strconv.Atoi(netdev.Addr)
|
||||||
if err == nil && addr >= 0 {
|
if err == nil && addr >= 0 {
|
||||||
deviceParams = append(deviceParams, fmt.Sprintf(",addr=%x", addr))
|
deviceParams = append(deviceParams, fmt.Sprintf("addr=%x", addr))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if s := netdev.Transport.disableModern(config, netdev.DisableModern); s != "" {
|
if s := netdev.Transport.disableModern(config, netdev.DisableModern); s != "" {
|
||||||
deviceParams = append(deviceParams, fmt.Sprintf(",%s", s))
|
deviceParams = append(deviceParams, s)
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(netdev.FDs) > 0 {
|
if len(netdev.FDs) > 0 {
|
||||||
@ -833,14 +845,14 @@ func (netdev NetDevice) QemuDeviceParams(config *Config) []string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if netdev.Transport.isVirtioPCI(config) && netdev.ROMFile != "" {
|
if netdev.Transport.isVirtioPCI(config) && netdev.ROMFile != "" {
|
||||||
deviceParams = append(deviceParams, fmt.Sprintf(",romfile=%s", netdev.ROMFile))
|
deviceParams = append(deviceParams, fmt.Sprintf("romfile=%s", netdev.ROMFile))
|
||||||
}
|
}
|
||||||
|
|
||||||
if netdev.Transport.isVirtioCCW(config) {
|
if netdev.Transport.isVirtioCCW(config) {
|
||||||
if config.Knobs.IOMMUPlatform {
|
if config.Knobs.IOMMUPlatform {
|
||||||
deviceParams = append(deviceParams, ",iommu_platform=on")
|
deviceParams = append(deviceParams, "iommu_platform=on")
|
||||||
}
|
}
|
||||||
deviceParams = append(deviceParams, fmt.Sprintf(",devno=%s", netdev.DevNo))
|
deviceParams = append(deviceParams, fmt.Sprintf("devno=%s", netdev.DevNo))
|
||||||
}
|
}
|
||||||
|
|
||||||
return deviceParams
|
return deviceParams
|
||||||
@ -856,17 +868,17 @@ func (netdev NetDevice) QemuNetdevParams(config *Config) []string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
netdevParams = append(netdevParams, netdevType)
|
netdevParams = append(netdevParams, netdevType)
|
||||||
netdevParams = append(netdevParams, fmt.Sprintf(",id=%s", netdev.ID))
|
netdevParams = append(netdevParams, fmt.Sprintf("id=%s", netdev.ID))
|
||||||
|
|
||||||
if netdev.VHost {
|
if netdev.VHost {
|
||||||
netdevParams = append(netdevParams, ",vhost=on")
|
netdevParams = append(netdevParams, "vhost=on")
|
||||||
if len(netdev.VhostFDs) > 0 {
|
if len(netdev.VhostFDs) > 0 {
|
||||||
var fdParams []string
|
var fdParams []string
|
||||||
qemuFDs := config.appendFDs(netdev.VhostFDs)
|
qemuFDs := config.appendFDs(netdev.VhostFDs)
|
||||||
for _, fd := range qemuFDs {
|
for _, fd := range qemuFDs {
|
||||||
fdParams = append(fdParams, fmt.Sprintf("%d", fd))
|
fdParams = append(fdParams, fmt.Sprintf("%d", fd))
|
||||||
}
|
}
|
||||||
netdevParams = append(netdevParams, fmt.Sprintf(",vhostfds=%s", strings.Join(fdParams, ":")))
|
netdevParams = append(netdevParams, fmt.Sprintf("vhostfds=%s", strings.Join(fdParams, ":")))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -878,15 +890,15 @@ func (netdev NetDevice) QemuNetdevParams(config *Config) []string {
|
|||||||
fdParams = append(fdParams, fmt.Sprintf("%d", fd))
|
fdParams = append(fdParams, fmt.Sprintf("%d", fd))
|
||||||
}
|
}
|
||||||
|
|
||||||
netdevParams = append(netdevParams, fmt.Sprintf(",fds=%s", strings.Join(fdParams, ":")))
|
netdevParams = append(netdevParams, fmt.Sprintf("fds=%s", strings.Join(fdParams, ":")))
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
netdevParams = append(netdevParams, fmt.Sprintf(",ifname=%s", netdev.IFName))
|
netdevParams = append(netdevParams, fmt.Sprintf("ifname=%s", netdev.IFName))
|
||||||
if netdev.DownScript != "" {
|
if netdev.DownScript != "" {
|
||||||
netdevParams = append(netdevParams, fmt.Sprintf(",downscript=%s", netdev.DownScript))
|
netdevParams = append(netdevParams, fmt.Sprintf("downscript=%s", netdev.DownScript))
|
||||||
}
|
}
|
||||||
if netdev.Script != "" {
|
if netdev.Script != "" {
|
||||||
netdevParams = append(netdevParams, fmt.Sprintf(",script=%s", netdev.Script))
|
netdevParams = append(netdevParams, fmt.Sprintf("script=%s", netdev.Script))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return netdevParams
|
return netdevParams
|
||||||
@ -907,7 +919,7 @@ func (netdev NetDevice) QemuParams(config *Config) []string {
|
|||||||
netdevParams = netdev.QemuNetdevParams(config)
|
netdevParams = netdev.QemuNetdevParams(config)
|
||||||
if netdevParams != nil {
|
if netdevParams != nil {
|
||||||
qemuParams = append(qemuParams, "-netdev")
|
qemuParams = append(qemuParams, "-netdev")
|
||||||
qemuParams = append(qemuParams, strings.Join(netdevParams, ""))
|
qemuParams = append(qemuParams, strings.Join(netdevParams, ","))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -915,7 +927,7 @@ func (netdev NetDevice) QemuParams(config *Config) []string {
|
|||||||
deviceParams = netdev.QemuDeviceParams(config)
|
deviceParams = netdev.QemuDeviceParams(config)
|
||||||
if deviceParams != nil {
|
if deviceParams != nil {
|
||||||
qemuParams = append(qemuParams, "-device")
|
qemuParams = append(qemuParams, "-device")
|
||||||
qemuParams = append(qemuParams, strings.Join(deviceParams, ""))
|
qemuParams = append(qemuParams, strings.Join(deviceParams, ","))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -962,25 +974,25 @@ func (dev SerialDevice) QemuParams(config *Config) []string {
|
|||||||
|
|
||||||
deviceParams = append(deviceParams, dev.deviceName(config))
|
deviceParams = append(deviceParams, dev.deviceName(config))
|
||||||
if s := dev.Transport.disableModern(config, dev.DisableModern); s != "" {
|
if s := dev.Transport.disableModern(config, dev.DisableModern); s != "" {
|
||||||
deviceParams = append(deviceParams, fmt.Sprintf(",%s", s))
|
deviceParams = append(deviceParams, s)
|
||||||
}
|
}
|
||||||
deviceParams = append(deviceParams, fmt.Sprintf(",id=%s", dev.ID))
|
deviceParams = append(deviceParams, fmt.Sprintf("id=%s", dev.ID))
|
||||||
if dev.Transport.isVirtioPCI(config) && dev.ROMFile != "" {
|
if dev.Transport.isVirtioPCI(config) && dev.ROMFile != "" {
|
||||||
deviceParams = append(deviceParams, fmt.Sprintf(",romfile=%s", dev.ROMFile))
|
deviceParams = append(deviceParams, fmt.Sprintf("romfile=%s", dev.ROMFile))
|
||||||
if dev.Driver == VirtioSerial && dev.MaxPorts != 0 {
|
if dev.Driver == VirtioSerial && dev.MaxPorts != 0 {
|
||||||
deviceParams = append(deviceParams, fmt.Sprintf(",max_ports=%d", dev.MaxPorts))
|
deviceParams = append(deviceParams, fmt.Sprintf("max_ports=%d", dev.MaxPorts))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if dev.Transport.isVirtioCCW(config) {
|
if dev.Transport.isVirtioCCW(config) {
|
||||||
if config.Knobs.IOMMUPlatform {
|
if config.Knobs.IOMMUPlatform {
|
||||||
deviceParams = append(deviceParams, ",iommu_platform=on")
|
deviceParams = append(deviceParams, "iommu_platform=on")
|
||||||
}
|
}
|
||||||
deviceParams = append(deviceParams, fmt.Sprintf(",devno=%s", dev.DevNo))
|
deviceParams = append(deviceParams, fmt.Sprintf("devno=%s", dev.DevNo))
|
||||||
}
|
}
|
||||||
|
|
||||||
qemuParams = append(qemuParams, "-device")
|
qemuParams = append(qemuParams, "-device")
|
||||||
qemuParams = append(qemuParams, strings.Join(deviceParams, ""))
|
qemuParams = append(qemuParams, strings.Join(deviceParams, ","))
|
||||||
|
|
||||||
return qemuParams
|
return qemuParams
|
||||||
}
|
}
|
||||||
@ -1085,46 +1097,46 @@ func (blkdev BlockDevice) QemuParams(config *Config) []string {
|
|||||||
|
|
||||||
deviceParams = append(deviceParams, blkdev.deviceName(config))
|
deviceParams = append(deviceParams, blkdev.deviceName(config))
|
||||||
if s := blkdev.Transport.disableModern(config, blkdev.DisableModern); s != "" {
|
if s := blkdev.Transport.disableModern(config, blkdev.DisableModern); s != "" {
|
||||||
deviceParams = append(deviceParams, fmt.Sprintf(",%s", s))
|
deviceParams = append(deviceParams, s)
|
||||||
}
|
}
|
||||||
deviceParams = append(deviceParams, fmt.Sprintf(",drive=%s", blkdev.ID))
|
deviceParams = append(deviceParams, fmt.Sprintf("drive=%s", blkdev.ID))
|
||||||
if !blkdev.SCSI {
|
if !blkdev.SCSI {
|
||||||
deviceParams = append(deviceParams, ",scsi=off")
|
deviceParams = append(deviceParams, "scsi=off")
|
||||||
}
|
}
|
||||||
|
|
||||||
if !blkdev.WCE {
|
if !blkdev.WCE {
|
||||||
deviceParams = append(deviceParams, ",config-wce=off")
|
deviceParams = append(deviceParams, "config-wce=off")
|
||||||
}
|
}
|
||||||
|
|
||||||
if blkdev.Transport.isVirtioPCI(config) && blkdev.ROMFile != "" {
|
if blkdev.Transport.isVirtioPCI(config) && blkdev.ROMFile != "" {
|
||||||
deviceParams = append(deviceParams, fmt.Sprintf(",romfile=%s", blkdev.ROMFile))
|
deviceParams = append(deviceParams, fmt.Sprintf("romfile=%s", blkdev.ROMFile))
|
||||||
}
|
}
|
||||||
|
|
||||||
if blkdev.Transport.isVirtioCCW(config) {
|
if blkdev.Transport.isVirtioCCW(config) {
|
||||||
deviceParams = append(deviceParams, fmt.Sprintf(",devno=%s", blkdev.DevNo))
|
deviceParams = append(deviceParams, fmt.Sprintf("devno=%s", blkdev.DevNo))
|
||||||
}
|
}
|
||||||
|
|
||||||
if blkdev.ShareRW {
|
if blkdev.ShareRW {
|
||||||
deviceParams = append(deviceParams, fmt.Sprintf(",share-rw=on"))
|
deviceParams = append(deviceParams, "share-rw=on")
|
||||||
}
|
}
|
||||||
|
|
||||||
deviceParams = append(deviceParams, fmt.Sprintf(",serial=%s", blkdev.ID))
|
deviceParams = append(deviceParams, fmt.Sprintf("serial=%s", blkdev.ID))
|
||||||
|
|
||||||
blkParams = append(blkParams, fmt.Sprintf("id=%s", blkdev.ID))
|
blkParams = append(blkParams, fmt.Sprintf("id=%s", blkdev.ID))
|
||||||
blkParams = append(blkParams, fmt.Sprintf(",file=%s", blkdev.File))
|
blkParams = append(blkParams, fmt.Sprintf("file=%s", blkdev.File))
|
||||||
blkParams = append(blkParams, fmt.Sprintf(",aio=%s", blkdev.AIO))
|
blkParams = append(blkParams, fmt.Sprintf("aio=%s", blkdev.AIO))
|
||||||
blkParams = append(blkParams, fmt.Sprintf(",format=%s", blkdev.Format))
|
blkParams = append(blkParams, fmt.Sprintf("format=%s", blkdev.Format))
|
||||||
blkParams = append(blkParams, fmt.Sprintf(",if=%s", blkdev.Interface))
|
blkParams = append(blkParams, fmt.Sprintf("if=%s", blkdev.Interface))
|
||||||
|
|
||||||
if blkdev.ReadOnly {
|
if blkdev.ReadOnly {
|
||||||
blkParams = append(blkParams, ",readonly")
|
blkParams = append(blkParams, "readonly")
|
||||||
}
|
}
|
||||||
|
|
||||||
qemuParams = append(qemuParams, "-device")
|
qemuParams = append(qemuParams, "-device")
|
||||||
qemuParams = append(qemuParams, strings.Join(deviceParams, ""))
|
qemuParams = append(qemuParams, strings.Join(deviceParams, ","))
|
||||||
|
|
||||||
qemuParams = append(qemuParams, "-drive")
|
qemuParams = append(qemuParams, "-drive")
|
||||||
qemuParams = append(qemuParams, strings.Join(blkParams, ""))
|
qemuParams = append(qemuParams, strings.Join(blkParams, ","))
|
||||||
|
|
||||||
return qemuParams
|
return qemuParams
|
||||||
}
|
}
|
||||||
@ -1184,14 +1196,14 @@ func (dev LoaderDevice) Valid() bool {
|
|||||||
// QemuParams returns the qemu parameters built out of this loader device.
|
// QemuParams returns the qemu parameters built out of this loader device.
|
||||||
func (dev LoaderDevice) QemuParams(config *Config) []string {
|
func (dev LoaderDevice) QemuParams(config *Config) []string {
|
||||||
var qemuParams []string
|
var qemuParams []string
|
||||||
var devParams []string
|
var deviceParams []string
|
||||||
|
|
||||||
devParams = append(devParams, "loader")
|
deviceParams = append(deviceParams, "loader")
|
||||||
devParams = append(devParams, fmt.Sprintf("file=%s", dev.File))
|
deviceParams = append(deviceParams, fmt.Sprintf("file=%s", dev.File))
|
||||||
devParams = append(devParams, fmt.Sprintf("id=%s", dev.ID))
|
deviceParams = append(deviceParams, fmt.Sprintf("id=%s", dev.ID))
|
||||||
|
|
||||||
qemuParams = append(qemuParams, "-device")
|
qemuParams = append(qemuParams, "-device")
|
||||||
qemuParams = append(qemuParams, strings.Join(devParams, ","))
|
qemuParams = append(qemuParams, strings.Join(deviceParams, ","))
|
||||||
|
|
||||||
return qemuParams
|
return qemuParams
|
||||||
}
|
}
|
||||||
@ -1282,7 +1294,7 @@ func (vhostuserDev VhostUserDevice) Valid() bool {
|
|||||||
func (vhostuserDev VhostUserDevice) QemuNetParams(config *Config) []string {
|
func (vhostuserDev VhostUserDevice) QemuNetParams(config *Config) []string {
|
||||||
var qemuParams []string
|
var qemuParams []string
|
||||||
var netParams []string
|
var netParams []string
|
||||||
var devParams []string
|
var deviceParams []string
|
||||||
|
|
||||||
driver := vhostuserDev.deviceName(config)
|
driver := vhostuserDev.deviceName(config)
|
||||||
if driver == "" {
|
if driver == "" {
|
||||||
@ -1294,18 +1306,18 @@ func (vhostuserDev VhostUserDevice) QemuNetParams(config *Config) []string {
|
|||||||
netParams = append(netParams, fmt.Sprintf("chardev=%s", vhostuserDev.CharDevID))
|
netParams = append(netParams, fmt.Sprintf("chardev=%s", vhostuserDev.CharDevID))
|
||||||
netParams = append(netParams, "vhostforce")
|
netParams = append(netParams, "vhostforce")
|
||||||
|
|
||||||
devParams = append(devParams, driver)
|
deviceParams = append(deviceParams, driver)
|
||||||
devParams = append(devParams, fmt.Sprintf("netdev=%s", vhostuserDev.TypeDevID))
|
deviceParams = append(deviceParams, fmt.Sprintf("netdev=%s", vhostuserDev.TypeDevID))
|
||||||
devParams = append(devParams, fmt.Sprintf("mac=%s", vhostuserDev.Address))
|
deviceParams = append(deviceParams, fmt.Sprintf("mac=%s", vhostuserDev.Address))
|
||||||
|
|
||||||
if vhostuserDev.Transport.isVirtioPCI(config) && vhostuserDev.ROMFile != "" {
|
if vhostuserDev.Transport.isVirtioPCI(config) && vhostuserDev.ROMFile != "" {
|
||||||
devParams = append(devParams, fmt.Sprintf("romfile=%s", vhostuserDev.ROMFile))
|
deviceParams = append(deviceParams, fmt.Sprintf("romfile=%s", vhostuserDev.ROMFile))
|
||||||
}
|
}
|
||||||
|
|
||||||
qemuParams = append(qemuParams, "-netdev")
|
qemuParams = append(qemuParams, "-netdev")
|
||||||
qemuParams = append(qemuParams, strings.Join(netParams, ","))
|
qemuParams = append(qemuParams, strings.Join(netParams, ","))
|
||||||
qemuParams = append(qemuParams, "-device")
|
qemuParams = append(qemuParams, "-device")
|
||||||
qemuParams = append(qemuParams, strings.Join(devParams, ","))
|
qemuParams = append(qemuParams, strings.Join(deviceParams, ","))
|
||||||
|
|
||||||
return qemuParams
|
return qemuParams
|
||||||
}
|
}
|
||||||
@ -1313,23 +1325,23 @@ func (vhostuserDev VhostUserDevice) QemuNetParams(config *Config) []string {
|
|||||||
// QemuSCSIParams builds QEMU device parameters for a VhostUserSCSI device
|
// QemuSCSIParams builds QEMU device parameters for a VhostUserSCSI device
|
||||||
func (vhostuserDev VhostUserDevice) QemuSCSIParams(config *Config) []string {
|
func (vhostuserDev VhostUserDevice) QemuSCSIParams(config *Config) []string {
|
||||||
var qemuParams []string
|
var qemuParams []string
|
||||||
var devParams []string
|
var deviceParams []string
|
||||||
|
|
||||||
driver := vhostuserDev.deviceName(config)
|
driver := vhostuserDev.deviceName(config)
|
||||||
if driver == "" {
|
if driver == "" {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
devParams = append(devParams, driver)
|
deviceParams = append(deviceParams, driver)
|
||||||
devParams = append(devParams, fmt.Sprintf("id=%s", vhostuserDev.TypeDevID))
|
deviceParams = append(deviceParams, fmt.Sprintf("id=%s", vhostuserDev.TypeDevID))
|
||||||
devParams = append(devParams, fmt.Sprintf("chardev=%s", vhostuserDev.CharDevID))
|
deviceParams = append(deviceParams, fmt.Sprintf("chardev=%s", vhostuserDev.CharDevID))
|
||||||
|
|
||||||
if vhostuserDev.Transport.isVirtioPCI(config) && vhostuserDev.ROMFile != "" {
|
if vhostuserDev.Transport.isVirtioPCI(config) && vhostuserDev.ROMFile != "" {
|
||||||
devParams = append(devParams, fmt.Sprintf("romfile=%s", vhostuserDev.ROMFile))
|
deviceParams = append(deviceParams, fmt.Sprintf("romfile=%s", vhostuserDev.ROMFile))
|
||||||
}
|
}
|
||||||
|
|
||||||
qemuParams = append(qemuParams, "-device")
|
qemuParams = append(qemuParams, "-device")
|
||||||
qemuParams = append(qemuParams, strings.Join(devParams, ","))
|
qemuParams = append(qemuParams, strings.Join(deviceParams, ","))
|
||||||
|
|
||||||
return qemuParams
|
return qemuParams
|
||||||
}
|
}
|
||||||
@ -1337,24 +1349,24 @@ func (vhostuserDev VhostUserDevice) QemuSCSIParams(config *Config) []string {
|
|||||||
// QemuBlkParams builds QEMU device parameters for a VhostUserBlk device
|
// QemuBlkParams builds QEMU device parameters for a VhostUserBlk device
|
||||||
func (vhostuserDev VhostUserDevice) QemuBlkParams(config *Config) []string {
|
func (vhostuserDev VhostUserDevice) QemuBlkParams(config *Config) []string {
|
||||||
var qemuParams []string
|
var qemuParams []string
|
||||||
var devParams []string
|
var deviceParams []string
|
||||||
|
|
||||||
driver := vhostuserDev.deviceName(config)
|
driver := vhostuserDev.deviceName(config)
|
||||||
if driver == "" {
|
if driver == "" {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
devParams = append(devParams, driver)
|
deviceParams = append(deviceParams, driver)
|
||||||
devParams = append(devParams, "logical_block_size=4096")
|
deviceParams = append(deviceParams, "logical_block_size=4096")
|
||||||
devParams = append(devParams, "size=512M")
|
deviceParams = append(deviceParams, "size=512M")
|
||||||
devParams = append(devParams, fmt.Sprintf("chardev=%s", vhostuserDev.CharDevID))
|
deviceParams = append(deviceParams, fmt.Sprintf("chardev=%s", vhostuserDev.CharDevID))
|
||||||
|
|
||||||
if vhostuserDev.Transport.isVirtioPCI(config) && vhostuserDev.ROMFile != "" {
|
if vhostuserDev.Transport.isVirtioPCI(config) && vhostuserDev.ROMFile != "" {
|
||||||
devParams = append(devParams, fmt.Sprintf("romfile=%s", vhostuserDev.ROMFile))
|
deviceParams = append(deviceParams, fmt.Sprintf("romfile=%s", vhostuserDev.ROMFile))
|
||||||
}
|
}
|
||||||
|
|
||||||
qemuParams = append(qemuParams, "-device")
|
qemuParams = append(qemuParams, "-device")
|
||||||
qemuParams = append(qemuParams, strings.Join(devParams, ","))
|
qemuParams = append(qemuParams, strings.Join(deviceParams, ","))
|
||||||
|
|
||||||
return qemuParams
|
return qemuParams
|
||||||
}
|
}
|
||||||
@ -1362,31 +1374,31 @@ func (vhostuserDev VhostUserDevice) QemuBlkParams(config *Config) []string {
|
|||||||
// QemuFSParams builds QEMU device parameters for a VhostUserFS device
|
// QemuFSParams builds QEMU device parameters for a VhostUserFS device
|
||||||
func (vhostuserDev VhostUserDevice) QemuFSParams(config *Config) []string {
|
func (vhostuserDev VhostUserDevice) QemuFSParams(config *Config) []string {
|
||||||
var qemuParams []string
|
var qemuParams []string
|
||||||
var devParams []string
|
var deviceParams []string
|
||||||
|
|
||||||
driver := vhostuserDev.deviceName(config)
|
driver := vhostuserDev.deviceName(config)
|
||||||
if driver == "" {
|
if driver == "" {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
devParams = append(devParams, driver)
|
deviceParams = append(deviceParams, driver)
|
||||||
devParams = append(devParams, fmt.Sprintf("chardev=%s", vhostuserDev.CharDevID))
|
deviceParams = append(deviceParams, fmt.Sprintf("chardev=%s", vhostuserDev.CharDevID))
|
||||||
devParams = append(devParams, fmt.Sprintf("tag=%s", vhostuserDev.Tag))
|
deviceParams = append(deviceParams, fmt.Sprintf("tag=%s", vhostuserDev.Tag))
|
||||||
if vhostuserDev.CacheSize != 0 {
|
if vhostuserDev.CacheSize != 0 {
|
||||||
devParams = append(devParams, fmt.Sprintf("cache-size=%dM", vhostuserDev.CacheSize))
|
deviceParams = append(deviceParams, fmt.Sprintf("cache-size=%dM", vhostuserDev.CacheSize))
|
||||||
}
|
}
|
||||||
if vhostuserDev.SharedVersions {
|
if vhostuserDev.SharedVersions {
|
||||||
devParams = append(devParams, "versiontable=/dev/shm/fuse_shared_versions")
|
deviceParams = append(deviceParams, "versiontable=/dev/shm/fuse_shared_versions")
|
||||||
}
|
}
|
||||||
if vhostuserDev.Transport.isVirtioCCW(config) {
|
if vhostuserDev.Transport.isVirtioCCW(config) {
|
||||||
devParams = append(devParams, fmt.Sprintf("devno=%s", vhostuserDev.DevNo))
|
deviceParams = append(deviceParams, fmt.Sprintf("devno=%s", vhostuserDev.DevNo))
|
||||||
}
|
}
|
||||||
if vhostuserDev.Transport.isVirtioPCI(config) && vhostuserDev.ROMFile != "" {
|
if vhostuserDev.Transport.isVirtioPCI(config) && vhostuserDev.ROMFile != "" {
|
||||||
devParams = append(devParams, fmt.Sprintf("romfile=%s", vhostuserDev.ROMFile))
|
deviceParams = append(deviceParams, fmt.Sprintf("romfile=%s", vhostuserDev.ROMFile))
|
||||||
}
|
}
|
||||||
|
|
||||||
qemuParams = append(qemuParams, "-device")
|
qemuParams = append(qemuParams, "-device")
|
||||||
qemuParams = append(qemuParams, strings.Join(devParams, ","))
|
qemuParams = append(qemuParams, strings.Join(deviceParams, ","))
|
||||||
|
|
||||||
return qemuParams
|
return qemuParams
|
||||||
}
|
}
|
||||||
@ -1395,7 +1407,7 @@ func (vhostuserDev VhostUserDevice) QemuFSParams(config *Config) []string {
|
|||||||
func (vhostuserDev VhostUserDevice) QemuParams(config *Config) []string {
|
func (vhostuserDev VhostUserDevice) QemuParams(config *Config) []string {
|
||||||
var qemuParams []string
|
var qemuParams []string
|
||||||
var charParams []string
|
var charParams []string
|
||||||
var devParams []string
|
var deviceParams []string
|
||||||
|
|
||||||
charParams = append(charParams, "socket")
|
charParams = append(charParams, "socket")
|
||||||
charParams = append(charParams, fmt.Sprintf("id=%s", vhostuserDev.CharDevID))
|
charParams = append(charParams, fmt.Sprintf("id=%s", vhostuserDev.CharDevID))
|
||||||
@ -1406,19 +1418,19 @@ func (vhostuserDev VhostUserDevice) QemuParams(config *Config) []string {
|
|||||||
|
|
||||||
switch vhostuserDev.VhostUserType {
|
switch vhostuserDev.VhostUserType {
|
||||||
case VhostUserNet:
|
case VhostUserNet:
|
||||||
devParams = vhostuserDev.QemuNetParams(config)
|
deviceParams = vhostuserDev.QemuNetParams(config)
|
||||||
case VhostUserSCSI:
|
case VhostUserSCSI:
|
||||||
devParams = vhostuserDev.QemuSCSIParams(config)
|
deviceParams = vhostuserDev.QemuSCSIParams(config)
|
||||||
case VhostUserBlk:
|
case VhostUserBlk:
|
||||||
devParams = vhostuserDev.QemuBlkParams(config)
|
deviceParams = vhostuserDev.QemuBlkParams(config)
|
||||||
case VhostUserFS:
|
case VhostUserFS:
|
||||||
devParams = vhostuserDev.QemuFSParams(config)
|
deviceParams = vhostuserDev.QemuFSParams(config)
|
||||||
default:
|
default:
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
if devParams != nil {
|
if deviceParams != nil {
|
||||||
return append(qemuParams, devParams...)
|
return append(qemuParams, deviceParams...)
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
@ -1591,26 +1603,26 @@ func (vfioDev VFIODevice) QemuParams(config *Config) []string {
|
|||||||
deviceParams = append(deviceParams, fmt.Sprintf("%s,host=%s", driver, vfioDev.BDF))
|
deviceParams = append(deviceParams, fmt.Sprintf("%s,host=%s", driver, vfioDev.BDF))
|
||||||
if vfioDev.Transport.isVirtioPCI(config) {
|
if vfioDev.Transport.isVirtioPCI(config) {
|
||||||
if vfioDev.VendorID != "" {
|
if vfioDev.VendorID != "" {
|
||||||
deviceParams = append(deviceParams, fmt.Sprintf(",x-pci-vendor-id=%s", vfioDev.VendorID))
|
deviceParams = append(deviceParams, fmt.Sprintf("x-pci-vendor-id=%s", vfioDev.VendorID))
|
||||||
}
|
}
|
||||||
if vfioDev.DeviceID != "" {
|
if vfioDev.DeviceID != "" {
|
||||||
deviceParams = append(deviceParams, fmt.Sprintf(",x-pci-device-id=%s", vfioDev.DeviceID))
|
deviceParams = append(deviceParams, fmt.Sprintf("x-pci-device-id=%s", vfioDev.DeviceID))
|
||||||
}
|
}
|
||||||
if vfioDev.ROMFile != "" {
|
if vfioDev.ROMFile != "" {
|
||||||
deviceParams = append(deviceParams, fmt.Sprintf(",romfile=%s", vfioDev.ROMFile))
|
deviceParams = append(deviceParams, fmt.Sprintf("romfile=%s", vfioDev.ROMFile))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if vfioDev.Bus != "" {
|
if vfioDev.Bus != "" {
|
||||||
deviceParams = append(deviceParams, fmt.Sprintf(",bus=%s", vfioDev.Bus))
|
deviceParams = append(deviceParams, fmt.Sprintf("bus=%s", vfioDev.Bus))
|
||||||
}
|
}
|
||||||
|
|
||||||
if vfioDev.Transport.isVirtioCCW(config) {
|
if vfioDev.Transport.isVirtioCCW(config) {
|
||||||
deviceParams = append(deviceParams, fmt.Sprintf(",devno=%s", vfioDev.DevNo))
|
deviceParams = append(deviceParams, fmt.Sprintf("devno=%s", vfioDev.DevNo))
|
||||||
}
|
}
|
||||||
|
|
||||||
qemuParams = append(qemuParams, "-device")
|
qemuParams = append(qemuParams, "-device")
|
||||||
qemuParams = append(qemuParams, strings.Join(deviceParams, ""))
|
qemuParams = append(qemuParams, strings.Join(deviceParams, ","))
|
||||||
|
|
||||||
return qemuParams
|
return qemuParams
|
||||||
}
|
}
|
||||||
@ -1667,35 +1679,35 @@ func (scsiCon SCSIController) Valid() bool {
|
|||||||
// QemuParams returns the qemu parameters built out of this SCSIController device.
|
// QemuParams returns the qemu parameters built out of this SCSIController device.
|
||||||
func (scsiCon SCSIController) QemuParams(config *Config) []string {
|
func (scsiCon SCSIController) QemuParams(config *Config) []string {
|
||||||
var qemuParams []string
|
var qemuParams []string
|
||||||
var devParams []string
|
var deviceParams []string
|
||||||
|
|
||||||
driver := scsiCon.deviceName(config)
|
driver := scsiCon.deviceName(config)
|
||||||
devParams = append(devParams, fmt.Sprintf("%s,id=%s", driver, scsiCon.ID))
|
deviceParams = append(deviceParams, fmt.Sprintf("%s,id=%s", driver, scsiCon.ID))
|
||||||
if scsiCon.Bus != "" {
|
if scsiCon.Bus != "" {
|
||||||
devParams = append(devParams, fmt.Sprintf("bus=%s", scsiCon.Bus))
|
deviceParams = append(deviceParams, fmt.Sprintf("bus=%s", scsiCon.Bus))
|
||||||
}
|
}
|
||||||
if scsiCon.Addr != "" {
|
if scsiCon.Addr != "" {
|
||||||
devParams = append(devParams, fmt.Sprintf("addr=%s", scsiCon.Addr))
|
deviceParams = append(deviceParams, fmt.Sprintf("addr=%s", scsiCon.Addr))
|
||||||
}
|
}
|
||||||
if s := scsiCon.Transport.disableModern(config, scsiCon.DisableModern); s != "" {
|
if s := scsiCon.Transport.disableModern(config, scsiCon.DisableModern); s != "" {
|
||||||
devParams = append(devParams, s)
|
deviceParams = append(deviceParams, s)
|
||||||
}
|
}
|
||||||
if scsiCon.IOThread != "" {
|
if scsiCon.IOThread != "" {
|
||||||
devParams = append(devParams, fmt.Sprintf("iothread=%s", scsiCon.IOThread))
|
deviceParams = append(deviceParams, fmt.Sprintf("iothread=%s", scsiCon.IOThread))
|
||||||
}
|
}
|
||||||
if scsiCon.Transport.isVirtioPCI(config) && scsiCon.ROMFile != "" {
|
if scsiCon.Transport.isVirtioPCI(config) && scsiCon.ROMFile != "" {
|
||||||
devParams = append(devParams, fmt.Sprintf("romfile=%s", scsiCon.ROMFile))
|
deviceParams = append(deviceParams, fmt.Sprintf("romfile=%s", scsiCon.ROMFile))
|
||||||
}
|
}
|
||||||
|
|
||||||
if scsiCon.Transport.isVirtioCCW(config) {
|
if scsiCon.Transport.isVirtioCCW(config) {
|
||||||
if config.Knobs.IOMMUPlatform {
|
if config.Knobs.IOMMUPlatform {
|
||||||
devParams = append(devParams, ",iommu_platform=on")
|
deviceParams = append(deviceParams, "iommu_platform=on")
|
||||||
}
|
}
|
||||||
devParams = append(devParams, fmt.Sprintf("devno=%s", scsiCon.DevNo))
|
deviceParams = append(deviceParams, fmt.Sprintf("devno=%s", scsiCon.DevNo))
|
||||||
}
|
}
|
||||||
|
|
||||||
qemuParams = append(qemuParams, "-device")
|
qemuParams = append(qemuParams, "-device")
|
||||||
qemuParams = append(qemuParams, strings.Join(devParams, ","))
|
qemuParams = append(qemuParams, strings.Join(deviceParams, ","))
|
||||||
|
|
||||||
return qemuParams
|
return qemuParams
|
||||||
}
|
}
|
||||||
@ -1765,36 +1777,36 @@ func (bridgeDev BridgeDevice) Valid() bool {
|
|||||||
// QemuParams returns the qemu parameters built out of this bridge device.
|
// QemuParams returns the qemu parameters built out of this bridge device.
|
||||||
func (bridgeDev BridgeDevice) QemuParams(config *Config) []string {
|
func (bridgeDev BridgeDevice) QemuParams(config *Config) []string {
|
||||||
var qemuParams []string
|
var qemuParams []string
|
||||||
var deviceParam []string
|
var deviceParams []string
|
||||||
var driver DeviceDriver
|
var driver DeviceDriver
|
||||||
|
|
||||||
switch bridgeDev.Type {
|
switch bridgeDev.Type {
|
||||||
case PCIEBridge:
|
case PCIEBridge:
|
||||||
driver = PCIePCIBridgeDriver
|
driver = PCIePCIBridgeDriver
|
||||||
deviceParam = append(deviceParam, fmt.Sprintf("%s,bus=%s,id=%s", driver, bridgeDev.Bus, bridgeDev.ID))
|
deviceParams = append(deviceParams, fmt.Sprintf("%s,bus=%s,id=%s", driver, bridgeDev.Bus, bridgeDev.ID))
|
||||||
default:
|
default:
|
||||||
driver = PCIBridgeDriver
|
driver = PCIBridgeDriver
|
||||||
shpc := "off"
|
shpc := "off"
|
||||||
if bridgeDev.SHPC {
|
if bridgeDev.SHPC {
|
||||||
shpc = "on"
|
shpc = "on"
|
||||||
}
|
}
|
||||||
deviceParam = append(deviceParam, fmt.Sprintf("%s,bus=%s,id=%s,chassis_nr=%d,shpc=%s", driver, bridgeDev.Bus, bridgeDev.ID, bridgeDev.Chassis, shpc))
|
deviceParams = append(deviceParams, fmt.Sprintf("%s,bus=%s,id=%s,chassis_nr=%d,shpc=%s", driver, bridgeDev.Bus, bridgeDev.ID, bridgeDev.Chassis, shpc))
|
||||||
}
|
}
|
||||||
|
|
||||||
if bridgeDev.Addr != "" {
|
if bridgeDev.Addr != "" {
|
||||||
addr, err := strconv.Atoi(bridgeDev.Addr)
|
addr, err := strconv.Atoi(bridgeDev.Addr)
|
||||||
if err == nil && addr >= 0 {
|
if err == nil && addr >= 0 {
|
||||||
deviceParam = append(deviceParam, fmt.Sprintf(",addr=%x", addr))
|
deviceParams = append(deviceParams, fmt.Sprintf("addr=%x", addr))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var transport VirtioTransport
|
var transport VirtioTransport
|
||||||
if transport.isVirtioPCI(config) && bridgeDev.ROMFile != "" {
|
if transport.isVirtioPCI(config) && bridgeDev.ROMFile != "" {
|
||||||
deviceParam = append(deviceParam, fmt.Sprintf(",romfile=%s", bridgeDev.ROMFile))
|
deviceParams = append(deviceParams, fmt.Sprintf("romfile=%s", bridgeDev.ROMFile))
|
||||||
}
|
}
|
||||||
|
|
||||||
qemuParams = append(qemuParams, "-device")
|
qemuParams = append(qemuParams, "-device")
|
||||||
qemuParams = append(qemuParams, strings.Join(deviceParam, ""))
|
qemuParams = append(qemuParams, strings.Join(deviceParams, ","))
|
||||||
|
|
||||||
return qemuParams
|
return qemuParams
|
||||||
}
|
}
|
||||||
@ -1857,30 +1869,30 @@ func (vsock VSOCKDevice) QemuParams(config *Config) []string {
|
|||||||
var qemuParams []string
|
var qemuParams []string
|
||||||
|
|
||||||
driver := vsock.deviceName(config)
|
driver := vsock.deviceName(config)
|
||||||
deviceParams = append(deviceParams, string(driver))
|
deviceParams = append(deviceParams, driver)
|
||||||
if s := vsock.Transport.disableModern(config, vsock.DisableModern); s != "" {
|
if s := vsock.Transport.disableModern(config, vsock.DisableModern); s != "" {
|
||||||
deviceParams = append(deviceParams, fmt.Sprintf(",%s", s))
|
deviceParams = append(deviceParams, s)
|
||||||
}
|
}
|
||||||
if vsock.VHostFD != nil {
|
if vsock.VHostFD != nil {
|
||||||
qemuFDs := config.appendFDs([]*os.File{vsock.VHostFD})
|
qemuFDs := config.appendFDs([]*os.File{vsock.VHostFD})
|
||||||
deviceParams = append(deviceParams, fmt.Sprintf(",vhostfd=%d", qemuFDs[0]))
|
deviceParams = append(deviceParams, fmt.Sprintf("vhostfd=%d", qemuFDs[0]))
|
||||||
}
|
}
|
||||||
deviceParams = append(deviceParams, fmt.Sprintf(",id=%s", vsock.ID))
|
deviceParams = append(deviceParams, fmt.Sprintf("id=%s", vsock.ID))
|
||||||
deviceParams = append(deviceParams, fmt.Sprintf(",%s=%d", VSOCKGuestCID, vsock.ContextID))
|
deviceParams = append(deviceParams, fmt.Sprintf("%s=%d", VSOCKGuestCID, vsock.ContextID))
|
||||||
|
|
||||||
if vsock.Transport.isVirtioPCI(config) && vsock.ROMFile != "" {
|
if vsock.Transport.isVirtioPCI(config) && vsock.ROMFile != "" {
|
||||||
deviceParams = append(deviceParams, fmt.Sprintf(",romfile=%s", vsock.ROMFile))
|
deviceParams = append(deviceParams, fmt.Sprintf("romfile=%s", vsock.ROMFile))
|
||||||
}
|
}
|
||||||
|
|
||||||
if vsock.Transport.isVirtioCCW(config) {
|
if vsock.Transport.isVirtioCCW(config) {
|
||||||
if config.Knobs.IOMMUPlatform {
|
if config.Knobs.IOMMUPlatform {
|
||||||
deviceParams = append(deviceParams, ",iommu_platform=on")
|
deviceParams = append(deviceParams, "iommu_platform=on")
|
||||||
}
|
}
|
||||||
deviceParams = append(deviceParams, fmt.Sprintf(",devno=%s", vsock.DevNo))
|
deviceParams = append(deviceParams, fmt.Sprintf("devno=%s", vsock.DevNo))
|
||||||
}
|
}
|
||||||
|
|
||||||
qemuParams = append(qemuParams, "-device")
|
qemuParams = append(qemuParams, "-device")
|
||||||
qemuParams = append(qemuParams, strings.Join(deviceParams, ""))
|
qemuParams = append(qemuParams, strings.Join(deviceParams, ","))
|
||||||
|
|
||||||
return qemuParams
|
return qemuParams
|
||||||
}
|
}
|
||||||
@ -1947,7 +1959,7 @@ func (v RngDevice) QemuParams(config *Config) []string {
|
|||||||
|
|
||||||
if v.Transport.isVirtioCCW(config) {
|
if v.Transport.isVirtioCCW(config) {
|
||||||
if config.Knobs.IOMMUPlatform {
|
if config.Knobs.IOMMUPlatform {
|
||||||
deviceParams = append(deviceParams, ",iommu_platform=on")
|
deviceParams = append(deviceParams, "iommu_platform=on")
|
||||||
}
|
}
|
||||||
deviceParams = append(deviceParams, fmt.Sprintf("devno=%s", v.DevNo))
|
deviceParams = append(deviceParams, fmt.Sprintf("devno=%s", v.DevNo))
|
||||||
}
|
}
|
||||||
@ -2032,7 +2044,7 @@ func (b BalloonDevice) QemuParams(config *Config) []string {
|
|||||||
deviceParams = append(deviceParams, "deflate-on-oom=off")
|
deviceParams = append(deviceParams, "deflate-on-oom=off")
|
||||||
}
|
}
|
||||||
if s := b.Transport.disableModern(config, b.DisableModern); s != "" {
|
if s := b.Transport.disableModern(config, b.DisableModern); s != "" {
|
||||||
deviceParams = append(deviceParams, string(s))
|
deviceParams = append(deviceParams, s)
|
||||||
}
|
}
|
||||||
qemuParams = append(qemuParams, "-device")
|
qemuParams = append(qemuParams, "-device")
|
||||||
qemuParams = append(qemuParams, strings.Join(deviceParams, ","))
|
qemuParams = append(qemuParams, strings.Join(deviceParams, ","))
|
||||||
@ -2283,16 +2295,16 @@ func (fwcfg FwCfg) QemuParams(config *Config) []string {
|
|||||||
fwcfgParams = append(fwcfgParams, fmt.Sprintf("name=%s", f.Name))
|
fwcfgParams = append(fwcfgParams, fmt.Sprintf("name=%s", f.Name))
|
||||||
|
|
||||||
if f.File != "" {
|
if f.File != "" {
|
||||||
fwcfgParams = append(fwcfgParams, fmt.Sprintf(",file=%s", f.File))
|
fwcfgParams = append(fwcfgParams, fmt.Sprintf("file=%s", f.File))
|
||||||
}
|
}
|
||||||
|
|
||||||
if f.Str != "" {
|
if f.Str != "" {
|
||||||
fwcfgParams = append(fwcfgParams, fmt.Sprintf(",string=%s", f.Str))
|
fwcfgParams = append(fwcfgParams, fmt.Sprintf("string=%s", f.Str))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
qemuParams = append(qemuParams, "-fw_cfg")
|
qemuParams = append(qemuParams, "-fw_cfg")
|
||||||
qemuParams = append(qemuParams, strings.Join(fwcfgParams, ""))
|
qemuParams = append(qemuParams, strings.Join(fwcfgParams, ","))
|
||||||
}
|
}
|
||||||
|
|
||||||
return qemuParams
|
return qemuParams
|
||||||
@ -2482,15 +2494,15 @@ func (config *Config) appendMachine() {
|
|||||||
machineParams = append(machineParams, config.Machine.Type)
|
machineParams = append(machineParams, config.Machine.Type)
|
||||||
|
|
||||||
if config.Machine.Acceleration != "" {
|
if config.Machine.Acceleration != "" {
|
||||||
machineParams = append(machineParams, fmt.Sprintf(",accel=%s", config.Machine.Acceleration))
|
machineParams = append(machineParams, fmt.Sprintf("accel=%s", config.Machine.Acceleration))
|
||||||
}
|
}
|
||||||
|
|
||||||
if config.Machine.Options != "" {
|
if config.Machine.Options != "" {
|
||||||
machineParams = append(machineParams, fmt.Sprintf(",%s", config.Machine.Options))
|
machineParams = append(machineParams, config.Machine.Options)
|
||||||
}
|
}
|
||||||
|
|
||||||
config.qemuParams = append(config.qemuParams, "-machine")
|
config.qemuParams = append(config.qemuParams, "-machine")
|
||||||
config.qemuParams = append(config.qemuParams, strings.Join(machineParams, ""))
|
config.qemuParams = append(config.qemuParams, strings.Join(machineParams, ","))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2507,17 +2519,16 @@ func (config *Config) appendQMPSockets() {
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
qmpParams := append([]string{}, fmt.Sprintf("%s:", q.Type))
|
qmpParams := append([]string{}, fmt.Sprintf("%s:%s", q.Type, q.Name))
|
||||||
qmpParams = append(qmpParams, q.Name)
|
|
||||||
if q.Server {
|
if q.Server {
|
||||||
qmpParams = append(qmpParams, ",server=on")
|
qmpParams = append(qmpParams, "server=on")
|
||||||
if q.NoWait {
|
if q.NoWait {
|
||||||
qmpParams = append(qmpParams, ",wait=off")
|
qmpParams = append(qmpParams, "wait=off")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
config.qemuParams = append(config.qemuParams, "-qmp")
|
config.qemuParams = append(config.qemuParams, "-qmp")
|
||||||
config.qemuParams = append(config.qemuParams, strings.Join(qmpParams, ""))
|
config.qemuParams = append(config.qemuParams, strings.Join(qmpParams, ","))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2545,15 +2556,15 @@ func (config *Config) appendMemory() {
|
|||||||
memoryParams = append(memoryParams, config.Memory.Size)
|
memoryParams = append(memoryParams, config.Memory.Size)
|
||||||
|
|
||||||
if config.Memory.Slots > 0 {
|
if config.Memory.Slots > 0 {
|
||||||
memoryParams = append(memoryParams, fmt.Sprintf(",slots=%d", config.Memory.Slots))
|
memoryParams = append(memoryParams, fmt.Sprintf("slots=%d", config.Memory.Slots))
|
||||||
}
|
}
|
||||||
|
|
||||||
if config.Memory.MaxMem != "" {
|
if config.Memory.MaxMem != "" {
|
||||||
memoryParams = append(memoryParams, fmt.Sprintf(",maxmem=%s", config.Memory.MaxMem))
|
memoryParams = append(memoryParams, fmt.Sprintf("maxmem=%s", config.Memory.MaxMem))
|
||||||
}
|
}
|
||||||
|
|
||||||
config.qemuParams = append(config.qemuParams, "-m")
|
config.qemuParams = append(config.qemuParams, "-m")
|
||||||
config.qemuParams = append(config.qemuParams, strings.Join(memoryParams, ""))
|
config.qemuParams = append(config.qemuParams, strings.Join(memoryParams, ","))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2564,15 +2575,15 @@ func (config *Config) appendCPUs() error {
|
|||||||
SMPParams = append(SMPParams, fmt.Sprintf("%d", config.SMP.CPUs))
|
SMPParams = append(SMPParams, fmt.Sprintf("%d", config.SMP.CPUs))
|
||||||
|
|
||||||
if config.SMP.Cores > 0 {
|
if config.SMP.Cores > 0 {
|
||||||
SMPParams = append(SMPParams, fmt.Sprintf(",cores=%d", config.SMP.Cores))
|
SMPParams = append(SMPParams, fmt.Sprintf("cores=%d", config.SMP.Cores))
|
||||||
}
|
}
|
||||||
|
|
||||||
if config.SMP.Threads > 0 {
|
if config.SMP.Threads > 0 {
|
||||||
SMPParams = append(SMPParams, fmt.Sprintf(",threads=%d", config.SMP.Threads))
|
SMPParams = append(SMPParams, fmt.Sprintf("threads=%d", config.SMP.Threads))
|
||||||
}
|
}
|
||||||
|
|
||||||
if config.SMP.Sockets > 0 {
|
if config.SMP.Sockets > 0 {
|
||||||
SMPParams = append(SMPParams, fmt.Sprintf(",sockets=%d", config.SMP.Sockets))
|
SMPParams = append(SMPParams, fmt.Sprintf("sockets=%d", config.SMP.Sockets))
|
||||||
}
|
}
|
||||||
|
|
||||||
if config.SMP.MaxCPUs > 0 {
|
if config.SMP.MaxCPUs > 0 {
|
||||||
@ -2580,11 +2591,11 @@ func (config *Config) appendCPUs() error {
|
|||||||
return fmt.Errorf("MaxCPUs %d must be equal to or greater than CPUs %d",
|
return fmt.Errorf("MaxCPUs %d must be equal to or greater than CPUs %d",
|
||||||
config.SMP.MaxCPUs, config.SMP.CPUs)
|
config.SMP.MaxCPUs, config.SMP.CPUs)
|
||||||
}
|
}
|
||||||
SMPParams = append(SMPParams, fmt.Sprintf(",maxcpus=%d", config.SMP.MaxCPUs))
|
SMPParams = append(SMPParams, fmt.Sprintf("maxcpus=%d", config.SMP.MaxCPUs))
|
||||||
}
|
}
|
||||||
|
|
||||||
config.qemuParams = append(config.qemuParams, "-smp")
|
config.qemuParams = append(config.qemuParams, "-smp")
|
||||||
config.qemuParams = append(config.qemuParams, strings.Join(SMPParams, ""))
|
config.qemuParams = append(config.qemuParams, strings.Join(SMPParams, ","))
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
@ -2600,15 +2611,15 @@ func (config *Config) appendRTC() {
|
|||||||
RTCParams = append(RTCParams, fmt.Sprintf("base=%s", string(config.RTC.Base)))
|
RTCParams = append(RTCParams, fmt.Sprintf("base=%s", string(config.RTC.Base)))
|
||||||
|
|
||||||
if config.RTC.DriftFix != "" {
|
if config.RTC.DriftFix != "" {
|
||||||
RTCParams = append(RTCParams, fmt.Sprintf(",driftfix=%s", config.RTC.DriftFix))
|
RTCParams = append(RTCParams, fmt.Sprintf("driftfix=%s", config.RTC.DriftFix))
|
||||||
}
|
}
|
||||||
|
|
||||||
if config.RTC.Clock != "" {
|
if config.RTC.Clock != "" {
|
||||||
RTCParams = append(RTCParams, fmt.Sprintf(",clock=%s", config.RTC.Clock))
|
RTCParams = append(RTCParams, fmt.Sprintf("clock=%s", config.RTC.Clock))
|
||||||
}
|
}
|
||||||
|
|
||||||
config.qemuParams = append(config.qemuParams, "-rtc")
|
config.qemuParams = append(config.qemuParams, "-rtc")
|
||||||
config.qemuParams = append(config.qemuParams, strings.Join(RTCParams, ""))
|
config.qemuParams = append(config.qemuParams, strings.Join(RTCParams, ","))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (config *Config) appendGlobalParam() {
|
func (config *Config) appendGlobalParam() {
|
||||||
|
2
src/runtime/vendor/modules.txt
vendored
2
src/runtime/vendor/modules.txt
vendored
@ -221,7 +221,7 @@ github.com/hashicorp/errwrap
|
|||||||
# github.com/hashicorp/go-multierror v1.0.0
|
# github.com/hashicorp/go-multierror v1.0.0
|
||||||
## explicit
|
## explicit
|
||||||
github.com/hashicorp/go-multierror
|
github.com/hashicorp/go-multierror
|
||||||
# github.com/kata-containers/govmm v0.0.0-20210428163604-f0e9a35308ee
|
# github.com/kata-containers/govmm v0.0.0-20210722115311-0173713ea912
|
||||||
## explicit
|
## explicit
|
||||||
github.com/kata-containers/govmm/qemu
|
github.com/kata-containers/govmm/qemu
|
||||||
# github.com/konsorten/go-windows-terminal-sequences v1.0.1
|
# github.com/konsorten/go-windows-terminal-sequences v1.0.1
|
||||||
|
@ -126,6 +126,8 @@ const (
|
|||||||
qemuStopSandboxTimeoutSecs = 15
|
qemuStopSandboxTimeoutSecs = 15
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var noGuestMemHotplugErr error = errors.New("guest memory hotplug not supported")
|
||||||
|
|
||||||
// agnostic list of kernel parameters
|
// agnostic list of kernel parameters
|
||||||
var defaultKernelParameters = []Param{
|
var defaultKernelParameters = []Param{
|
||||||
{"panic", "1"},
|
{"panic", "1"},
|
||||||
@ -714,7 +716,8 @@ func (q *qemu) stopVirtiofsd(ctx context.Context) (err error) {
|
|||||||
|
|
||||||
// kill virtiofsd
|
// kill virtiofsd
|
||||||
if q.state.VirtiofsdPid == 0 {
|
if q.state.VirtiofsdPid == 0 {
|
||||||
return errors.New("invalid virtiofsd PID(0)")
|
q.Logger().Warn("The virtiofsd had stopped")
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
err = syscall.Kill(q.state.VirtiofsdPid, syscall.SIGKILL)
|
err = syscall.Kill(q.state.VirtiofsdPid, syscall.SIGKILL)
|
||||||
@ -1016,6 +1019,10 @@ func (q *qemu) stopSandbox(ctx context.Context, waitOnly bool) error {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if err := q.stopVirtiofsd(ctx); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1785,7 +1792,7 @@ func (q *qemu) hotplugRemoveCPUs(amount uint32) (uint32, error) {
|
|||||||
func (q *qemu) hotplugMemory(memDev *memoryDevice, op operation) (int, error) {
|
func (q *qemu) hotplugMemory(memDev *memoryDevice, op operation) (int, error) {
|
||||||
|
|
||||||
if !q.arch.supportGuestMemoryHotplug() {
|
if !q.arch.supportGuestMemoryHotplug() {
|
||||||
return 0, fmt.Errorf("guest memory hotplug not supported")
|
return 0, noGuestMemHotplugErr
|
||||||
}
|
}
|
||||||
if memDev.sizeMB < 0 {
|
if memDev.sizeMB < 0 {
|
||||||
return 0, fmt.Errorf("cannot hotplug negative size (%d) memory", memDev.sizeMB)
|
return 0, fmt.Errorf("cannot hotplug negative size (%d) memory", memDev.sizeMB)
|
||||||
|
@ -153,6 +153,7 @@ func TestQemuAmd64AppendImage(t *testing.T) {
|
|||||||
ID: "mem0",
|
ID: "mem0",
|
||||||
MemPath: f.Name(),
|
MemPath: f.Name(),
|
||||||
Size: (uint64)(imageStat.Size()),
|
Size: (uint64)(imageStat.Size()),
|
||||||
|
ReadOnly: true,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -378,6 +378,7 @@ func (q *qemuArchBase) appendNvdimmImage(devices []govmmQemu.Device, path string
|
|||||||
ID: "mem0",
|
ID: "mem0",
|
||||||
MemPath: path,
|
MemPath: path,
|
||||||
Size: (uint64)(imageStat.Size()),
|
Size: (uint64)(imageStat.Size()),
|
||||||
|
ReadOnly: true,
|
||||||
}
|
}
|
||||||
|
|
||||||
devices = append(devices, object)
|
devices = append(devices, object)
|
||||||
|
@ -1711,6 +1711,11 @@ func (s *Sandbox) HotplugRemoveDevice(ctx context.Context, device api.Device, de
|
|||||||
if !ok {
|
if !ok {
|
||||||
return fmt.Errorf("device type mismatch, expect device type to be %s", devType)
|
return fmt.Errorf("device type mismatch, expect device type to be %s", devType)
|
||||||
}
|
}
|
||||||
|
// PMEM devices cannot be hot removed
|
||||||
|
if blockDrive.Pmem {
|
||||||
|
s.Logger().WithField("path", blockDrive.File).Infof("Skip device: cannot hot remove PMEM devices")
|
||||||
|
return nil
|
||||||
|
}
|
||||||
_, err := s.hypervisor.hotplugRemoveDevice(ctx, blockDrive, blockDev)
|
_, err := s.hypervisor.hotplugRemoveDevice(ctx, blockDrive, blockDev)
|
||||||
return err
|
return err
|
||||||
case config.VhostUserBlk:
|
case config.VhostUserBlk:
|
||||||
@ -1836,7 +1841,11 @@ func (s *Sandbox) updateResources(ctx context.Context) error {
|
|||||||
s.Logger().WithField("memory-sandbox-size-byte", sandboxMemoryByte).Debugf("Request to hypervisor to update memory")
|
s.Logger().WithField("memory-sandbox-size-byte", sandboxMemoryByte).Debugf("Request to hypervisor to update memory")
|
||||||
newMemory, updatedMemoryDevice, err := s.hypervisor.resizeMemory(ctx, uint32(sandboxMemoryByte>>utils.MibToBytesShift), s.state.GuestMemoryBlockSizeMB, s.state.GuestMemoryHotplugProbe)
|
newMemory, updatedMemoryDevice, err := s.hypervisor.resizeMemory(ctx, uint32(sandboxMemoryByte>>utils.MibToBytesShift), s.state.GuestMemoryBlockSizeMB, s.state.GuestMemoryHotplugProbe)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
if err == noGuestMemHotplugErr {
|
||||||
|
s.Logger().Warnf("%s, memory specifications cannot be guaranteed", err)
|
||||||
|
} else {
|
||||||
|
return err
|
||||||
|
}
|
||||||
}
|
}
|
||||||
s.Logger().Debugf("Sandbox memory size: %d MB", newMemory)
|
s.Logger().Debugf("Sandbox memory size: %d MB", newMemory)
|
||||||
if s.state.GuestMemoryHotplugProbe && updatedMemoryDevice.addr != 0 {
|
if s.state.GuestMemoryHotplugProbe && updatedMemoryDevice.addr != 0 {
|
||||||
|
@ -34,7 +34,6 @@ RUN yum -y update && yum install -y \
|
|||||||
vim \
|
vim \
|
||||||
which
|
which
|
||||||
|
|
||||||
|
# This will install the proper packages to build Kata components
|
||||||
@INSTALL_MUSL@
|
@INSTALL_MUSL@
|
||||||
# This will install the proper golang to build Kata components
|
|
||||||
@INSTALL_GO@
|
|
||||||
@INSTALL_RUST@
|
@INSTALL_RUST@
|
||||||
|
@ -37,7 +37,6 @@ RUN dnf -y update && dnf install -y \
|
|||||||
vim \
|
vim \
|
||||||
which
|
which
|
||||||
|
|
||||||
# This will install the proper golang to build Kata components
|
# This will install the proper packages to build Kata components
|
||||||
@INSTALL_MUSL@
|
@INSTALL_MUSL@
|
||||||
@INSTALL_GO@
|
|
||||||
@INSTALL_RUST@
|
@INSTALL_RUST@
|
||||||
|
@ -29,7 +29,6 @@ RUN apt-get update && apt-get install -y \
|
|||||||
systemd \
|
systemd \
|
||||||
tar \
|
tar \
|
||||||
vim
|
vim
|
||||||
# This will install the proper golang to build Kata components
|
# This will install the proper packages to build Kata components
|
||||||
@INSTALL_GO@
|
|
||||||
@INSTALL_MUSL@
|
@INSTALL_MUSL@
|
||||||
@INSTALL_RUST@
|
@INSTALL_RUST@
|
||||||
|
@ -36,6 +36,5 @@ RUN apt-get update && apt-get --no-install-recommends install -y \
|
|||||||
vim \
|
vim \
|
||||||
wget
|
wget
|
||||||
|
|
||||||
# This will install the proper golang to build Kata components
|
# This will install the proper packages to build Kata components
|
||||||
@INSTALL_GO@
|
|
||||||
@INSTALL_RUST@
|
@INSTALL_RUST@
|
||||||
|
@ -37,7 +37,6 @@ RUN dnf -y update && dnf install -y \
|
|||||||
vim \
|
vim \
|
||||||
which
|
which
|
||||||
|
|
||||||
# This will install the proper golang to build Kata components
|
# This will install the proper packages to build Kata components
|
||||||
@INSTALL_MUSL@
|
@INSTALL_MUSL@
|
||||||
@INSTALL_GO@
|
|
||||||
@INSTALL_RUST@
|
@INSTALL_RUST@
|
||||||
|
@ -9,6 +9,5 @@ FROM ${IMAGE_REGISTRY}/gentoo/stage3-amd64:latest
|
|||||||
# This dockerfile needs to provide all the componets need to build a rootfs
|
# This dockerfile needs to provide all the componets need to build a rootfs
|
||||||
# Install any package need to create a rootfs (package manager, extra tools)
|
# Install any package need to create a rootfs (package manager, extra tools)
|
||||||
|
|
||||||
# This will install the proper golang to build Kata components
|
# This will install the proper rust to build Kata components
|
||||||
@INSTALL_GO@
|
|
||||||
@INSTALL_RUST@
|
@INSTALL_RUST@
|
||||||
|
@ -13,9 +13,6 @@ set -o errtrace
|
|||||||
script_name="${0##*/}"
|
script_name="${0##*/}"
|
||||||
script_dir="$(dirname $(readlink -f $0))"
|
script_dir="$(dirname $(readlink -f $0))"
|
||||||
AGENT_VERSION=${AGENT_VERSION:-}
|
AGENT_VERSION=${AGENT_VERSION:-}
|
||||||
GO_AGENT_PKG=${GO_AGENT_PKG:-github.com/kata-containers/agent}
|
|
||||||
RUST_AGENT_PKG=${RUST_AGENT_PKG:-github.com/kata-containers/kata-containers}
|
|
||||||
RUST_AGENT=${RUST_AGENT:-yes}
|
|
||||||
RUST_VERSION="null"
|
RUST_VERSION="null"
|
||||||
MUSL_VERSION=${MUSL_VERSION:-"null"}
|
MUSL_VERSION=${MUSL_VERSION:-"null"}
|
||||||
AGENT_BIN=${AGENT_BIN:-kata-agent}
|
AGENT_BIN=${AGENT_BIN:-kata-agent}
|
||||||
@ -23,7 +20,7 @@ AGENT_INIT=${AGENT_INIT:-no}
|
|||||||
KERNEL_MODULES_DIR=${KERNEL_MODULES_DIR:-""}
|
KERNEL_MODULES_DIR=${KERNEL_MODULES_DIR:-""}
|
||||||
OSBUILDER_VERSION="unknown"
|
OSBUILDER_VERSION="unknown"
|
||||||
DOCKER_RUNTIME=${DOCKER_RUNTIME:-runc}
|
DOCKER_RUNTIME=${DOCKER_RUNTIME:-runc}
|
||||||
GO_VERSION="null"
|
# this GOPATH is for installing yq from install_yq.sh
|
||||||
export GOPATH=${GOPATH:-${HOME}/go}
|
export GOPATH=${GOPATH:-${HOME}/go}
|
||||||
LIBC=${LIBC:-musl}
|
LIBC=${LIBC:-musl}
|
||||||
|
|
||||||
@ -113,9 +110,6 @@ DISTRO_REPO Use host repositories to install guest packages.
|
|||||||
DOCKER_RUNTIME Docker runtime to use when USE_DOCKER is set.
|
DOCKER_RUNTIME Docker runtime to use when USE_DOCKER is set.
|
||||||
Default value: runc
|
Default value: runc
|
||||||
|
|
||||||
GO_AGENT_PKG URL of the Git repository hosting the agent package.
|
|
||||||
Default value: ${GO_AGENT_PKG}
|
|
||||||
|
|
||||||
GRACEFUL_EXIT If set, and if the DISTRO configuration specifies a
|
GRACEFUL_EXIT If set, and if the DISTRO configuration specifies a
|
||||||
non-empty BUILD_CAN_FAIL variable, do not return with an
|
non-empty BUILD_CAN_FAIL variable, do not return with an
|
||||||
error code in case any of the build step fails.
|
error code in case any of the build step fails.
|
||||||
@ -134,12 +128,6 @@ KERNEL_MODULES_DIR Path to a directory containing kernel modules to include in
|
|||||||
ROOTFS_DIR Path to the directory that is populated with the rootfs.
|
ROOTFS_DIR Path to the directory that is populated with the rootfs.
|
||||||
Default value: <${script_name} path>/rootfs-<DISTRO-name>
|
Default value: <${script_name} path>/rootfs-<DISTRO-name>
|
||||||
|
|
||||||
RUST_AGENT When set to "no", build kata-agent from go agent instead of kata-rust-agent
|
|
||||||
Default value: "yes"
|
|
||||||
|
|
||||||
RUST_AGENT_PKG URL of the Git repository hosting the agent package.
|
|
||||||
Default value: ${RUST_AGENT_PKG}
|
|
||||||
|
|
||||||
USE_DOCKER If set, build the rootfs inside a container (requires
|
USE_DOCKER If set, build the rootfs inside a container (requires
|
||||||
Docker).
|
Docker).
|
||||||
Default value: <not set>
|
Default value: <not set>
|
||||||
@ -291,17 +279,11 @@ compare_versions()
|
|||||||
|
|
||||||
check_env_variables()
|
check_env_variables()
|
||||||
{
|
{
|
||||||
# Fetch the first element from GOPATH as working directory
|
# this will be mounted to container for using yq on the host side.
|
||||||
# as go get only works against the first item in the GOPATH
|
|
||||||
[ -z "$GOPATH" ] && die "GOPATH not set"
|
|
||||||
GOPATH_LOCAL="${GOPATH%%:*}"
|
GOPATH_LOCAL="${GOPATH%%:*}"
|
||||||
|
|
||||||
[ "$AGENT_INIT" == "yes" -o "$AGENT_INIT" == "no" ] || die "AGENT_INIT($AGENT_INIT) is invalid (must be yes or no)"
|
[ "$AGENT_INIT" == "yes" -o "$AGENT_INIT" == "no" ] || die "AGENT_INIT($AGENT_INIT) is invalid (must be yes or no)"
|
||||||
|
|
||||||
if [ -z "${AGENT_SOURCE_BIN}" ]; then
|
|
||||||
[ "$RUST_AGENT" == "yes" -o "$RUST_AGENT" == "no" ] || die "RUST_AGENT($RUST_AGENT) is invalid (must be yes or no)"
|
|
||||||
fi
|
|
||||||
|
|
||||||
[ -n "${KERNEL_MODULES_DIR}" ] && [ ! -d "${KERNEL_MODULES_DIR}" ] && die "KERNEL_MODULES_DIR defined but is not an existing directory"
|
[ -n "${KERNEL_MODULES_DIR}" ] && [ ! -d "${KERNEL_MODULES_DIR}" ] && die "KERNEL_MODULES_DIR defined but is not an existing directory"
|
||||||
|
|
||||||
[ -n "${OSBUILDER_VERSION}" ] || die "need osbuilder version"
|
[ -n "${OSBUILDER_VERSION}" ] || die "need osbuilder version"
|
||||||
@ -346,24 +328,18 @@ build_rootfs_distro()
|
|||||||
|
|
||||||
mkdir -p ${ROOTFS_DIR}
|
mkdir -p ${ROOTFS_DIR}
|
||||||
|
|
||||||
detect_go_version ||
|
|
||||||
die "Could not detect the required Go version for AGENT_VERSION='${AGENT_VERSION:-master}'."
|
|
||||||
|
|
||||||
echo "Required Go version: $GO_VERSION"
|
|
||||||
|
|
||||||
# need to detect rustc's version too?
|
# need to detect rustc's version too?
|
||||||
detect_rust_version ||
|
detect_rust_version ||
|
||||||
die "Could not detect the required rust version for AGENT_VERSION='${AGENT_VERSION:-master}'."
|
die "Could not detect the required rust version for AGENT_VERSION='${AGENT_VERSION:-main}'."
|
||||||
|
|
||||||
echo "Required rust version: $RUST_VERSION"
|
echo "Required rust version: $RUST_VERSION"
|
||||||
|
|
||||||
detect_musl_version ||
|
detect_musl_version ||
|
||||||
die "Could not detect the required musl version for AGENT_VERSION='${AGENT_VERSION:-master}'."
|
die "Could not detect the required musl version for AGENT_VERSION='${AGENT_VERSION:-main}'."
|
||||||
|
|
||||||
echo "Required musl version: $MUSL_VERSION"
|
echo "Required musl version: $MUSL_VERSION"
|
||||||
|
|
||||||
if [ -z "${USE_DOCKER}" ] && [ -z "${USE_PODMAN}" ]; then
|
if [ -z "${USE_DOCKER}" ] && [ -z "${USE_PODMAN}" ]; then
|
||||||
#Generate an error if the local Go version is too old
|
|
||||||
info "build directly"
|
info "build directly"
|
||||||
build_rootfs ${ROOTFS_DIR}
|
build_rootfs ${ROOTFS_DIR}
|
||||||
else
|
else
|
||||||
@ -380,7 +356,7 @@ build_rootfs_distro()
|
|||||||
REGISTRY_ARG="--build-arg IMAGE_REGISTRY=${IMAGE_REGISTRY}"
|
REGISTRY_ARG="--build-arg IMAGE_REGISTRY=${IMAGE_REGISTRY}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# setup to install go or rust here
|
# setup to install rust here
|
||||||
generate_dockerfile "${distro_config_dir}"
|
generate_dockerfile "${distro_config_dir}"
|
||||||
"$container_engine" build \
|
"$container_engine" build \
|
||||||
${REGISTRY_ARG} \
|
${REGISTRY_ARG} \
|
||||||
@ -396,12 +372,7 @@ build_rootfs_distro()
|
|||||||
docker_run_args+=" --runtime ${DOCKER_RUNTIME}"
|
docker_run_args+=" --runtime ${DOCKER_RUNTIME}"
|
||||||
|
|
||||||
if [ -z "${AGENT_SOURCE_BIN}" ] ; then
|
if [ -z "${AGENT_SOURCE_BIN}" ] ; then
|
||||||
if [ "$RUST_AGENT" == "no" ]; then
|
docker_run_args+=" -v ${GOPATH_LOCAL}:${GOPATH_LOCAL} --env GOPATH=${GOPATH_LOCAL}"
|
||||||
docker_run_args+=" --env GO_AGENT_PKG=${GO_AGENT_PKG}"
|
|
||||||
else
|
|
||||||
docker_run_args+=" --env RUST_AGENT_PKG=${RUST_AGENT_PKG}"
|
|
||||||
fi
|
|
||||||
docker_run_args+=" --env RUST_AGENT=${RUST_AGENT} -v ${GOPATH_LOCAL}:${GOPATH_LOCAL} --env GOPATH=${GOPATH_LOCAL}"
|
|
||||||
else
|
else
|
||||||
docker_run_args+=" --env AGENT_SOURCE_BIN=${AGENT_SOURCE_BIN}"
|
docker_run_args+=" --env AGENT_SOURCE_BIN=${AGENT_SOURCE_BIN}"
|
||||||
docker_run_args+=" -v ${AGENT_SOURCE_BIN}:${AGENT_SOURCE_BIN}"
|
docker_run_args+=" -v ${AGENT_SOURCE_BIN}:${AGENT_SOURCE_BIN}"
|
||||||
@ -577,7 +548,6 @@ EOT
|
|||||||
test -r "${HOME}/.cargo/env" && source "${HOME}/.cargo/env"
|
test -r "${HOME}/.cargo/env" && source "${HOME}/.cargo/env"
|
||||||
[ "$ARCH" == "aarch64" ] && OLD_PATH=$PATH && export PATH=$PATH:/usr/local/musl/bin
|
[ "$ARCH" == "aarch64" ] && OLD_PATH=$PATH && export PATH=$PATH:/usr/local/musl/bin
|
||||||
|
|
||||||
agent_pkg="${RUST_AGENT_PKG}"
|
|
||||||
agent_dir="${script_dir}/../../../src/agent/"
|
agent_dir="${script_dir}/../../../src/agent/"
|
||||||
# For now, rust-agent doesn't support seccomp yet.
|
# For now, rust-agent doesn't support seccomp yet.
|
||||||
SECCOMP="no"
|
SECCOMP="no"
|
||||||
|
@ -15,7 +15,6 @@ COPY install-packages.sh config.sh /
|
|||||||
# RUN commands
|
# RUN commands
|
||||||
RUN chmod +x /install-packages.sh; /install-packages.sh
|
RUN chmod +x /install-packages.sh; /install-packages.sh
|
||||||
|
|
||||||
# This will install the proper golang to build Kata components
|
# This will install the proper packages to build Kata components
|
||||||
@INSTALL_MUSL@
|
@INSTALL_MUSL@
|
||||||
@INSTALL_GO@
|
|
||||||
@INSTALL_RUST@
|
@INSTALL_RUST@
|
||||||
|
@ -13,5 +13,6 @@ FROM ${IMAGE_REGISTRY}/@distro@:@OS_VERSION@
|
|||||||
|
|
||||||
# RUN commands
|
# RUN commands
|
||||||
|
|
||||||
# This will install the proper golang to build Kata components
|
# This will install the proper packages to build Kata components
|
||||||
@INSTALL_GO@
|
@INSTALL_MUSL@
|
||||||
|
@INSTALL_RUST@
|
||||||
|
@ -33,7 +33,6 @@ RUN apt-get update && apt-get install -y \
|
|||||||
systemd \
|
systemd \
|
||||||
tar \
|
tar \
|
||||||
vim
|
vim
|
||||||
# This will install the proper golang to build Kata components
|
# This will install the proper packages to build Kata components
|
||||||
@INSTALL_GO@
|
|
||||||
@INSTALL_MUSL@
|
@INSTALL_MUSL@
|
||||||
@INSTALL_RUST@
|
@INSTALL_RUST@
|
||||||
|
@ -40,6 +40,6 @@ RUN apt-get update && apt-get --no-install-recommends install -y \
|
|||||||
tar \
|
tar \
|
||||||
vim \
|
vim \
|
||||||
wget
|
wget
|
||||||
# This will install the proper golang to build Kata components
|
|
||||||
@INSTALL_GO@
|
# This will install the proper packages to build Kata components
|
||||||
@INSTALL_RUST@
|
@INSTALL_RUST@
|
||||||
|
@ -150,6 +150,8 @@ build_rootfs()
|
|||||||
else
|
else
|
||||||
DNF="${DNF} --releasever=${OS_VERSION}"
|
DNF="${DNF} --releasever=${OS_VERSION}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
info "install packages for rootfs"
|
||||||
$DNF install ${EXTRA_PKGS} ${PACKAGES}
|
$DNF install ${EXTRA_PKGS} ${PACKAGES}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -190,14 +192,8 @@ create_summary_file()
|
|||||||
local agent="${AGENT_DEST}"
|
local agent="${AGENT_DEST}"
|
||||||
[ "$AGENT_INIT" = yes ] && agent="${init}"
|
[ "$AGENT_INIT" = yes ] && agent="${init}"
|
||||||
|
|
||||||
local agent_version
|
local -r agentdir="${script_dir}/../../../"
|
||||||
if [ "${RUST_AGENT}" == "no" ]; then
|
local -r agent_version=$(cat ${agentdir}/VERSION)
|
||||||
agent_version=$("$agent" --version|awk '{print $NF}')
|
|
||||||
else
|
|
||||||
local -r agentdir="${script_dir}/../../../"
|
|
||||||
agent_version=$(cat ${agentdir}/VERSION)
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
cat >"$file"<<-EOT
|
cat >"$file"<<-EOT
|
||||||
---
|
---
|
||||||
@ -241,37 +237,20 @@ generate_dockerfile()
|
|||||||
local libc=musl
|
local libc=musl
|
||||||
case "$(uname -m)" in
|
case "$(uname -m)" in
|
||||||
"ppc64le")
|
"ppc64le")
|
||||||
goarch=ppc64le
|
|
||||||
rustarch=powerpc64le
|
rustarch=powerpc64le
|
||||||
muslarch=powerpc64
|
muslarch=powerpc64
|
||||||
libc=gnu
|
libc=gnu
|
||||||
;;
|
;;
|
||||||
|
|
||||||
"aarch64")
|
|
||||||
goarch=arm64
|
|
||||||
;;
|
|
||||||
"s390x")
|
"s390x")
|
||||||
goarch=s390x
|
|
||||||
libc=gnu
|
libc=gnu
|
||||||
;;
|
;;
|
||||||
|
|
||||||
*)
|
*)
|
||||||
goarch=amd64
|
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
[ -n "${http_proxy:-}" ] && readonly set_proxy="RUN sed -i '$ a proxy="${http_proxy:-}"' /etc/dnf/dnf.conf /etc/yum.conf; true"
|
[ -n "${http_proxy:-}" ] && readonly set_proxy="RUN sed -i '$ a proxy="${http_proxy:-}"' /etc/dnf/dnf.conf /etc/yum.conf; true"
|
||||||
|
|
||||||
curlOptions=("-OL")
|
|
||||||
[ -n "${http_proxy:-}" ] && curlOptions+=("-x ${http_proxy:-}")
|
|
||||||
|
|
||||||
readonly install_go="
|
|
||||||
RUN cd /tmp ; curl ${curlOptions[@]} https://storage.googleapis.com/golang/go${GO_VERSION}.linux-${goarch}.tar.gz
|
|
||||||
RUN tar -C /usr/ -xzf /tmp/go${GO_VERSION}.linux-${goarch}.tar.gz
|
|
||||||
ENV GOROOT=/usr/go
|
|
||||||
ENV PATH=\$PATH:\$GOROOT/bin:\$GOPATH/bin
|
|
||||||
"
|
|
||||||
|
|
||||||
# Rust agent
|
# Rust agent
|
||||||
# rust installer should set path apropiately, just in case
|
# rust installer should set path apropiately, just in case
|
||||||
# install musl for compiling rust-agent
|
# install musl for compiling rust-agent
|
||||||
@ -327,8 +306,6 @@ RUN . /root/.cargo/env; \
|
|||||||
rustup target install ${rustarch}-unknown-linux-${libc}
|
rustup target install ${rustarch}-unknown-linux-${libc}
|
||||||
RUN ln -sf /usr/bin/g++ /bin/musl-g++
|
RUN ln -sf /usr/bin/g++ /bin/musl-g++
|
||||||
"
|
"
|
||||||
# rust agent still need go to build
|
|
||||||
# because grpc-sys need go to build
|
|
||||||
pushd "${dir}"
|
pushd "${dir}"
|
||||||
dockerfile_template="Dockerfile.in"
|
dockerfile_template="Dockerfile.in"
|
||||||
dockerfile_arch_template="Dockerfile-${architecture}.in"
|
dockerfile_arch_template="Dockerfile-${architecture}.in"
|
||||||
@ -344,10 +321,8 @@ RUN ln -sf /usr/bin/g++ /bin/musl-g++
|
|||||||
# also long double representation problem when building musl-libc
|
# also long double representation problem when building musl-libc
|
||||||
if [ "${architecture}" == "ppc64le" ]; then
|
if [ "${architecture}" == "ppc64le" ]; then
|
||||||
sed \
|
sed \
|
||||||
-e "s|@GO_VERSION@|${GO_VERSION}|g" \
|
|
||||||
-e "s|@OS_VERSION@|${OS_VERSION:-}|g" \
|
-e "s|@OS_VERSION@|${OS_VERSION:-}|g" \
|
||||||
-e "s|@INSTALL_MUSL@||g" \
|
-e "s|@INSTALL_MUSL@||g" \
|
||||||
-e "s|@INSTALL_GO@|${install_go//$'\n'/\\n}|g" \
|
|
||||||
-e "s|@INSTALL_RUST@|${install_rust//$'\n'/\\n}|g" \
|
-e "s|@INSTALL_RUST@|${install_rust//$'\n'/\\n}|g" \
|
||||||
-e "s|@SET_PROXY@|${set_proxy:-}|g" \
|
-e "s|@SET_PROXY@|${set_proxy:-}|g" \
|
||||||
"${dockerfile_template}" > Dockerfile
|
"${dockerfile_template}" > Dockerfile
|
||||||
@ -364,10 +339,8 @@ RUN ln -sf /usr/bin/g++ /bin/musl-g++
|
|||||||
"${dockerfile_template}" > Dockerfile
|
"${dockerfile_template}" > Dockerfile
|
||||||
else
|
else
|
||||||
sed \
|
sed \
|
||||||
-e "s|@GO_VERSION@|${GO_VERSION}|g" \
|
|
||||||
-e "s|@OS_VERSION@|${OS_VERSION:-}|g" \
|
-e "s|@OS_VERSION@|${OS_VERSION:-}|g" \
|
||||||
-e "s|@INSTALL_MUSL@|${install_musl//$'\n'/\\n}|g" \
|
-e "s|@INSTALL_MUSL@|${install_musl//$'\n'/\\n}|g" \
|
||||||
-e "s|@INSTALL_GO@|${install_go//$'\n'/\\n}|g" \
|
|
||||||
-e "s|@INSTALL_RUST@|${install_rust//$'\n'/\\n}|g" \
|
-e "s|@INSTALL_RUST@|${install_rust//$'\n'/\\n}|g" \
|
||||||
-e "s|@SET_PROXY@|${set_proxy:-}|g" \
|
-e "s|@SET_PROXY@|${set_proxy:-}|g" \
|
||||||
"${dockerfile_template}" > Dockerfile
|
"${dockerfile_template}" > Dockerfile
|
||||||
@ -375,46 +348,52 @@ RUN ln -sf /usr/bin/g++ /bin/musl-g++
|
|||||||
popd
|
popd
|
||||||
}
|
}
|
||||||
|
|
||||||
detect_go_version()
|
get_package_version_from_kata_yaml()
|
||||||
{
|
{
|
||||||
info "Detecting go version"
|
local yq_path="$1"
|
||||||
typeset yq=$(command -v yq || command -v ${GOPATH}/bin/yq || echo "${GOPATH}/bin/yq")
|
local yq_version
|
||||||
|
local yq_args
|
||||||
|
|
||||||
|
typeset -r yq=$(command -v yq || command -v "${GOPATH}/bin/yq" || echo "${GOPATH}/bin/yq")
|
||||||
if [ ! -f "$yq" ]; then
|
if [ ! -f "$yq" ]; then
|
||||||
source "$yq_file"
|
source "$yq_file"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
info "Get Go version from ${kata_versions_file}"
|
yq_version=$($yq -V)
|
||||||
GO_VERSION="$(cat "${kata_versions_file}" | $yq r -X - "languages.golang.meta.newest-version")"
|
case $yq_version in
|
||||||
|
*"version "[1-3]*)
|
||||||
|
yq_args="r -X - ${yq_path}"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
yq_args="e .${yq_path} -"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
[ "$?" == "0" ] && [ "$GO_VERSION" != "null" ]
|
PKG_VERSION="$(cat "${kata_versions_file}" | $yq ${yq_args})"
|
||||||
|
|
||||||
|
[ "$?" == "0" ] && [ "$PKG_VERSION" != "null" ] && echo "$PKG_VERSION" || echo ""
|
||||||
}
|
}
|
||||||
|
|
||||||
detect_rust_version()
|
detect_rust_version()
|
||||||
{
|
{
|
||||||
info "Detecting agent rust version"
|
info "Detecting agent rust version"
|
||||||
typeset -r yq=$(command -v yq || command -v "${GOPATH}/bin/yq" || echo "${GOPATH}/bin/yq")
|
local yq_path="languages.rust.meta.newest-version"
|
||||||
if [ ! -f "$yq" ]; then
|
|
||||||
source "$yq_file"
|
|
||||||
fi
|
|
||||||
|
|
||||||
info "Get rust version from ${kata_versions_file}"
|
info "Get rust version from ${kata_versions_file}"
|
||||||
RUST_VERSION="$(cat "${kata_versions_file}" | $yq r -X - "languages.rust.meta.newest-version")"
|
RUST_VERSION="$(get_package_version_from_kata_yaml "$yq_path")"
|
||||||
|
|
||||||
[ "$?" == "0" ] && [ "$RUST_VERSION" != "null" ]
|
[ -n "$RUST_VERSION" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
detect_musl_version()
|
detect_musl_version()
|
||||||
{
|
{
|
||||||
info "Detecting musl version"
|
info "Detecting musl version"
|
||||||
typeset -r yq=$(command -v yq || command -v "${GOPATH}/bin/yq" || echo "${GOPATH}/bin/yq")
|
local yq_path="externals.musl.version"
|
||||||
if [ ! -f "$yq" ]; then
|
|
||||||
source "$yq_file"
|
|
||||||
fi
|
|
||||||
|
|
||||||
info "Get musl version from ${kata_versions_file}"
|
info "Get musl version from ${kata_versions_file}"
|
||||||
MUSL_VERSION="$(cat "${kata_versions_file}" | $yq r -X - "externals.musl.version")"
|
MUSL_VERSION="$(get_package_version_from_kata_yaml "$yq_path")"
|
||||||
|
|
||||||
[ "$?" == "0" ] && [ "$MUSL_VERSION" != "null" ]
|
[ -n "$MUSL_VERSION" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
before_starting_container() {
|
before_starting_container() {
|
||||||
|
@ -184,11 +184,11 @@ externals:
|
|||||||
cri-containerd:
|
cri-containerd:
|
||||||
description: |
|
description: |
|
||||||
Containerd Plugin for Kubernetes Container Runtime Interface.
|
Containerd Plugin for Kubernetes Container Runtime Interface.
|
||||||
url: "github.com/containerd/cri"
|
url: "github.com/containerd/containerd"
|
||||||
tarball_url: "https://storage.googleapis.com/cri-containerd-release"
|
tarball_url: "https://github.com/containerd/containerd/releases/download"
|
||||||
# Next commit from 1.3 branch contains fix to be able to run
|
# Next commit from 1.3 branch contains fix to be able to run
|
||||||
# tests using go 1.13
|
# tests using go 1.13
|
||||||
version: "v1.3.7"
|
version: "v1.3.10"
|
||||||
|
|
||||||
critools:
|
critools:
|
||||||
description: "CLI tool for Container Runtime Interface (CRI)"
|
description: "CLI tool for Container Runtime Interface (CRI)"
|
||||||
|
Loading…
Reference in New Issue
Block a user