support for OpenStack security groups

Signed-off-by: Marco Mariani <marco.mariani@alterway.fr>
This commit is contained in:
Marco Mariani 2017-10-26 12:12:45 +02:00
parent 7e7ba6bb17
commit 0a2ce1a357
2 changed files with 9 additions and 5 deletions

View File

@ -65,6 +65,7 @@ linuxkit run openstack \
-password=xxx \
-project=linuxkit \
-keyname=deadline_ed25519 \
-sec-groups=allow_ssh,nginx \
-network c5d02c5f-c625-4539-8aed-1dab3aa85a0a \
LinuxKitTest
```

View File

@ -5,6 +5,7 @@ import (
"fmt"
"os"
"path/filepath"
"strings"
"github.com/gophercloud/gophercloud"
"github.com/gophercloud/gophercloud/openstack"
@ -36,6 +37,7 @@ func runOpenStack(args []string) {
flavorName := flags.String("flavor", defaultOSFlavor, "Instance size (flavor)")
instanceName := flags.String("instancename", "", "Name of instance. Defaults to the name of the image if not specified")
networkID := flags.String("network", "", "The ID of the network to attach the instance to")
secGroups := flags.String("sec-groups", "", "Security Group names separated by comma")
keyName := flags.String("keyname", "", "The name of the SSH keypair to associate with the instance")
passwordFlag := flags.String("password", "", "Password for the specified username")
projectNameFlag := flags.String("project", "", "Name of the Project (aka Tenant) to be used")
@ -93,6 +95,7 @@ func runOpenStack(args []string) {
Name: *instanceName,
Networks: []servers.Network{network},
ServiceClient: client,
SecurityGroups: strings.Split(*secGroups, ","),
}
if *keyName != "" {