Browse Source

Move towards using external binaries / RPC plugins

- First RPC steps

- Work on some flaws in RPC model

- Remove unused TLS settings from Engine and Swarm options

- Add code to correctly encode data over the network

- Add client driver for RPC

- Rename server driver file

- Start to make marshal make sense

- Fix silly RPC method args and add client

- Fix some issues with RPC calls, and marshaling

- Simplify plugin main.go

- Move towards 100% plugin in CLI

- Ensure that plugin servers are cleaned up properly

- Make flag parsing for driver flags work properly

Includes some work carried from @dmp42 updating the build process and
tests to use the new method.

Signed-off-by: Nathan LeClaire <nathan.leclaire@gmail.com>
Nathan LeClaire 3 years ago
parent
commit
295679e064
1 changed files with 36 additions and 32 deletions
  1. 36
    32
      drivers/openstack/openstack.go

+ 36
- 32
drivers/openstack/openstack.go View File

@@ -6,9 +6,9 @@ import (
6 6
 	"strings"
7 7
 	"time"
8 8
 
9
-	"github.com/codegangsta/cli"
10 9
 	"github.com/docker/machine/libmachine/drivers"
11 10
 	"github.com/docker/machine/libmachine/log"
11
+	"github.com/docker/machine/libmachine/mcnflag"
12 12
 	"github.com/docker/machine/libmachine/mcnutils"
13 13
 	"github.com/docker/machine/libmachine/ssh"
14 14
 	"github.com/docker/machine/libmachine/state"
@@ -49,146 +49,150 @@ const (
49 49
 	defaultActiveTimeout = 200
50 50
 )
51 51
 
52
-func init() {
53
-	drivers.Register("openstack", &drivers.RegisteredDriver{
54
-		GetCreateFlags: GetCreateFlags,
55
-	})
56
-}
57
-
58
-func GetCreateFlags() []cli.Flag {
59
-	return []cli.Flag{
60
-		cli.StringFlag{
52
+func (d *Driver) GetCreateFlags() []mcnflag.Flag {
53
+	return []mcnflag.Flag{
54
+		mcnflag.StringFlag{
61 55
 			EnvVar: "OS_AUTH_URL",
62 56
 			Name:   "openstack-auth-url",
63 57
 			Usage:  "OpenStack authentication URL",
64 58
 			Value:  "",
65 59
 		},
66
-		cli.BoolFlag{
60
+		mcnflag.BoolFlag{
67 61
 			EnvVar: "OS_INSECURE",
68 62
 			Name:   "openstack-insecure",
69 63
 			Usage:  "Disable TLS credential checking.",
70 64
 		},
71
-		cli.StringFlag{
65
+		mcnflag.StringFlag{
72 66
 			EnvVar: "OS_DOMAIN_ID",
73 67
 			Name:   "openstack-domain-id",
74 68
 			Usage:  "OpenStack domain ID (identity v3 only)",
75 69
 			Value:  "",
76 70
 		},
77
-		cli.StringFlag{
71
+		mcnflag.StringFlag{
78 72
 			EnvVar: "OS_DOMAIN_NAME",
79 73
 			Name:   "openstack-domain-name",
80 74
 			Usage:  "OpenStack domain name (identity v3 only)",
81 75
 			Value:  "",
82 76
 		},
83
-		cli.StringFlag{
77
+		mcnflag.StringFlag{
84 78
 			EnvVar: "OS_USERNAME",
85 79
 			Name:   "openstack-username",
86 80
 			Usage:  "OpenStack username",
87 81
 			Value:  "",
88 82
 		},
89
-		cli.StringFlag{
83
+		mcnflag.StringFlag{
90 84
 			EnvVar: "OS_PASSWORD",
91 85
 			Name:   "openstack-password",
92 86
 			Usage:  "OpenStack password",
93 87
 			Value:  "",
94 88
 		},
95
-		cli.StringFlag{
89
+		mcnflag.StringFlag{
96 90
 			EnvVar: "OS_TENANT_NAME",
97 91
 			Name:   "openstack-tenant-name",
98 92
 			Usage:  "OpenStack tenant name",
99 93
 			Value:  "",
100 94
 		},
101
-		cli.StringFlag{
95
+		mcnflag.StringFlag{
102 96
 			EnvVar: "OS_TENANT_ID",
103 97
 			Name:   "openstack-tenant-id",
104 98
 			Usage:  "OpenStack tenant id",
105 99
 			Value:  "",
106 100
 		},
107
-		cli.StringFlag{
101
+		mcnflag.StringFlag{
108 102
 			EnvVar: "OS_REGION_NAME",
109 103
 			Name:   "openstack-region",
110 104
 			Usage:  "OpenStack region name",
111 105
 			Value:  "",
112 106
 		},
113
-		cli.StringFlag{
107
+		mcnflag.StringFlag{
114 108
 			EnvVar: "OS_AVAILABILITY_ZONE",
115 109
 			Name:   "openstack-availability-zone",
116 110
 			Usage:  "OpenStack availability zone",
117 111
 			Value:  "",
118 112
 		},
119
-		cli.StringFlag{
113
+		mcnflag.StringFlag{
120 114
 			EnvVar: "OS_ENDPOINT_TYPE",
121 115
 			Name:   "openstack-endpoint-type",
122 116
 			Usage:  "OpenStack endpoint type (adminURL, internalURL or publicURL)",
123 117
 			Value:  "",
124 118
 		},
125
-		cli.StringFlag{
119
+		mcnflag.StringFlag{
126 120
 			EnvVar: "OS_FLAVOR_ID",
127 121
 			Name:   "openstack-flavor-id",
128 122
 			Usage:  "OpenStack flavor id to use for the instance",
129 123
 			Value:  "",
130 124
 		},
131
-		cli.StringFlag{
125
+		mcnflag.StringFlag{
132 126
 			EnvVar: "OS_FLAVOR_NAME",
133 127
 			Name:   "openstack-flavor-name",
134 128
 			Usage:  "OpenStack flavor name to use for the instance",
135 129
 			Value:  "",
136 130
 		},
137
-		cli.StringFlag{
131
+		mcnflag.StringFlag{
138 132
 			EnvVar: "OS_IMAGE_ID",
139 133
 			Name:   "openstack-image-id",
140 134
 			Usage:  "OpenStack image id to use for the instance",
141 135
 			Value:  "",
142 136
 		},
143
-		cli.StringFlag{
137
+		mcnflag.StringFlag{
144 138
 			EnvVar: "OS_IMAGE_NAME",
145 139
 			Name:   "openstack-image-name",
146 140
 			Usage:  "OpenStack image name to use for the instance",
147 141
 			Value:  "",
148 142
 		},
149
-		cli.StringFlag{
143
+		mcnflag.StringFlag{
150 144
 			EnvVar: "OS_NETWORK_ID",
151 145
 			Name:   "openstack-net-id",
152 146
 			Usage:  "OpenStack network id the machine will be connected on",
153 147
 			Value:  "",
154 148
 		},
155
-		cli.StringFlag{
149
+		mcnflag.StringFlag{
156 150
 			EnvVar: "OS_NETWORK_NAME",
157 151
 			Name:   "openstack-net-name",
158 152
 			Usage:  "OpenStack network name the machine will be connected on",
159 153
 			Value:  "",
160 154
 		},
161
-		cli.StringFlag{
155
+		mcnflag.StringFlag{
162 156
 			EnvVar: "OS_SECURITY_GROUPS",
163 157
 			Name:   "openstack-sec-groups",
164 158
 			Usage:  "OpenStack comma separated security groups for the machine",
165 159
 			Value:  "",
166 160
 		},
167
-		cli.StringFlag{
161
+		mcnflag.StringFlag{
168 162
 			EnvVar: "OS_FLOATINGIP_POOL",
169 163
 			Name:   "openstack-floatingip-pool",
170 164
 			Usage:  "OpenStack floating IP pool to get an IP from to assign to the instance",
171 165
 			Value:  "",
172 166
 		},
173
-		cli.IntFlag{
167
+		mcnflag.IntFlag{
174 168
 			EnvVar: "OS_IP_VERSION",
175 169
 			Name:   "openstack-ip-version",
176 170
 			Usage:  "OpenStack version of IP address assigned for the machine",
177 171
 			Value:  4,
178 172
 		},
179
-		cli.StringFlag{
173
+		mcnflag.StringFlag{
180 174
 			EnvVar: "OS_SSH_USER",
181 175
 			Name:   "openstack-ssh-user",
182 176
 			Usage:  "OpenStack SSH user",
183 177
 			Value:  defaultSSHUser,
184 178
 		},
185
-		cli.IntFlag{
179
+		mcnflag.IntFlag{
186 180
 			EnvVar: "OS_SSH_PORT",
187 181
 			Name:   "openstack-ssh-port",
188 182
 			Usage:  "OpenStack SSH port",
189 183
 			Value:  defaultSSHPort,
190 184
 		},
191
-		cli.IntFlag{
185
+		mcnflag.StringFlag{
186
+			Name:  "openstack-ssh-user",
187
+			Usage: "OpenStack SSH user",
188
+			Value: defaultSSHUser,
189
+		},
190
+		mcnflag.IntFlag{
191
+			Name:  "openstack-ssh-port",
192
+			Usage: "OpenStack SSH port",
193
+			Value: defaultSSHPort,
194
+		},
195
+		mcnflag.IntFlag{
192 196
 			EnvVar: "OS_ACTIVE_TIMEOUT",
193 197
 			Name:   "openstack-active-timeout",
194 198
 			Usage:  "OpenStack active timeout",

Loading…
Cancel
Save