Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added 'disableHighAvailability' flag for resources #238

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions services/compute/compute.go
Original file line number Diff line number Diff line change
Expand Up @@ -850,6 +850,8 @@ type GalleryImageProperties struct {
SourceType common.ImageSource `json:"sourceType,omitempty"`
// CloudInitDataSource - READ-ONLY; The cloud init data source to be used with the image. [NoCloud, Azure]. Default Value – NoCloud. For marketplace images it will be Azure.
CloudInitDataSource common.CloudInitDataSource `json:"cloudInitDataSource,omitempty"`
// Disable High Availability
DisableHighAvailability *bool `json:"disableHighAvailability,omitempty"`
}

// GalleryImage specifies information about the gallery Image Definition that you want to create or update.
Expand Down
12 changes: 12 additions & 0 deletions services/compute/galleryimage/galleryimage.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,17 @@ func getWssdGalleryImage(c *compute.GalleryImage, locationName, imagePath string
wssdgalleryimage.ContainerName = *c.GalleryImageProperties.ContainerName
}

if c.DisableHighAvailability != nil {
wssdgalleryimage.DisableHighAvailability = *c.DisableHighAvailability
// If HA is disabled, then throw error
if wssdgalleryimage.DisableHighAvailability {
return nil, errors.Wrapf(errors.NotSupported, "GalleryImage currently does not support Non-HighAvailability mode")
}
} else {
// If no value specified, set value as false
wssdgalleryimage.DisableHighAvailability = false
}

if c.GalleryImageProperties != nil {
wssdgalleryimage.SourceType = c.SourceType
wssdgalleryimage.CloudInitDataSource = c.GalleryImageProperties.CloudInitDataSource
Expand All @@ -56,6 +67,7 @@ func getGalleryImage(c *wssdcloudcompute.GalleryImage, location string) *compute
Statuses: status.GetStatuses(c.GetStatus()),
ContainerName: &c.ContainerName,
HyperVGeneration: c.HyperVGeneration,
DisableHighAvailability: &c.DisableHighAvailability,
},
Tags: tags.ProtoToMap(c.Tags),
}
Expand Down
9 changes: 9 additions & 0 deletions services/storage/container/container.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,14 @@ func getWssdContainer(c *storage.Container, locationName string) (*wssdcloudstor
}
wssdcontainer.Isolated = c.Isolated
}

if c.DisableHighAvailability != nil {
wssdcontainer.DisableHighAvailability = *c.DisableHighAvailability
} else {
// If HighAvailability mode isn't specified, proceed with default behavior i.e., HA
wssdcontainer.DisableHighAvailability = false
}

return wssdcontainer, nil
}

Expand Down Expand Up @@ -71,6 +79,7 @@ func getContainer(c *wssdcloudstorage.Container, location string) *storage.Conta
AvailableSize: availSize,
TotalSize: totalSize,
},
DisableHighAvailability: &c.DisableHighAvailability,
},
Version: &c.Status.Version.Number,
Tags: tags.ProtoToMap(c.Tags),
Expand Down
4 changes: 4 additions & 0 deletions services/storage/storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ type VirtualHardDiskProperties struct {
CloudInitDataSource common.CloudInitDataSource `json:"cloudInitDataSource,omitempty"`
// Container name
ContainerName *string `json:"containername,omitempty"`
// Disable High Availability
DisableHighAvailability *bool `json:"disableHighAvailability,omitempty"`
}

// VirtualHardDisk defines the structure of a VHD
Expand Down Expand Up @@ -72,6 +74,8 @@ type ContainerProperties struct {
// State - State
Statuses map[string]*string `json:"statuses"`
*ContainerInfo `json:"info"`
// Disable High Availability
DisableHighAvailability *bool `json:"disableHighAvailability,omitempty"`
}

// Container defines the structure of a VHD
Expand Down
5 changes: 5 additions & 0 deletions services/storage/virtualharddisk/virtualharddisk.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ func getWssdVirtualHardDisk(c *storage.VirtualHardDisk, groupName, containerName

wssdvhd.CloudInitDataSource = c.CloudInitDataSource
}

if c.DisableHighAvailability != nil {
wssdvhd.DisableHighAvailability = *c.DisableHighAvailability
}
return wssdvhd, nil
}

Expand All @@ -82,6 +86,7 @@ func getVirtualHardDisk(c *wssdcloudstorage.VirtualHardDisk, group string) *stor
HyperVGeneration: c.HyperVGeneration,
DiskFileFormat: c.DiskFileFormat,
ContainerName: &c.ContainerName,
DisableHighAvailability: &c.DisableHighAvailability,
},
Tags: tags.ProtoToMap(c.Tags),
}
Expand Down
Loading