~juju-qa/ubuntu/xenial/juju/xenial-2.0-beta3

« back to all changes in this revision

Viewing changes to src/github.com/juju/juju/worker/storageprovisioner/volume_ops.go

  • Committer: Martin Packman
  • Date: 2016-03-30 19:31:08 UTC
  • mfrom: (1.1.41)
  • Revision ID: martin.packman@canonical.com-20160330193108-h9iz3ak334uk0z5r
Merge new upstream source 2.0~beta3

Show diffs side-by-side

added added

removed removed

Lines of Context:
9
9
 
10
10
        "github.com/juju/juju/apiserver/params"
11
11
        "github.com/juju/juju/environs/config"
 
12
        "github.com/juju/juju/status"
12
13
        "github.com/juju/juju/storage"
13
14
)
14
15
 
38
39
                        }
39
40
                        statuses = append(statuses, params.EntityStatusArgs{
40
41
                                Tag:    volumeParams[i].Tag.String(),
41
 
                                Status: params.StatusError,
 
42
                                Status: status.StatusError,
42
43
                                Info:   err.Error(),
43
44
                        })
44
45
                        logger.Debugf(
57
58
                for i, result := range results {
58
59
                        statuses = append(statuses, params.EntityStatusArgs{
59
60
                                Tag:    volumeParams[i].Tag.String(),
60
 
                                Status: params.StatusAttaching,
 
61
                                Status: status.StatusAttaching,
61
62
                        })
62
 
                        status := &statuses[len(statuses)-1]
 
63
                        entityStatus := &statuses[len(statuses)-1]
63
64
                        if result.Error != nil {
64
65
                                // Reschedule the volume creation.
65
66
                                reschedule = append(reschedule, ops[volumeParams[i].Tag])
68
69
                                // that we will retry. When we distinguish between
69
70
                                // transient and permanent errors, we will set the
70
71
                                // status to "error" for permanent errors.
71
 
                                status.Status = params.StatusPending
72
 
                                status.Info = result.Error.Error()
 
72
                                entityStatus.Status = status.StatusPending
 
73
                                entityStatus.Info = result.Error.Error()
73
74
                                logger.Debugf(
74
75
                                        "failed to create %s: %v",
75
76
                                        names.ReadableString(volumeParams[i].Tag),
79
80
                        }
80
81
                        volumes = append(volumes, *result.Volume)
81
82
                        if result.VolumeAttachment != nil {
82
 
                                status.Status = params.StatusAttached
 
83
                                entityStatus.Status = status.StatusAttached
83
84
                                volumeAttachments = append(volumeAttachments, *result.VolumeAttachment)
84
85
                        }
85
86
                }
147
148
                        p := volumeAttachmentParams[i]
148
149
                        statuses = append(statuses, params.EntityStatusArgs{
149
150
                                Tag:    p.Volume.String(),
150
 
                                Status: params.StatusAttached,
 
151
                                Status: status.StatusAttached,
151
152
                        })
152
 
                        status := &statuses[len(statuses)-1]
 
153
                        entityStatus := &statuses[len(statuses)-1]
153
154
                        if result.Error != nil {
154
155
                                // Reschedule the volume attachment.
155
156
                                id := params.MachineStorageId{
162
163
                                // indicate that we will retry. When we distinguish
163
164
                                // between transient and permanent errors, we will
164
165
                                // set the status to "error" for permanent errors.
165
 
                                status.Status = params.StatusAttaching
166
 
                                status.Info = result.Error.Error()
 
166
                                entityStatus.Status = status.StatusAttaching
 
167
                                entityStatus.Info = result.Error.Error()
167
168
                                logger.Debugf(
168
169
                                        "failed to attach %s to %s: %v",
169
170
                                        names.ReadableString(p.Volume),
212
213
                        }
213
214
                        statuses = append(statuses, params.EntityStatusArgs{
214
215
                                Tag:    volumeParams[i].Tag.String(),
215
 
                                Status: params.StatusError,
 
216
                                Status: status.StatusError,
216
217
                                Info:   err.Error(),
217
218
                        })
218
219
                        logger.Debugf(
246
247
                        reschedule = append(reschedule, ops[tag])
247
248
                        statuses = append(statuses, params.EntityStatusArgs{
248
249
                                Tag:    tag.String(),
249
 
                                Status: params.StatusDestroying,
 
250
                                Status: status.StatusDestroying,
250
251
                                Info:   err.Error(),
251
252
                        })
252
253
                }
289
290
                                // attachment, we'll have to check if
290
291
                                // there are any other attachments
291
292
                                // before saying the status "detached".
292
 
                                Status: params.StatusDetached,
 
293
                                Status: status.StatusDetached,
293
294
                        })
294
295
                        id := params.MachineStorageId{
295
296
                                MachineTag:    p.Machine.String(),
296
297
                                AttachmentTag: p.Volume.String(),
297
298
                        }
298
 
                        status := &statuses[len(statuses)-1]
 
299
                        entityStatus := &statuses[len(statuses)-1]
299
300
                        if err != nil {
300
301
                                reschedule = append(reschedule, ops[id])
301
 
                                status.Status = params.StatusDetaching
302
 
                                status.Info = err.Error()
 
302
                                entityStatus.Status = status.StatusDetaching
 
303
                                entityStatus.Info = err.Error()
303
304
                                logger.Debugf(
304
305
                                        "failed to detach %s from %s: %v",
305
306
                                        names.ReadableString(p.Volume),