Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
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
10 changes: 5 additions & 5 deletions doc/firecracker-pilot.rst
Original file line number Diff line number Diff line change
Expand Up @@ -95,13 +95,13 @@ can be set for the firecracker engine:
overlay_size: 20GiB

# Path to rootfs image done by app registration
rootfs_image_path: /var/lib/firecracker/images/NAME/rootfs
rootfs_image_path: /usr/share/firecracker/images/NAME/rootfs

# Path to kernel image done by app registration
kernel_image_path: /var/lib/firecracker/images/NAME/kernel
kernel_image_path: /usr/share/firecracker/images/NAME/kernel

# Optional path to initrd image done by app registration
initrd_path: /var/lib/firecracker/images/NAME/initrd
initrd_path: /usr/share/firecracker/images/NAME/initrd

After reading of the app configuration information the application
will be called using the configured engine. If no runtime
Expand Down Expand Up @@ -166,8 +166,8 @@ FILES
-----

* /usr/share/flakes
* /var/lib/firecracker/images
* /var/lib/firecracker/storage
* /usr/share/firecracker/images
* /usr/share/firecracker/storage
* /etc/flakes

AUTHOR
Expand Down
6 changes: 3 additions & 3 deletions doc/flake-ctl-firecracker-pull.rst
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,18 @@ DESCRIPTION
-----------

Pull the components of a firecracker image from the given location
into `/var/lib/firecracker/images/NAME` on the local machine.
into `/usr/share/firecracker/images/NAME` on the local machine.
After completion the available firecracker images can be listed via:

.. code:: bash

$ tree /var/lib/firecracker/images
$ tree /usr/share/firecracker/images

and shows a file structure like in the following example

.. code:: bash

/var/lib/firecracker/images
/usr/share/firecracker/images
└── myImage
├── initrd
├── kernel
Expand Down
4 changes: 2 additions & 2 deletions doc/flake-ctl-firecracker-remove.rst
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,13 @@ OPTIONS

--vm <VM>

VM basename as provided via **ls -1 /var/lib/firecracker/images**
VM basename as provided via **ls -1 /usr/share/firecracker/images**

FILES
-----

* /usr/share/flakes
* /var/lib/firecracker/images
* /usr/share/firecracker/images

EXAMPLE
-------
Expand Down
2 changes: 1 addition & 1 deletion firecracker-pilot/src/defaults.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ pub const OVERLAY_UPPER: &str =
pub const OVERLAY_WORK: &str =
"overlayroot/rootfs_work";
pub const FIRECRACKER_OVERLAY_DIR:&str =
"/var/lib/firecracker/storage";
"/usr/share/firecracker/storage";
pub const FIRECRACKER_TEMPLATE:&str =
"/etc/flakes/firecracker.json";
pub const FIRECRACKER_VSOCK_PREFIX: &str =
Expand Down
6 changes: 3 additions & 3 deletions firecracker-pilot/src/firecracker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -155,13 +155,13 @@ pub fn create(program_name: &String) -> Result<(String, String), FlakeError> {
overlay_size: 20g

# Path to rootfs image done by app registration
rootfs_image_path: /var/lib/firecracker/images/NAME/rootfs
rootfs_image_path: /usr/share/firecracker/images/NAME/rootfs

# Path to kernel image done by app registration
kernel_image_path: /var/lib/firecracker/images/NAME/kernel
kernel_image_path: /usr/share/firecracker/images/NAME/kernel

# Optional path to initrd image done by app registration
initrd_path: /var/lib/firecracker/images/NAME/initrd
initrd_path: /usr/share/firecracker/images/NAME/initrd

include:
tar:
Expand Down
4 changes: 2 additions & 2 deletions flake-ctl/src/defaults.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ pub const FLAKE_TEMPLATE_CONTAINER:&str =
pub const FLAKE_TEMPLATE_FIRECRACKER:&str =
"/etc/flakes/firecracker-flake.yaml";
pub const FIRECRACKER_REGISTRY_DIR:&str =
"/var/lib/firecracker";
"/usr/share/firecracker";
pub const FIRECRACKER_IMAGES_DIR:&str =
"/var/lib/firecracker/images";
"/usr/share/firecracker/images";
pub const FIRECRACKER_INITRD_NAME:&str =
"initrd";
pub const FIRECRACKER_KERNEL_NAME:&str =
Expand Down
16 changes: 11 additions & 5 deletions package/flake-pilot.spec
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,9 @@ make DESTDIR=%{buildroot}/ install_sci
mkdir -p %{buildroot}/overlayroot
mkdir -p %{buildroot}/usr/lib/flake-pilot

mkdir -p %{buildroot}/var/lib/firecracker/images
mkdir -p %{buildroot}/usr/share/firecracker/images

mkdir -p %{buildroot}/var/lib/firecracker/storage
mkdir -p %{buildroot}/usr/share/firecracker/storage

mkdir -p %{buildroot}/etc/dracut.conf.d
mkdir -p %{buildroot}/usr/lib/dracut/modules.d/80netstart
Expand Down Expand Up @@ -180,9 +180,9 @@ install -m 644 flakes.yml %{buildroot}/etc/flakes.yml
%doc /usr/share/man/man8/podman-pilot.8.gz

%files -n flake-pilot-firecracker
%dir /var/lib/firecracker
%dir /var/lib/firecracker/images
%dir /var/lib/firecracker/storage
%dir /usr/share/firecracker
%dir /usr/share/firecracker/images
%dir /usr/share/firecracker/storage
%dir /usr/lib/flake-pilot
%config /etc/flakes/firecracker-flake.yaml
%config /etc/flakes/firecracker.json
Expand All @@ -193,6 +193,12 @@ install -m 644 flakes.yml %{buildroot}/etc/flakes.yml
%doc /usr/share/man/man8/firecracker-pilot.8.gz
/usr/lib/flake-pilot/sci

%post -n flake-pilot-firecracker
if [ "$YAST_IS_RUNNING" != "instsys" ] && [ -d /var/lib/firecracker ];then
rsync -za /var/lib/firecracker/ /usr/share/firecracker/
rm -rf /var/lib/firecracker
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this might trigger an RPM error on package upgrade. RPM will try to remove any files that are not part of the new package on it's own. Since the new package no longer owns /var/lib/firecracker RPM will try to remove this directory, but it will already be gone due to the %post action. I am not sure if RPM ignores that error or complains.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's worse. I talked to some rpm experts. Here is the answer

you need to keep the old directory in the filelist or rpm will delete it on transaction which breaks your post script

I added a commit to address this situation

@rjschwei now the question is, if I have to keep the old location as a %dir in order to allow the move, does that break the idea of SUSE's immutable system concept ?

Thanks

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, when I reviewed this I completely lost track of the context as to why these changes are being made, my bad. There should actually not be any moving. On a transactional-update system /usr is immutable, meaning with the current code if a user actually wants to add a firecracker image that operation would fail. The location where the images are store has to remain the same, i.e. /var/lib/firecracker.

What you need to do is create flake-pilot.conf file which contains

d /var/lib/firecracker
d /var/lib/firecracker/images
d /var/lib/firecracker/storage

and then in the spec file own those directories as %ghost.

Sorry for not picking up on this on the first review.

fi

%files -n flake-pilot-firecracker-dracut-netstart
%dir /usr/lib/dracut
%dir /usr/lib/dracut/modules.d
Expand Down
Loading