containers / krunvm

Create microVMs from OCI images
Apache License 2.0
1.43k stars 42 forks source link

[Work in Progress] Convert krunvm into a library #7

Closed nickgerace closed 3 years ago

nickgerace commented 3 years ago

Description

This PR is a work-in-progress to convert krunvm into a library in order to enable its use as a crate in other projects.

Known Issues

Next Steps

  1. Convert all library code to return errors rather than panic or exit
  2. Convert clap "matches" into a library-based struct to be portable

Notes to Maintainers

While this PR is a draft, please feel free to leave comments and review!

Question to Maintainers

@slp: if the purpose of krunvm is to only be a CLI, should developers who want to use the API use libkrun (and libkrunfw) instead?

slp commented 3 years ago

Hi, Nick.

@slp: if the purpose of krunvm is to only be a CLI, should developers who want to use the API use libkrun (and libkrunfw) instead?

Yes, that's the idea. krunvm is just a small frontend for libkrun and buildah. Are you missing some feature in libkrun?

nickgerace commented 3 years ago

Hi @slp - I am not missing a feature in libkrun.

This stemmed from me wanting to give proper attribution to krunvm. Rather than duplicating work, I thought it would be nice to suggest that we turn this into a library with CLI frontend since I like the "create" implementation. However, that's a very drastic change for a project that I am not a maintainer of :)

I am now realizing though that I'd probably want to use the krunvm CLI directly though for my crate. If I decide I need the API again, I'll just use libkrun and provide proper attribution if my "create" functionality looks similar to krunvm's. I'll close the PR. Thank you!