Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wasm: bump wasmedge to 0.13.2 #139

Merged
merged 2 commits into from
Jul 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
include:
- directories: wasm
features: --features=wasmedge
wasmEdge: 0.11.2
wasmEdge: 0.13.5
- directories: wasm
features: --features=wasmtime
runs-on: ubuntu-latest
Expand Down Expand Up @@ -54,7 +54,7 @@ jobs:
include:
- directories: wasm
features: --features=wasmedge
wasmEdge: 0.11.2
wasmEdge: 0.13.5
- directories: wasm
features: --features=wasmtime
runs-on: ubuntu-latest
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ jobs:
features: ["wasmedge"]
include:
- features: wasmedge
version: 0.11.2
version: 0.13.5
runs-on: ubuntu-22.04
timeout-minutes: 10
steps:
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ Please also note that Quark requires a Linux kernel version >= 5.15.
+ It is recommended to install Cloud Hypervisor by default. You can find Cloud Hypervisor installation instructions [here](https://github.com/cloud-hypervisor/cloud-hypervisor/blob/main/docs/building.md).
+ If you want to run kuasar with iSulad container engine and StratoVirt hypervisor, you can refer to this guide [how-to-run-kuasar-with-isulad-and-stratovirt](docs/vmm/how-to-run-kuasar-with-isulad-and-stratovirt.md).
+ Quark: To use Quark, please refer to the installation instructions [here](docs/quark/README.md).
+ WasmEdge: To start WebAssembly sandboxes, you need to install WasmEdge v0.11.2. Instructions for installing WasmEdge can be found in [install.html](https://wasmedge.org/book/en/quick_start/install.html).
+ WasmEdge: To start WebAssembly sandboxes, you need to install WasmEdge v0.13.5. Instructions for installing WasmEdge can be found in [install.html](https://wasmedge.org/book/en/quick_start/install.html).

### 3. containerd

Expand Down
15 changes: 4 additions & 11 deletions runc/src/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ use runc::{
pub const INIT_PID_FILE: &str = "init.pid";

pub struct ProcessIO {
pub uri: Option<String>,
pub io: Option<Arc<dyn Io>>,
pub copy: bool,
}
Expand All @@ -56,28 +55,22 @@ pub fn create_io(
if stdio.is_null() {
let nio = NullIo::new().map_err(io_error!(e, "new Null Io"))?;
let pio = ProcessIO {
uri: None,
io: Some(Arc::new(nio)),
copy: false,
};
return Ok(pio);
}
let stdout = stdio.stdout.as_str();
let scheme_path = stdout.trim().split("://").collect::<Vec<&str>>();
let scheme: &str;
let uri: String;
if scheme_path.len() <= 1 {
let scheme = if scheme_path.len() <= 1 {
// no scheme specified
// default schema to fifo
uri = format!("fifo://{}", stdout);
scheme = "fifo"
"fifo"
} else {
uri = stdout.to_string();
scheme = scheme_path[0];
}
scheme_path[0]
};

let mut pio = ProcessIO {
uri: Some(uri),
io: None,
copy: false,
};
Expand Down
2 changes: 1 addition & 1 deletion runc/src/sandbox.rs
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ impl Sandboxer for RuncSandboxer {
e
})?;

sandbox.data.task_address = self.task_address.clone();
sandbox.data.task_address.clone_from(&self.task_address);
sandbox.dump().await.map_err(|e| {
kill(Pid::from_raw(sandbox_pid), Signal::SIGKILL).unwrap_or_default();
e
Expand Down
10 changes: 4 additions & 6 deletions shim/src/io.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,10 +129,8 @@ impl VsockIO {
}
Err(other!("timeout connect to port {}", self.port))
}
}

impl ToString for VsockIO {
fn to_string(&self) -> String {
fn convert_to_string(&self) -> String {
if self.sock_path.is_empty() {
String::new()
} else {
Expand Down Expand Up @@ -336,15 +334,15 @@ impl ContainerIoTransport for VSockTransport {
}

fn container_in(&self) -> String {
self.stdin.clone().unwrap_or_default().to_string()
self.stdin.clone().unwrap_or_default().convert_to_string()
}

fn container_out(&self) -> String {
self.stdout.clone().unwrap_or_default().to_string()
self.stdout.clone().unwrap_or_default().convert_to_string()
}

fn container_err(&self) -> String {
self.stderr.clone().unwrap_or_default().to_string()
self.stderr.clone().unwrap_or_default().convert_to_string()
}

async fn new_task_client(address: &str) -> Result<TaskClient> {
Expand Down
2 changes: 1 addition & 1 deletion shim/src/task.rs
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ where
req_new.stderr = shim_io.container_err();

if !prepare_res.bundle.is_empty() {
req_new.bundle = prepare_res.bundle.clone();
req_new.bundle.clone_from(&prepare_res.bundle);
}

let res = self.task.create(ctx, req_new).await?;
Expand Down
2 changes: 0 additions & 2 deletions vmm/sandbox/derive/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

#![allow(dead_code)]

#[macro_use]
extern crate quote;

Expand Down
1 change: 0 additions & 1 deletion vmm/sandbox/src/cloud_hypervisor/devices/device.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ pub struct PhysicalDevice {

impl_device_no_bus!(PhysicalDevice);

#[allow(dead_code)]
impl PhysicalDevice {
pub fn new(path: &str, id: &str) -> Self {
Self {
Expand Down
2 changes: 1 addition & 1 deletion vmm/sandbox/src/cloud_hypervisor/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ impl CloudHypervisorVM {
}
}

pub fn add_device(&mut self, device: impl CloudHypervisorDevice + Sync + Send + 'static) {
pub fn add_device(&mut self, device: impl CloudHypervisorDevice + 'static) {
self.devices.push(Box::new(device));
}

Expand Down
37 changes: 0 additions & 37 deletions vmm/sandbox/src/container/handler/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

use std::ptr::NonNull;

use async_trait::async_trait;
use containerd_sandbox::{error::Result, ContainerOption, Sandbox};
use log::warn;
Expand All @@ -42,40 +40,6 @@ mod process;
mod spec;
mod storage;

pub struct HandlerNode<S> {
pub handler: Box<dyn Handler<S> + Sync + Send>,
pub next: Option<NonNull<HandlerNode<S>>>,
pub prev: Option<NonNull<HandlerNode<S>>>,
}

unsafe impl<S> Sync for HandlerNode<S> {}

unsafe impl<S> Send for HandlerNode<S> {}

impl<S> HandlerNode<S>
where
S: Sync + Send,
{
#[allow(dead_code)]
pub fn new(handler: Box<dyn Handler<S> + Sync + Send>) -> Self {
Self {
handler,
next: None,
prev: None,
}
}

#[allow(dead_code)]
pub async fn handle(&self, sandbox: &mut S) -> Result<()> {
self.handler.handle(sandbox).await
}

#[allow(dead_code)]
pub async fn rollback(&self, sandbox: &mut S) -> Result<()> {
self.handler.rollback(sandbox).await
}
}

pub struct HandlerChain<S> {
handlers: Vec<Box<dyn Handler<S> + Sync + Send>>,
}
Expand Down Expand Up @@ -123,7 +87,6 @@ where
Ok(())
}

#[allow(dead_code)]
pub async fn rollback(&self, sandbox: &mut S) -> Result<()> {
for handler in self.handlers.iter().rev() {
handler.rollback(sandbox).await.unwrap_or_else(|e| {
Expand Down
2 changes: 1 addition & 1 deletion vmm/sandbox/src/container/handler/storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ where
for mut m in mounts {
if let Some(storage) = sandbox.storages.iter().find(|x| x.is_for_mount(&m)) {
debug!("found storage {:?} for mount {:?}", storage, m);
m.source = storage.mount_point.clone();
m.source.clone_from(&storage.mount_point);
m.options = vec!["bind".to_string()];
if storage.need_guest_handle {
storages.push(storage);
Expand Down
4 changes: 0 additions & 4 deletions vmm/sandbox/src/container/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,8 @@ use serde::{Deserialize, Serialize};

mod handler;

#[allow(dead_code)]
const NULL_DEVICE: &str = "/dev/null";

#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct KuasarContainer {
#[allow(dead_code)]
pub(crate) id: String,
pub(crate) data: ContainerData,
pub(crate) io_devices: Vec<String>,
Expand Down
6 changes: 0 additions & 6 deletions vmm/sandbox/src/device.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,9 @@ pub trait Device {
#[allow(clippy::upper_case_acronyms)]
pub enum BusType {
PCI,
#[allow(dead_code)]
PCIE,
#[allow(dead_code)]
CCW,
SCSI,
#[allow(dead_code)]
MMIO,
SERIAL,
NULL,
Expand Down Expand Up @@ -99,7 +96,6 @@ impl Bus {
None
}

#[allow(dead_code)]
pub fn attach<T: Device>(&mut self, device: &T) -> Result<usize> {
for (index, s) in self.slots.iter_mut().enumerate() {
if let SlotStatus::Empty = s.status {
Expand All @@ -110,7 +106,6 @@ impl Bus {
Err(Error::ResourceExhausted("bus is full".to_string()))
}

#[allow(dead_code)]
pub fn device_slot(&self, id: &str) -> Option<usize> {
for (index, s) in self.slots.iter().enumerate() {
if index == 0 {
Expand Down Expand Up @@ -150,7 +145,6 @@ pub enum SlotStatus {
pub enum Transport {
Pci,
Ccw,
#[allow(dead_code)]
Mmio,
}

Expand Down
3 changes: 2 additions & 1 deletion vmm/sandbox/src/kata_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,8 @@ impl Hypervisor {
res.virtiofs_cache = self.virtio_fs_cache.to_string();
res.virtiofs_cache_size = self.virtio_fs_cache_size;
res.virtiofs_daemon_path = self.virtio_fs_daemon.to_string();
res.virtiofs_extra_args = self.virtio_fs_extra_args.clone();
res.virtiofs_extra_args
.clone_from(&self.virtio_fs_extra_args);
res.virtio_9p_direct_io = self.virtio_9p_direct_io;
if !self.virtio_9p_multidevs.is_empty() {
res.virtio_9p_multidevs = self.virtio_9p_multidevs.to_string();
Expand Down
14 changes: 4 additions & 10 deletions vmm/sandbox/src/network/address.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ impl IpNet {
}
}

#[derive(Default, Clone, Deserialize, Serialize)]
#[derive(Default, Debug, Clone, Deserialize, Serialize)]
#[serde(from = "String")]
#[serde(into = "String")]
pub struct MacAddress(pub(crate) Vec<u8>);
Expand All @@ -131,19 +131,13 @@ impl From<MacAddress> for String {
}
}

impl ToString for MacAddress {
fn to_string(&self) -> String {
impl std::fmt::Display for MacAddress {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
let mut segs = vec![];
for u in self.0.as_slice() {
segs.push(format!("{:02x}", u));
}
segs.join(":")
}
}

impl Debug for MacAddress {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
write!(f, "{}", self.to_string())
write!(f, "{}", segs.join(":"))
}
}

Expand Down
14 changes: 6 additions & 8 deletions vmm/sandbox/src/network/link.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ limitations under the License.

use std::{
ffi::CStr,
fmt::{Display, Formatter},
os::unix::{
fs::OpenOptionsExt,
prelude::{AsRawFd, OwnedFd},
Expand Down Expand Up @@ -53,9 +54,7 @@ use crate::{

const DEVICE_DRIVER_VFIO: &str = "vfio-pci";

#[allow(dead_code)]
const SIOCETHTOOL: u64 = 0x8946;
#[allow(dead_code)]
const ETHTOOL_GDRVINFO: u32 = 0x00000003;

const TUNSETIFF: u64 = 0x400454ca;
Expand All @@ -64,14 +63,12 @@ const TUNSETPERSIST: u64 = 0x400454cb;
ioctl_write_ptr_bad!(ioctl_tun_set_iff, TUNSETIFF, ifreq);
ioctl_write_ptr_bad!(ioctl_tun_set_persist, TUNSETPERSIST, u64);

#[allow(dead_code)]
#[repr(C)]
pub struct Ifreq {
ifr_name: [u8; 16],
ifr_data: *mut libc::c_void,
}

#[allow(dead_code)]
#[repr(C)]
pub struct EthtoolDrvInfo {
cmd: u32,
Expand Down Expand Up @@ -115,9 +112,9 @@ impl Default for LinkType {
}
}

impl ToString for LinkType {
fn to_string(&self) -> String {
match &self {
impl Display for LinkType {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
let s = match &self {
LinkType::Unkonwn => "".to_string(),
LinkType::Bridge => "bridge".to_string(),
LinkType::Veth => "veth".to_string(),
Expand All @@ -133,7 +130,8 @@ impl ToString for LinkType {
LinkType::Physical(_, _) => "physical".to_string(),
LinkType::Tap => "tap".to_string(),
LinkType::Loopback => "loopback".to_string(),
}
};
write!(f, "{}", s)
}
}

Expand Down
Loading
Loading