runtime-rs: fix some variable names and typos

Fix some not perfect variable names, and some typos in logs.

Fixes: #5820

Signed-off-by: Bin Liu <bin@hyper.sh>
This commit is contained in:
Bin Liu 2022-12-02 14:52:34 +08:00
parent 8246de821f
commit fb2c142f18
5 changed files with 13 additions and 9 deletions

View File

@ -200,12 +200,16 @@ impl RuntimeHandlerManager {
} }
pub async fn handler_message(&self, req: Request) -> Result<Response> { pub async fn handler_message(&self, req: Request) -> Result<Response> {
if let Request::CreateContainer(req) = req { if let Request::CreateContainer(container_config) = req {
// get oci spec // get oci spec
let bundler_path = format!("{}/{}", req.bundle, oci::OCI_SPEC_CONFIG_FILE_NAME); let bundler_path = format!(
"{}/{}",
container_config.bundle,
oci::OCI_SPEC_CONFIG_FILE_NAME
);
let spec = oci::Spec::load(&bundler_path).context("load spec")?; let spec = oci::Spec::load(&bundler_path).context("load spec")?;
self.try_init_runtime_instance(&spec, &req.options) self.try_init_runtime_instance(&spec, &container_config.options)
.await .await
.context("try init runtime instance")?; .context("try init runtime instance")?;
let instance = self let instance = self
@ -215,7 +219,7 @@ impl RuntimeHandlerManager {
let shim_pid = instance let shim_pid = instance
.container_manager .container_manager
.create_container(req, spec) .create_container(container_config, spec)
.await .await
.context("create container")?; .context("create container")?;

View File

@ -93,8 +93,8 @@ impl Container {
// update rootfs // update rootfs
match spec.root.as_mut() { match spec.root.as_mut() {
Some(spec) => { Some(root) => {
spec.path = rootfs root.path = rootfs
.get_guest_rootfs_path() .get_guest_rootfs_path()
.await .await
.context("get guest rootfs path")? .context("get guest rootfs path")?

View File

@ -253,7 +253,7 @@ impl ContainerManager for VirtContainerManager {
let c = containers let c = containers
.get(container_id) .get(container_id)
.ok_or_else(|| Error::ContainerNotFound(container_id.to_string()))?; .ok_or_else(|| Error::ContainerNotFound(container_id.to_string()))?;
c.update(&resource).await.context("stats") c.update(&resource).await.context("update_container")
} }
async fn pid(&self) -> Result<PID> { async fn pid(&self) -> Result<PID> {

View File

@ -65,7 +65,7 @@ async fn send_event(
&namespace, &namespace,
]) ])
.spawn() .spawn()
.context("sawn cmd")?; .context("spawn containerd cmd to publish event")?;
let stdin = child.stdin.as_mut().context("failed to open stdin")?; let stdin = child.stdin.as_mut().context("failed to open stdin")?;
stdin stdin

View File

@ -40,7 +40,7 @@ where
let r = req let r = req
.try_into() .try_into()
.map_err(|err| ttrpc::Error::Others(format!("failed to translate from shim {:?}", err)))?; .map_err(|err| ttrpc::Error::Others(format!("failed to translate from shim {:?}", err)))?;
let logger = sl!().new(o!("steam id" => ctx.mh.stream_id)); let logger = sl!().new(o!("stream id" => ctx.mh.stream_id));
debug!(logger, "====> task service {:?}", &r); debug!(logger, "====> task service {:?}", &r);
let resp = s let resp = s
.handler_message(r) .handler_message(r)