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

« back to all changes in this revision

Viewing changes to src/github.com/juju/juju/state/volume.go

  • Committer: Nicholas Skaggs
  • Date: 2016-09-30 14:39:30 UTC
  • mfrom: (1.8.1)
  • Revision ID: nicholas.skaggs@canonical.com-20160930143930-vwwhrefh6ftckccy
import upstream

Show diffs side-by-side

added added

removed removed

Lines of Context:
673
673
                        Update: bson.D{{"$set", bson.D{{"life", Dead}}}},
674
674
                }}
675
675
        }
676
 
        cleanupOp := st.newCleanupOp(cleanupAttachmentsForDyingVolume, v.doc.Name)
 
676
        cleanupOp := newCleanupOp(cleanupAttachmentsForDyingVolume, v.doc.Name)
677
677
        hasAttachments := bson.D{{"attachmentcount", bson.D{{"$gt", 0}}}}
678
678
        return []txn.Op{{
679
679
                C:      volumesC,
747
747
                return nil, names.VolumeTag{}, errors.Annotate(err, "cannot generate volume name")
748
748
        }
749
749
        status := statusDoc{
750
 
                Status: status.StatusPending,
751
 
                // TODO(fwereade): 2016-03-17 lp:1558657
752
 
                Updated: time.Now().UnixNano(),
 
750
                Status:  status.Pending,
 
751
                Updated: st.clock.Now().UnixNano(),
753
752
        }
754
753
        doc := volumeDoc{
755
754
                Name:      name,
1040
1039
// SetVolumeStatus sets the status of the specified volume.
1041
1040
func (st *State) SetVolumeStatus(tag names.VolumeTag, volumeStatus status.Status, info string, data map[string]interface{}, updated *time.Time) error {
1042
1041
        switch volumeStatus {
1043
 
        case status.StatusAttaching, status.StatusAttached, status.StatusDetaching, status.StatusDetached, status.StatusDestroying:
1044
 
        case status.StatusError:
 
1042
        case status.Attaching, status.Attached, status.Detaching, status.Detached, status.Destroying:
 
1043
        case status.Error:
1045
1044
                if info == "" {
1046
1045
                        return errors.Errorf("cannot set status %q without info", volumeStatus)
1047
1046
                }
1048
 
        case status.StatusPending:
 
1047
        case status.Pending:
1049
1048
                // If a volume is not yet provisioned, we allow its status
1050
1049
                // to be set back to pending (when a retry is to occur).
1051
1050
                v, err := st.Volume(tag)