Do not require 'gpu-standard-v1' platform_id for any GPU-based config.

Support use another kind of GPU platforms.
This commit is contained in:
Gennady Lipenkov 2020-06-03 20:58:39 +03:00
parent 434c9bcae0
commit df371b7e25
2 changed files with 1 additions and 6 deletions

View File

@ -248,11 +248,6 @@ func (c *Config) Prepare(raws ...interface{}) ([]string, error) {
c.FolderID = os.Getenv("YC_FOLDER_ID") c.FolderID = os.Getenv("YC_FOLDER_ID")
} }
if c.PlatformID != defaultGpuPlatformID && c.InstanceGpus != 0 {
errs = packer.MultiErrorAppend(
errs, fmt.Errorf("for instances with gpu platform_id must be specified as `%s`", defaultGpuPlatformID))
}
if c.Token == "" && c.ServiceAccountKeyFile == "" { if c.Token == "" && c.ServiceAccountKeyFile == "" {
errs = packer.MultiErrorAppend( errs = packer.MultiErrorAppend(
errs, errors.New("a token or service account key file must be specified")) errs, errors.New("a token or service account key file must be specified"))

View File

@ -231,7 +231,7 @@ func TestGpuDefaultPlatformID(t *testing.T) {
var c Config var c Config
c.Prepare(raw) c.Prepare(raw)
if c.PlatformID != "gpu-standard-v1" { if c.PlatformID != "gpu-standard-v1" {
t.Fatalf("expected 'gpu-standard-v1', but got '%s'", c.PlatformID) t.Fatalf("expected 'gpu-standard-v1' as default platform_id for instance with GPU(s), but got '%s'", c.PlatformID)
} }
} }