Skip to content

Commit 9f29a63

Browse files
authored
Merge pull request #757 from threefoldtech/support-noop-workload
Support NOOP workload
2 parents 3fc138d + a908cfe commit 9f29a63

File tree

5 files changed

+17
-4
lines changed

5 files changed

+17
-4
lines changed

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ require (
3030
github.com/shirou/gopsutil v2.19.11+incompatible
3131
github.com/stretchr/testify v1.5.1
3232
github.com/termie/go-shutil v0.0.0-20140729215957-bcacb06fecae
33-
github.com/threefoldtech/tfexplorer v0.2.6
33+
github.com/threefoldtech/tfexplorer v0.2.7-0.20200429090008-f462f9a8d76c
3434
github.com/threefoldtech/zbus v0.1.3
3535
github.com/urfave/cli v1.22.3
3636
github.com/vishvananda/netlink v1.0.0

go.sum

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -557,8 +557,8 @@ github.com/syndtr/gocapability v0.0.0-20180916011248-d98352740cb2/go.mod h1:hkRG
557557
github.com/termie/go-shutil v0.0.0-20140729215957-bcacb06fecae h1:vgGSvdW5Lqg+I1aZOlG32uyE6xHpLdKhZzcTEktz5wM=
558558
github.com/termie/go-shutil v0.0.0-20140729215957-bcacb06fecae/go.mod h1:quDq6Se6jlGwiIKia/itDZxqC5rj6/8OdFyMMAwTxCs=
559559
github.com/threefoldtech/tfexplorer v0.2.5/go.mod h1:TugylEDgMNKk4ZIzee9PpVmIcLNLaRLdiXuhHTt/AR0=
560-
github.com/threefoldtech/tfexplorer v0.2.6 h1:Jk8qA5dMVMX9YWZ8IC7zkXiOxClGy2M//OVPmwWe4Cc=
561-
github.com/threefoldtech/tfexplorer v0.2.6/go.mod h1:ozAe2OYR4ALp2PtyKT1A6UiTI+0ZcFU2UfUaRd1P5eE=
560+
github.com/threefoldtech/tfexplorer v0.2.7-0.20200429090008-f462f9a8d76c h1:5tx6tw6P2uzQCCAAsjubA7p4ozKJXV0TMedIPCbGDgk=
561+
github.com/threefoldtech/tfexplorer v0.2.7-0.20200429090008-f462f9a8d76c/go.mod h1:ozAe2OYR4ALp2PtyKT1A6UiTI+0ZcFU2UfUaRd1P5eE=
562562
github.com/threefoldtech/zbus v0.1.3 h1:18DnIzximRbATle5ZdZz0i84n/bCYB8k/gkhr2dXayc=
563563
github.com/threefoldtech/zbus v0.1.3/go.mod h1:ZtiRpcqzEBJetVQDsEbw0p48h/AF3O1kf0tvd30I0BU=
564564
github.com/threefoldtech/zos v0.2.4-rc2/go.mod h1:7A2oflcmSVsHFC4slOcydWgJyFBMFMH9wsaTRv+CnTA=
@@ -784,5 +784,4 @@ gotest.tools v2.2.0+incompatible h1:VsBPFP1AI068pPrMxtb/S8Zkgf9xEmTLJjfM+P5UIEo=
784784
gotest.tools v2.2.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81HFBacw=
785785
honnef.co/go/tools v0.0.0-20180728063816-88497007e858/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
786786
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
787-
honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc h1:/hemPrYIhOhy8zYrNj+069zDB68us2sMGsfkFJO0iZs=
788787
honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=

pkg/provision/primitives/converter.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,8 @@ func WorkloadToProvisionType(w workloads.ReservationWorkload) (*provision.Reserv
249249
if err != nil {
250250
return nil, err
251251
}
252+
case nil:
253+
// no content, no conversion
252254
default:
253255
return nil, fmt.Errorf("unknown workload type (%s) (%T)", w.Type.String(), tmp)
254256
}

pkg/provision/reservation.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@ import (
1515
// ReservationType type
1616
type ReservationType string
1717

18+
const (
19+
//NOOPReservation type
20+
NOOPReservation ReservationType = "noop"
21+
)
22+
1823
// Reservation struct
1924
type Reservation struct {
2025
// ID of the reservation

pkg/provision/source.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,13 @@ func (s *pollSource) Reservations(ctx context.Context) <-chan *Reservation {
9191
if current >= next {
9292
next = current + 1
9393
}
94+
95+
if r.Type == NOOPReservation {
96+
// special type of reservation that does nothing
97+
// we just ignore it here.
98+
continue
99+
}
100+
94101
ch <- r
95102
}
96103
}

0 commit comments

Comments
 (0)