-
Notifications
You must be signed in to change notification settings - Fork 156
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implements the volumehandler interface functions like CreateVolume, DestroyVolume etc. for PersistentVolumes (Kubernetes based volumes) Though longhorn can support filemode volumes we only create blockmode volumes since eve only deals with block volumes. CreateVolume() does the following: 1) A blank volume create request, creates a blockmode PVC 2) A downloaded volume qcow2 is converted to blockmode PVC 3) For container images, we follow the same path of extracting rootfs to /persist/vault/volumes/*container directory once the rootfs is laid out, the files required for runx-initrd are generated and copied into /persist/vault/volumes/*container The directory content will look like this: 4b6da250-6608-4686-a9fd-89e16f39ded6:/persist/vault/volumes/fe328d99-a380-45a7-99af-612b6264f628#0.container# ls cmdline environment image-config.json modules rootfs ug This entire directory is first copied to a qcow2 using copy-image-to-qcow.sh script The qcow2 is copied to PVC, which will be used as bootdisk for the VM. The qcow2 will be deleted to save space. Volume snapshots are not supported yet and a corresponding error is returned. Kubenertes naming convention does not support "#", so all PVC are keyed with -pvc- instead of "#" Added docker.io/ prefix to the container images inserted into the containerd repository Addressed all review comments and squashed to one commit Signed-off-by: Pramodh Pallapothu <pramodh@zededa.com>
- Loading branch information
1 parent
2c42bfc
commit e4f2710
Showing
17 changed files
with
696 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package cas | ||
|
||
import ( | ||
"os" | ||
"path/filepath" | ||
"strings" | ||
"testing" | ||
) | ||
|
||
func TestWriteKubevirtMountpointsFile(t *testing.T) { | ||
cas := containerdCAS{} | ||
mountPoints := map[string]struct{}{ | ||
"/media/floppy": {}, | ||
"/media/cdrom": {}, | ||
} | ||
|
||
dname, err := os.MkdirTemp("", "prefix") | ||
|
||
if err != nil { | ||
t.Fatal(err) | ||
} | ||
|
||
err = cas.writeKubevirtMountpointsFile(mountPoints, dname) | ||
if err != nil { | ||
t.Fatal(err) | ||
} | ||
|
||
contentBytes, err := os.ReadFile(filepath.Join(dname, "mountPoints")) | ||
|
||
if err != nil { | ||
t.Fatal(err) | ||
} | ||
|
||
content := string(contentBytes) | ||
|
||
for mountPoint := range mountPoints { | ||
if !strings.Contains(content, mountPoint) { | ||
t.Fatalf("mountPoint %s is missing", mountPoint) | ||
} | ||
} | ||
|
||
os.RemoveAll(filepath.Join(dname, "mountPoints")) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.