Skip to content
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
5 changes: 2 additions & 3 deletions .github/workflows/release-oci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ on:
push:
branches:
- master
- feat/container
tags:
- '*'
paths-ignore:
Expand Down Expand Up @@ -74,8 +73,8 @@ jobs:
with:
path: |
target/kernel/
key: ${{ runner.os }}-kernel-${{ hashFiles('/hack/kernel/**') }}
restore-keys: ${{ runner.os }}-kernel-
key: ${{ runner.os }}-kernel-${{ hashFiles('hack/kernel/**') }}
restore-keys: ${{ runner.os }}-kernel-${{ hashFiles('hack/kernel/**') }}

- name: Build Kernel
run: make kernel
Expand Down
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@ test: clippy

include hack/hack.mk

feos_client:
cd client && cargo build
cli:
cargo build --bin feos-cli
2 changes: 2 additions & 0 deletions hack/initramfs/make.mk
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@ initramfs: target/cloud-hypervisor target/cloud-hypervisor-firmware container-re
mkdir -p target/rootfs/bin
mkdir -p target/rootfs/etc/feos
mkdir -p target/rootfs/usr/share/cloud-hypervisor
mkdir -p target/rootfs/usr/share/feos
cp target/cloud-hypervisor/target/cloud-hypervisor-static target/rootfs/bin/cloud-hypervisor
cp target/cloud-hypervisor/target/hypervisor-fw target/rootfs/usr/share/cloud-hypervisor
cp target/kernel/vmlinuz target/rootfs/usr/share/feos/vmlinuz
cp target/x86_64-unknown-linux-musl/release/feos target/rootfs/bin/feos
sudo chown -R `whoami` target/rootfs/etc/feos/
cd target/rootfs && rm -f init && ln -s bin/feos init
Expand Down
4 changes: 4 additions & 0 deletions hack/initramfs/mk-initramfs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ echo "Install libraries for FeOS (copy from host)"
install_libs $ROOTFS_DIR/bin/feos
cp -ra /etc/ssl/certs usr/local/ssl/

echo "Create initramfs (non-compressed)"
find . -print0 | cpio --create --format=newc --null > "${TARGET_DIR}/initramfs"
mv "${TARGET_DIR}/initramfs" "${ROOTFS_DIR}/usr/share/feos/"

echo "Create initramfs.zst"
find . -print0 | cpio --create --format=newc --null | zstd -3 > "${TARGET_DIR}/initramfs.zst"

Expand Down
10 changes: 5 additions & 5 deletions hack/kernel/config/feos-linux-6.6.60.config
Original file line number Diff line number Diff line change
Expand Up @@ -172,21 +172,21 @@ CONFIG_CC_NO_ARRAY_BOUNDS=y
CONFIG_ARCH_SUPPORTS_INT128=y
# CONFIG_NUMA_BALANCING is not set
CONFIG_CGROUPS=y
CONFIG_MEMCG=y
# CONFIG_CGROUP_FAVOR_DYNMODS is not set
# CONFIG_MEMCG is not set
# CONFIG_BLK_CGROUP is not set
CONFIG_CGROUP_SCHED=y
CONFIG_FAIR_GROUP_SCHED=y
# CONFIG_CFS_BANDWIDTH is not set
# CONFIG_RT_GROUP_SCHED is not set
CONFIG_SCHED_MM_CID=y
# CONFIG_CGROUP_PIDS is not set
CONFIG_CGROUP_PIDS=y
# CONFIG_CGROUP_RDMA is not set
CONFIG_CGROUP_FREEZER=y
# CONFIG_CGROUP_HUGETLB is not set
CONFIG_CPUSETS=y
CONFIG_PROC_PID_CPUSET=y
# CONFIG_CGROUP_DEVICE is not set
CONFIG_CGROUP_DEVICE=y
CONFIG_CGROUP_CPUACCT=y
# CONFIG_CGROUP_PERF is not set
# CONFIG_CGROUP_MISC is not set
Expand Down Expand Up @@ -1544,8 +1544,8 @@ CONFIG_NET_CORE=y
# CONFIG_AMT is not set
# CONFIG_MACSEC is not set
# CONFIG_NETCONSOLE is not set
# CONFIG_TUN is not set
# CONFIG_TUN_VNET_CROSS_LE is not set
CONFIG_TUN=y
CONFIG_VETH=y
CONFIG_VIRTIO_NET=y
CONFIG_NLMON=y
Expand Down Expand Up @@ -3091,7 +3091,7 @@ CONFIG_QFMT_V2=y
CONFIG_QUOTACTL=y
CONFIG_AUTOFS_FS=y
# CONFIG_FUSE_FS is not set
# CONFIG_OVERLAY_FS is not set
CONFIG_OVERLAY_FS=y

