mirror of
https://github.com/linuxkit/linuxkit.git
synced 2025-07-21 01:59:07 +00:00
infrakit: removed vm-lib from arguments
Instead pass the directory where to find initrd/vmlinuz via the "Moby" entry in the instance JSON config. Signed-off-by: Rolf Neugebauer <rolf.neugebauer@docker.com>
This commit is contained in:
parent
af2ee9e023
commit
95fa38f879
@ -9,10 +9,6 @@ each instance keeps some state in a sub-directory. The VM state
|
|||||||
directory can be specified at the kernel command line using the
|
directory can be specified at the kernel command line using the
|
||||||
`--vm-dir` option.
|
`--vm-dir` option.
|
||||||
|
|
||||||
The plugin also needs to know where the kernel and `initrd` images are
|
|
||||||
located. The `--vm-lib` command line argument to the plugin specifies
|
|
||||||
the directory. Inside the VM library directory every kernel/initrd configuration should be stored in a sub-directory. The sub-directory name is used in the instance configuration.
|
|
||||||
|
|
||||||
## Building
|
## Building
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
|
@ -20,9 +20,8 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
// NewHyperKitPlugin creates an instance plugin for hyperkit.
|
// NewHyperKitPlugin creates an instance plugin for hyperkit.
|
||||||
func NewHyperKitPlugin(vmLib, vmDir, hyperkit, vpnkitSock string, thyper, tkern *template.Template) instance.Plugin {
|
func NewHyperKitPlugin(vmDir, hyperkit, vpnkitSock string, thyper, tkern *template.Template) instance.Plugin {
|
||||||
return &hyperkitPlugin{VMLib: vmLib,
|
return &hyperkitPlugin{VMDir: vmDir,
|
||||||
VMDir: vmDir,
|
|
||||||
HyperKit: hyperkit,
|
HyperKit: hyperkit,
|
||||||
VPNKitSock: vpnkitSock,
|
VPNKitSock: vpnkitSock,
|
||||||
|
|
||||||
@ -32,10 +31,6 @@ func NewHyperKitPlugin(vmLib, vmDir, hyperkit, vpnkitSock string, thyper, tkern
|
|||||||
}
|
}
|
||||||
|
|
||||||
type hyperkitPlugin struct {
|
type hyperkitPlugin struct {
|
||||||
// VMLib is the path to a directory where each sub-directory
|
|
||||||
// contains a vmlinuz and a initrd image
|
|
||||||
VMLib string
|
|
||||||
|
|
||||||
// VMDir is the path to a directory where per VM state is kept
|
// VMDir is the path to a directory where per VM state is kept
|
||||||
VMDir string
|
VMDir string
|
||||||
|
|
||||||
@ -91,7 +86,6 @@ func (v hyperkitPlugin) Provision(spec instance.Spec) (*instance.ID, error) {
|
|||||||
// Apply parameters
|
// Apply parameters
|
||||||
params := map[string]interface{}{
|
params := map[string]interface{}{
|
||||||
"VMLocation": instanceDir,
|
"VMLocation": instanceDir,
|
||||||
"VMLib": v.VMLib,
|
|
||||||
"VPNKitSock": v.VPNKitSock,
|
"VPNKitSock": v.VPNKitSock,
|
||||||
"Properties": properties,
|
"Properties": properties,
|
||||||
}
|
}
|
||||||
@ -250,8 +244,8 @@ const hyperkitArgs = "-A -u -F {{.VMLocation}}/hyperkit.pid " +
|
|||||||
"-s 2:0,virtio-vpnkit,path={{.VPNKitSock}} " +
|
"-s 2:0,virtio-vpnkit,path={{.VPNKitSock}} " +
|
||||||
"-l com1,autopty={{.VMLocation}}/tty,log={{.VMLocation}}/console-ring"
|
"-l com1,autopty={{.VMLocation}}/tty,log={{.VMLocation}}/console-ring"
|
||||||
const hyperkitKernArgs = "kexec," +
|
const hyperkitKernArgs = "kexec," +
|
||||||
"{{.VMLib}}/{{.Properties.Moby}}/vmlinuz64," +
|
"{{.Properties.Moby}}/vmlinuz64," +
|
||||||
"{{.VMLib}}/{{.Properties.Moby}}/initrd.img," +
|
"{{.Properties.Moby}}/initrd.img," +
|
||||||
"earlyprintk=serial console=ttyS0 panic=1 vsyscall=emulate page_poison=1 ntp=gateway"
|
"earlyprintk=serial console=ttyS0 panic=1 vsyscall=emulate page_poison=1 ntp=gateway"
|
||||||
|
|
||||||
func (v hyperkitPlugin) execHyperKit(params map[string]interface{}) error {
|
func (v hyperkitPlugin) execHyperKit(params map[string]interface{}) error {
|
||||||
|
@ -52,7 +52,6 @@ func main() {
|
|||||||
name := cmd.Flags().String("name", "instance-hyperkit", "Plugin name to advertise for discovery")
|
name := cmd.Flags().String("name", "instance-hyperkit", "Plugin name to advertise for discovery")
|
||||||
logLevel := cmd.Flags().Int("log", cli.DefaultLogLevel, "Logging level. 0 is least verbose. Max is 5")
|
logLevel := cmd.Flags().Int("log", cli.DefaultLogLevel, "Logging level. 0 is least verbose. Max is 5")
|
||||||
|
|
||||||
vmLib := cmd.Flags().String("vm-lib", "", "Directory with subdirectories of kernels/initrds combinations")
|
|
||||||
vmDir := cmd.Flags().String("vm-dir", defaultVMDir, "Directory where to store VM state")
|
vmDir := cmd.Flags().String("vm-dir", defaultVMDir, "Directory where to store VM state")
|
||||||
hyperkit := cmd.Flags().String("hyperkit", defaultHyperKit, "Path to HyperKit executable")
|
hyperkit := cmd.Flags().String("hyperkit", defaultHyperKit, "Path to HyperKit executable")
|
||||||
|
|
||||||
@ -73,7 +72,7 @@ func main() {
|
|||||||
|
|
||||||
cli.SetLogLevel(*logLevel)
|
cli.SetLogLevel(*logLevel)
|
||||||
cli.RunPlugin(*name,
|
cli.RunPlugin(*name,
|
||||||
instance_plugin.PluginServer(NewHyperKitPlugin(*vmLib, *vmDir, *hyperkit, *vpnkitSock, thyper, tkern)),
|
instance_plugin.PluginServer(NewHyperKitPlugin(*vmDir, *hyperkit, *vpnkitSock, thyper, tkern)),
|
||||||
metadata_plugin.PluginServer(metadata.NewPluginFromData(
|
metadata_plugin.PluginServer(metadata.NewPluginFromData(
|
||||||
map[string]interface{}{
|
map[string]interface{}{
|
||||||
"version": Version,
|
"version": Version,
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
"Instance": {
|
"Instance": {
|
||||||
"Plugin": "instance-hyperkit",
|
"Plugin": "instance-hyperkit",
|
||||||
"Properties": {
|
"Properties": {
|
||||||
"Moby": "default",
|
"Moby": "./vms/default",
|
||||||
"Disk" : 512,
|
"Disk" : 512,
|
||||||
"CPUs" : 2,
|
"CPUs" : 2,
|
||||||
"Memory" : 1024
|
"Memory" : 1024
|
||||||
|
Loading…
Reference in New Issue
Block a user