mirror of
https://github.com/cirruslabs/orchard.git
synced 2026-09-30 03:51:43 +02:00
Support for sharing files with the host system (#103)
* Support for sharing files with the host system * Integration tests * Added back TestVMGarbageCollection comment
This commit is contained in:
@@ -21,6 +21,7 @@ var headless bool
|
||||
var resources map[string]string
|
||||
var restartPolicy string
|
||||
var startupScript string
|
||||
var hostDirsRaw []string
|
||||
|
||||
func newCreateVMCommand() *cobra.Command {
|
||||
command := &cobra.Command{
|
||||
@@ -44,6 +45,9 @@ func newCreateVMCommand() *cobra.Command {
|
||||
command.PersistentFlags().StringVar(&startupScript, "startup-script", "",
|
||||
"startup script (e.g. --startup-script=\"sync\") or a path to a script file prefixed with \"@\" "+
|
||||
"(e.g. \"--startup-script=@script.sh\")")
|
||||
command.PersistentFlags().StringSliceVar(&hostDirsRaw, "host-dirs", []string{},
|
||||
"host directories to mount to the VM, can be specified multiple times and/or be comma-separated "+
|
||||
"(see \"tart run\"'s --dir argument for syntax)")
|
||||
|
||||
return command
|
||||
}
|
||||
@@ -51,6 +55,18 @@ func newCreateVMCommand() *cobra.Command {
|
||||
func runCreateVM(cmd *cobra.Command, args []string) error {
|
||||
name := args[0]
|
||||
|
||||
// Convert arguments
|
||||
var hostDirs []v1.HostDir
|
||||
|
||||
for _, hostDirRaw := range hostDirsRaw {
|
||||
hostDir, err := v1.NewHostDirFromString(hostDirRaw)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
hostDirs = append(hostDirs, hostDir)
|
||||
}
|
||||
|
||||
vm := &v1.VM{
|
||||
Meta: v1.Meta{
|
||||
Name: name,
|
||||
@@ -61,6 +77,7 @@ func runCreateVM(cmd *cobra.Command, args []string) error {
|
||||
NetSoftnet: netSoftnet,
|
||||
NetBridged: netBridged,
|
||||
Headless: headless,
|
||||
HostDirs: hostDirs,
|
||||
}
|
||||
|
||||
// Convert resources
|
||||
|
||||
Reference in New Issue
Block a user