#
# Caches
Expand Down
4 changes: 2 additions & 2 deletions hack/libvirt/libvirt-kvm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<libosinfo:os id="http://libosinfo.org/linux/2022"/>
</libosinfo:libosinfo>
</metadata>
<memory unit='MiB'>2048</memory>
<memory unit='MiB'>8048</memory>
<vcpu>4</vcpu>
<os firmware="efi">
<type arch="x86_64" machine="q35">hvm</type>
Expand All @@ -17,7 +17,7 @@
<acpi/>
<apic/>
</features>
<cpu mode="host-passthrough"/>
<cpu mode="host-passthrough" check='none' migratable='on'/>
<clock offset="utc">
<timer name="rtc" tickpolicy="catchup"/>
<timer name="pit" tickpolicy="delay"/>
Expand Down
70 changes: 39 additions & 31 deletions proto/feos.proto
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,30 @@ syntax = "proto3";
package feos_grpc;

service FeosGrpc {
rpc Reboot (RebootRequest) returns (RebootResponse);
rpc Shutdown (ShutdownRequest) returns (ShutdownResponse);
rpc HostInfo (HostInfoRequest) returns (HostInfoResponse);
rpc Reboot (RebootRequest) returns (RebootResponse);
rpc Shutdown (ShutdownRequest) returns (ShutdownResponse);
rpc HostInfo (HostInfoRequest) returns (HostInfoResponse);

rpc Ping (Empty) returns (Empty);

rpc FetchImage (FetchImageRequest) returns (FetchImageResponse);
rpc Ping (Empty) returns (Empty);

rpc CreateVM (CreateVMRequest) returns (CreateVMResponse);
rpc GetVM (GetVMRequest) returns (GetVMResponse);
rpc BootVM (BootVMRequest) returns (BootVMResponse);
rpc ConsoleVM (stream ConsoleVMRequest) returns (stream ConsoleVMResponse);
rpc AttachNicVM (AttachNicVMRequest) returns (AttachNicVMResponse);
rpc ShutdownVM (ShutdownVMRequest) returns (ShutdownVMResponse);
rpc PingVM (PingVMRequest) returns (PingVMResponse);
rpc FetchImage (FetchImageRequest) returns (FetchImageResponse);

rpc GetFeOSKernelLogs (GetFeOSKernelLogRequest) returns (stream GetFeOSKernelLogResponse);
rpc GetFeOSLogs(GetFeOsLogRequest) returns (stream GetFeOsLogResponse);
rpc CreateVM (CreateVMRequest) returns (CreateVMResponse);
rpc GetVM (GetVMRequest) returns (GetVMResponse);
rpc BootVM (BootVMRequest) returns (BootVMResponse);
rpc ConsoleVM (stream ConsoleVMRequest) returns (stream ConsoleVMResponse);
rpc AttachNicVM (AttachNicVMRequest) returns (AttachNicVMResponse);
rpc ShutdownVM (ShutdownVMRequest) returns (ShutdownVMResponse);
rpc PingVM (PingVMRequest) returns (PingVMResponse);

rpc GetFeOSKernelLogs (GetFeOSKernelLogRequest) returns (stream GetFeOSKernelLogResponse);
rpc GetFeOSLogs(GetFeOsLogRequest) returns (stream GetFeOsLogResponse);
}

