Browse Source

openstack: New machine active timeout parameter

* Adds `--openstack-active-timeout` parameter to set the timeout
  until a machine is active. Closes #1632

Signed-off-by: David Zerulla <ddaze@outlook.de>
David Zerulla 3 years ago
parent
commit
dec4514e15
3 changed files with 10 additions and 1 deletions
  1. 2
    0
      docs/drivers/openstack.md
  2. 1
    1
      drivers/openstack/client.go
  3. 7
    0
      drivers/openstack/openstack.go

+ 2
- 0
docs/drivers/openstack.md View File

@@ -36,6 +36,7 @@ Options:
36 36
    there is no IP address already allocated a new IP will be allocated and assigned to the machine.
37 37
  - `--openstack-ssh-user`: The username to use for SSH into the machine. If not provided `root` will be used.
38 38
  - `--openstack-ssh-port`: Customize the SSH port if the SSH server on the machine does not listen on the default port.
39
+ - `--openstack-active-timeout`: The timeout in seconds until the OpenStack instance must be active.
39 40
 
40 41
 Environment variables and default values:
41 42
 
@@ -62,3 +63,4 @@ Environment variables and default values:
62 63
 | `--openstack-floatingip-pool`    | -                      | -       |
63 64
 | `--openstack-ssh-user`           | -                      | `root`  |
64 65
 | `--openstack-ssh-port`           | -                      | `22`    |
66
+| `--openstack-active-timeout`     | -                      | `200`   |

+ 1
- 1
drivers/openstack/client.go View File

@@ -151,7 +151,7 @@ func (c *GenericClient) WaitForInstanceStatus(d *Driver, status string) error {
151 151
 		}
152 152
 
153 153
 		return false, nil
154
-	}, 50, 4*time.Second)
154
+	}, (d.ActiveTimeout / 4), 4*time.Second)
155 155
 }
156 156
 
157 157
 func (c *GenericClient) GetInstanceIpAddresses(d *Driver) ([]IpAddress, error) {

+ 7
- 0
drivers/openstack/openstack.go View File

@@ -17,6 +17,7 @@ import (
17 17
 type Driver struct {
18 18
 	*drivers.BaseDriver
19 19
 	AuthUrl          string
20
+	ActiveTimeout    int
20 21
 	Insecure         bool
21 22
 	DomainID         string
22 23
 	DomainName       string
@@ -164,6 +165,11 @@ func GetCreateFlags() []cli.Flag {
164 165
 			Usage: "OpenStack SSH port",
165 166
 			Value: 22,
166 167
 		},
168
+		cli.IntFlag{
169
+			Name:  "openstack-active-timeout",
170
+			Usage: "OpenStack active timeout",
171
+			Value: 200,
172
+		},
167 173
 	}
168 174
 }
169 175
 
@@ -193,6 +199,7 @@ func (d *Driver) DriverName() string {
193 199
 
194 200
 func (d *Driver) SetConfigFromFlags(flags drivers.DriverOptions) error {
195 201
 	d.AuthUrl = flags.String("openstack-auth-url")
202
+	d.ActiveTimeout = flags.Int("openstack-active-timeout")
196 203
 	d.Insecure = flags.Bool("openstack-insecure")
197 204
 	d.DomainID = flags.String("openstack-domain-id")
198 205
 	d.DomainName = flags.String("openstack-domain-name")

Loading…
Cancel
Save