5
5
"context"
6
6
"fmt"
7
7
"os"
8
+ "slices"
8
9
9
10
"github.com/pkg/errors"
10
11
"github.com/rs/zerolog/log"
@@ -13,6 +14,8 @@ import (
13
14
"github.com/threefoldtech/tfgrid-sdk-go/grid-cli/internal/config"
14
15
"github.com/threefoldtech/tfgrid-sdk-go/grid-cli/internal/filters"
15
16
"github.com/threefoldtech/tfgrid-sdk-go/grid-client/deployer"
17
+ client "github.com/threefoldtech/tfgrid-sdk-go/grid-client/node"
18
+ "github.com/threefoldtech/tfgrid-sdk-go/grid-client/subi"
16
19
"github.com/threefoldtech/tfgrid-sdk-go/grid-client/workloads"
17
20
"github.com/threefoldtech/tfgrid-sdk-go/grid-client/zos"
18
21
)
@@ -130,7 +133,16 @@ var deployVMCmd = &cobra.Command{
130
133
}
131
134
132
135
// if no public ips or yggdrasil then we should go for the light deployment
133
- if ! ipv4 && ! ipv6 && ! ygg {
136
+ isLight := ! ipv4 && ! ipv6 && ! ygg
137
+
138
+ if node != 0 {
139
+ isLight , err = isZos4Node (cmd .Context (), t .NcPool , t .SubstrateConn , node )
140
+ if err != nil {
141
+ log .Fatal ().Err (err ).Send ()
142
+ }
143
+ }
144
+
145
+ if isLight {
134
146
vm := workloads.VMLight {
135
147
Name : name ,
136
148
EnvVars : env ,
@@ -321,3 +333,16 @@ func executeVMLight(
321
333
322
334
return nil
323
335
}
336
+
337
+ func isZos4Node (ctx context.Context , client client.NodeClientGetter , sub subi.SubstrateExt , node uint32 ) (isLight bool , err error ) {
338
+ cli , err := client .GetNodeClient (sub , node )
339
+ if err != nil {
340
+ return
341
+ }
342
+ feat , err := cli .SystemGetNodeFeatures (ctx )
343
+ if err != nil {
344
+ return
345
+ }
346
+
347
+ return slices .Contains (feat , zos .NetworkLightType ), nil
348
+ }
0 commit comments