enum NicType {
MAC = 0;
PCI = 1;
TAP = 2;
}

message ConsoleVMRequest {
Expand All @@ -40,16 +46,20 @@ message GetFeOSKernelLogResponse {
message GetFeOsLogRequest {}

message GetFeOsLogResponse {
string message = 1;
string message = 1;
}

message AttachNicVMRequest {
string uuid = 1;
string mac_address = 2;
string pci_address = 3;
string uuid = 1;
NicType nic_type = 2;

oneof nic_data {
string mac_address = 3;
string pci_address = 4;
}
}
message AttachNicVMResponse {}

message AttachNicVMResponse {}

message RebootRequest {}
message RebootResponse {}
Expand All @@ -67,14 +77,13 @@ message HostInfoResponse {
}

message NetInterface {
string name = 1;
string pci_address = 2;
string mac_address = 3;
string name = 1;
string pci_address = 2;
string mac_address = 3;
}

message Empty {}


message FetchImageRequest {
string image = 1;
}
Expand All @@ -83,27 +92,26 @@ message FetchImageResponse {
string uuid = 1;
}


message CreateVMRequest {
uint32 cpu = 1;
uint64 memory_bytes = 2;
uint32 cpu = 1;
uint64 memory_bytes = 2;
string image_uuid = 3;
optional string ignition = 4;
optional string ignition = 4;
}

message CreateVMResponse {
string uuid = 1;
}

message GetVMRequest {
string uuid = 1;
string uuid = 1;
}
message GetVMResponse {
string info = 1;
}

message BootVMRequest {
string uuid = 1;
string uuid = 1;
}
message BootVMResponse {}

Expand All @@ -115,4 +123,4 @@ message ShutdownVMResponse {}
message PingVMRequest {
string uuid = 1;
}
message PingVMResponse {}
message PingVMResponse {}
32 changes: 27 additions & 5 deletions src/bin/feos_cli/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,10 @@ pub enum Command {
},
AttachNicVM {
uuid: String,
mac_address: String,
pci_address: String,
#[structopt(long)]
mac_address: Option<String>,
#[structopt(long)]
pci_address: Option<String>,
},
GetFeOSKernelLogs,
GetFeOSLogs,
Expand Down Expand Up @@ -152,7 +154,7 @@ pub async fn run_client(opt: Opt) -> Result<(), Box<dyn std::error::Error>> {
Command::PingVM { uuid } => {
let request = Request::new(PingVmRequest { uuid });
let response = client.ping_vm(request).await?;
println!("BOOT VM RESPONSE={:?}", response);
println!("PING VM RESPONSE={:?}", response);
}
Command::ShutdownVM { uuid } => {
let request = Request::new(ShutdownVmRequest { uuid });
Expand All @@ -164,11 +166,31 @@ pub async fn run_client(opt: Opt) -> Result<(), Box<dyn std::error::Error>> {
mac_address,
pci_address,
} => {
let (nic_type, nic_data) = match (&mac_address, &pci_address) {
(Some(mac), None) => (
feos_grpc::NicType::Mac as i32,
Some(attach_nic_vm_request::NicData::MacAddress(mac.clone())),
),
(None, Some(pci)) => (
feos_grpc::NicType::Pci as i32,
Some(attach_nic_vm_request::NicData::PciAddress(pci.clone())),
),
(None, None) => (feos_grpc::NicType::Tap as i32, None),
(Some(_), Some(_)) => {
eprintln!("Error: Provide either --mac_address or --pci_address, not both.");
return Err(Box::new(std::io::Error::new(
std::io::ErrorKind::InvalidInput,
"Provide either --mac_address or --pci_address, not both.",
)));
}
};

let request = Request::new(AttachNicVmRequest {
uuid,
mac_address,
pci_address,
nic_type,
nic_data,
});

let response = client.attach_nic_vm(request).await?;
println!("ATTACH NIC VM RESPONSE={:?}", response);
}
Expand Down
Loading
Loading