Skip to content

Commit 592d922

Browse files
committed
azure: only build and run Hyper-V Gen2 images
Remove the option to specify the Hyper-V Generation during image creation and when running instances through kola. Instead, only build traditional and gallery images using Hyper-V Gen2.
1 parent e5a6451 commit 592d922

File tree

8 files changed

+15
-48
lines changed

8 files changed

+15
-48
lines changed

mantle/cmd/kola/kola.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,6 @@ func writeProps() error {
308308
Location string `json:"location"`
309309
Size string `json:"size"`
310310
AvailabilityZone string `json:"availability_zone"`
311-
HyperVGeneration string `json:"hyper_v_generation"`
312311
}
313312
type DO struct {
314313
Region string `json:"region"`
@@ -365,7 +364,6 @@ func writeProps() error {
365364
Location: kola.AzureOptions.Location,
366365
Size: kola.AzureOptions.Size,
367366
AvailabilityZone: kola.AzureOptions.AvailabilityZone,
368-
HyperVGeneration: kola.AzureOptions.HyperVGeneration,
369367
},
370368
DO: DO{
371369
Region: kola.DOOptions.Region,

mantle/cmd/kola/options.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,6 @@ func init() {
101101
sv(&kola.AzureOptions.Location, "azure-location", "westus", "Azure location (default \"westus\"")
102102
sv(&kola.AzureOptions.Size, "azure-size", "Standard_D2_v2", "Azure machine size (default \"Standard_D2_v2\")")
103103
sv(&kola.AzureOptions.AvailabilityZone, "azure-availability-zone", "1", "Azure Availability Zone (default \"1\")")
104-
sv(&kola.AzureOptions.HyperVGeneration, "azure-hyper-v-generation", "V1", "Azure Hyper-V Generation (default \"V1\")")
105104

106105
// do-specific options
107106
sv(&kola.DOOptions.ConfigPath, "do-config-file", "", "DigitalOcean config file (default \"~/"+auth.DOConfigPath+"\")")

mantle/cmd/ore/azure/azure.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ var (
3434

3535
azureCredentials string
3636
azureLocation string
37-
azureHyperVGen string
3837
azurePublisher string
3938

4039
api *azure.API
@@ -46,7 +45,6 @@ func init() {
4645
sv := Azure.PersistentFlags().StringVar
4746
sv(&azureCredentials, "azure-credentials", "", "Azure credentials file location (default \"~/"+auth.AzureCredentialsPath+"\")")
4847
sv(&azureLocation, "azure-location", "westus", "Azure location (default \"westus\")")
49-
sv(&azureHyperVGen, "azure-hyper-v-generation", "V1", "Azure Hypervisor Generation")
5048
sv(&azurePublisher, "azure-publisher", "CoreOS", "Azure image publisher")
5149
}
5250

@@ -56,7 +54,6 @@ func preauth(cmd *cobra.Command, args []string) error {
5654
a, err := azure.New(&azure.Options{
5755
AzureCredentials: azureCredentials,
5856
Location: azureLocation,
59-
HyperVGeneration: azureHyperVGen,
6057
Publisher: azurePublisher,
6158
})
6259
if err != nil {

mantle/platform/api/azure/gallery.go

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ package azure
1818
import (
1919
"context"
2020
"fmt"
21-
"strings"
2221
"time"
2322

2423
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
@@ -48,16 +47,11 @@ func (a *API) CreateGalleryImage(name, galleryName, resourceGroup, sourceImageID
4847

4948
// enable NVMe support for Gen2 images only. NVMe support is not available on Gen1 images.
5049
// DiskControllerTypes is set to SCSI by default for Gen1 images.
51-
var galleryImageFeatures []*armcompute.GalleryImageFeature
52-
if strings.EqualFold(a.opts.HyperVGeneration, string(armcompute.HyperVGenerationV2)) {
53-
galleryImageFeatures = []*armcompute.GalleryImageFeature{
54-
{
55-
Name: to.Ptr("DiskControllerTypes"),
56-
Value: to.Ptr("SCSI,NVMe"),
57-
},
58-
}
59-
} else {
60-
galleryImageFeatures = nil
50+
galleryImageFeatures := []*armcompute.GalleryImageFeature{
51+
{
52+
Name: to.Ptr("DiskControllerTypes"),
53+
Value: to.Ptr("SCSI,NVMe"),
54+
},
6155
}
6256

6357
// Create a Gallery Image Definition with the specified Hyper-V generation (V1 or V2).
@@ -66,7 +60,7 @@ func (a *API) CreateGalleryImage(name, galleryName, resourceGroup, sourceImageID
6660
Properties: &armcompute.GalleryImageProperties{
6761
OSState: to.Ptr(armcompute.OperatingSystemStateTypesGeneralized),
6862
OSType: to.Ptr(armcompute.OperatingSystemTypesLinux),
69-
HyperVGeneration: to.Ptr(armcompute.HyperVGeneration(a.opts.HyperVGeneration)),
63+
HyperVGeneration: to.Ptr(armcompute.HyperVGeneration(armcompute.HyperVGenerationV2)),
7064
Identifier: &armcompute.GalleryImageIdentifier{
7165
Publisher: &a.opts.Publisher,
7266
Offer: to.Ptr(name),

mantle/platform/api/azure/image.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ func (a *API) CreateImage(name, resourceGroup, blobURI string) (armcompute.Image
2828
Name: &name,
2929
Location: &a.opts.Location,
3030
Properties: &armcompute.ImageProperties{
31-
HyperVGeneration: to.Ptr(armcompute.HyperVGenerationTypes(a.opts.HyperVGeneration)),
31+
HyperVGeneration: to.Ptr(armcompute.HyperVGenerationTypes(armcompute.HyperVGenerationTypesV2)),
3232
StorageProfile: &armcompute.ImageStorageProfile{
3333
OSDisk: &armcompute.ImageOSDisk{
3434
OSType: to.Ptr(armcompute.OperatingSystemTypesLinux),

mantle/platform/api/azure/instance.go

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ import (
2424
"math"
2525
"math/big"
2626
"regexp"
27-
"strings"
2827
"time"
2928

3029
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
@@ -108,13 +107,8 @@ func (a *API) getVMParameters(name, userdata, sshkey, storageAccountURI, size st
108107
}
109108
}
110109
// UltraSSDEnabled=true is required for NVMe support on Gen2 VMs
111-
var additionalCapabilities *armcompute.AdditionalCapabilities
112-
if strings.EqualFold(a.opts.HyperVGeneration, string(armcompute.HyperVGenerationV2)) {
113-
additionalCapabilities = &armcompute.AdditionalCapabilities{
114-
UltraSSDEnabled: to.Ptr(true),
115-
}
116-
} else {
117-
additionalCapabilities = nil
110+
additionalCapabilities := &armcompute.AdditionalCapabilities{
111+
UltraSSDEnabled: to.Ptr(true),
118112
}
119113
return armcompute.VirtualMachine{
120114
Name: &name,

mantle/platform/api/azure/network.go

Lines changed: 6 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,8 @@ package azure
1818
import (
1919
"context"
2020
"fmt"
21-
"strings"
2221

2322
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
24-
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute"
2523
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork"
2624

2725
"github.com/coreos/coreos-assembler/mantle/util"
@@ -91,25 +89,13 @@ func (a *API) createPublicIP(resourceGroup string) (armnetwork.PublicIPAddress,
9189
var ipZones []*string
9290

9391
// set SKU=Standard, Allocation Method=Static and Availability Zone on public IPs when creating Gen2 images
94-
if strings.EqualFold(a.opts.HyperVGeneration, string(armcompute.HyperVGenerationV2)) {
95-
ipSKU = &armnetwork.PublicIPAddressSKU{
96-
Name: to.Ptr(armnetwork.PublicIPAddressSKUNameStandard),
97-
}
98-
ipProperties = &armnetwork.PublicIPAddressPropertiesFormat{
99-
PublicIPAllocationMethod: to.Ptr(armnetwork.IPAllocationMethodStatic),
100-
}
101-
ipZones = []*string{to.Ptr(a.opts.AvailabilityZone)}
102-
// gen 1
103-
} else {
104-
ipSKU = &armnetwork.PublicIPAddressSKU{
105-
Name: to.Ptr(armnetwork.PublicIPAddressSKUNameBasic),
106-
}
107-
ipProperties = &armnetwork.PublicIPAddressPropertiesFormat{
108-
PublicIPAllocationMethod: to.Ptr(armnetwork.IPAllocationMethodDynamic),
109-
}
110-
// No Zones for Gen1
111-
ipZones = nil
92+
ipSKU = &armnetwork.PublicIPAddressSKU{
93+
Name: to.Ptr(armnetwork.PublicIPAddressSKUNameStandard),
94+
}
95+
ipProperties = &armnetwork.PublicIPAddressPropertiesFormat{
96+
PublicIPAllocationMethod: to.Ptr(armnetwork.IPAllocationMethodStatic),
11297
}
98+
ipZones = []*string{to.Ptr(a.opts.AvailabilityZone)}
11399

114100
poller, err := a.ipClient.BeginCreateOrUpdate(ctx, resourceGroup, name, armnetwork.PublicIPAddress{
115101
Location: to.Ptr(a.opts.Location),

mantle/platform/api/azure/options.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ type Options struct {
3333
Size string
3434
Location string
3535
AvailabilityZone string
36-
HyperVGeneration string
3736

3837
SubscriptionName string
3938
SubscriptionID string

0 commit comments

Comments
 (0)