Skip to content

Commit

Permalink
mantle/api: gcloud: remove FCOS specific image GuestOSFeatures
Browse files Browse the repository at this point in the history
We consider the VIRTIO_SCSI_MULTIQUEUE, UEFI_COMPATIBLE,
and SECURE_BOOT flags to be standard now so we can
unconditionally add them to GCP images we create and get
rid of the --fcos option.
  • Loading branch information
dustymabe authored and openshift-merge-robot committed Apr 9, 2020
1 parent 94602e2 commit a6329fa
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 25 deletions.
4 changes: 1 addition & 3 deletions mantle/cmd/ore/gcloud/create-image.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ var (
createImageRoot string
createImageName string
createImageForce bool
createImageFcos bool
)

func init() {
Expand All @@ -60,7 +59,6 @@ func init() {
"Storage image name")
cmdCreateImage.Flags().BoolVar(&createImageForce, "force",
false, "overwrite existing GCE images without prompt")
cmdCreateImage.Flags().BoolVar(&uploadFedora, "fcos", false, "Flag this is Fedora CoreOS (or a derivative); currently enables SECURE_BOOT and UEFI_COMPATIBLE")
GCloud.AddCommand(cmdCreateImage)
}

Expand Down Expand Up @@ -118,7 +116,7 @@ func runCreateImage(cmd *cobra.Command, args []string) {
_, pending, err := api.CreateImage(&gcloud.ImageSpec{
Name: imageNameGCE,
SourceImage: storageSrc,
}, createImageForce, createImageFcos)
}, createImageForce)
if err == nil {
err = pending.Wait()
}
Expand Down
6 changes: 2 additions & 4 deletions mantle/cmd/ore/gcloud/upload.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ var (
uploadBucket string
uploadImageName string
uploadFile string
uploadFedora bool
uploadForce bool
uploadWriteUrl string
uploadImageFamily string
Expand All @@ -53,7 +52,6 @@ func init() {
cmdUpload.MarkFlagRequired("name")
cmdUpload.Flags().StringVar(&uploadFile, "file", "", "path to image .tar.gz file to upload")
cmdUpload.MarkFlagRequired("file")
cmdUpload.Flags().BoolVar(&uploadFedora, "fcos", false, "Flag this is Fedora CoreOS (or a derivative); currently enables SECURE_BOOT and UEFI_COMPATIBLE")
cmdUpload.Flags().BoolVar(&uploadForce, "force", false, "overwrite existing GS and GCE images without prompt")
cmdUpload.Flags().StringVar(&uploadWriteUrl, "write-url", "", "output the uploaded URL to the named file")
cmdUpload.Flags().StringVar(&uploadImageFamily, "family", "", "GCP image family to attach image to")
Expand Down Expand Up @@ -135,7 +133,7 @@ func runUpload(cmd *cobra.Command, args []string) {
Family: uploadImageFamily,
SourceImage: storageSrc,
Description: uploadImageDescription,
}, uploadForce, uploadFedora)
}, uploadForce)
if err == nil {
err = pending.Wait()
}
Expand All @@ -156,7 +154,7 @@ func runUpload(cmd *cobra.Command, args []string) {
Family: uploadImageFamily,
SourceImage: storageSrc,
Description: uploadImageDescription,
}, true, uploadFedora)
}, true)
if err == nil {
err = pending.Wait()
}
Expand Down
2 changes: 1 addition & 1 deletion mantle/cmd/plume/release.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ func gceUploadImage(spec *channelSpec, api *gcloud.API, obj *gs.Object, name, de
Name: name,
Description: desc,
Licenses: spec.GCE.Licenses,
}, false, selectedDistro == "fcos")
}, false)
if err != nil {
plog.Fatalf("GCE image creation failed: %v", err)
}
Expand Down
17 changes: 7 additions & 10 deletions mantle/platform/api/gcloud/image.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ type ImageSpec struct {
// CreateImage creates an image on GCE and returns operation details and
// a Pending. If overwrite is true, an existing image will be overwritten
// if it exists.
func (a *API) CreateImage(spec *ImageSpec, overwrite, fedora bool) (*compute.Operation, *Pending, error) {
func (a *API) CreateImage(spec *ImageSpec, overwrite bool) (*compute.Operation, *Pending, error) {
licenses := make([]string, len(spec.Licenses))
for i, l := range spec.Licenses {
license, err := a.compute.Licenses.Get(a.options.Project, l).Do()
Expand Down Expand Up @@ -75,15 +75,12 @@ func (a *API) CreateImage(spec *ImageSpec, overwrite, fedora bool) (*compute.Ope
{
Type: "VIRTIO_SCSI_MULTIQUEUE",
},
}
if fedora {
features = append(features,
&compute.GuestOsFeature{
Type: "UEFI_COMPATIBLE",
},
&compute.GuestOsFeature{
Type: "SECURE_BOOT",
})
{
Type: "UEFI_COMPATIBLE",
},
{
Type: "SECURE_BOOT",
},
}

image := &compute.Image{
Expand Down
7 changes: 0 additions & 7 deletions src/cosalib/gcp.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,6 @@ def gcp_run_ore(build, args):
'--write-url', urltmp,
])

if args.fcos:
ore_args.extend(['--fcos'])
if args.family:
ore_args.extend(['--family', args.family])
if args.description:
Expand Down Expand Up @@ -105,11 +103,6 @@ def gcp_cli(parser):
parser.add_argument("--project",
help="GCP Project name",
default=os.environ.get("GCP_PROJECT_NAME"))
parser.add_argument("--fcos",
help="""Flag this is Fedora CoreOS (or a derivative);
Currently enables SECURE_BOOT and UEFI_COMPATIBLE""",
action="store_true",
default=False)
parser.add_argument("--family",
help="GCP image family to attach image to",
default=None)
Expand Down

0 comments on commit a6329fa

Please sign in to comment.