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

Various fixes #447

Merged
merged 3 commits into from
Jan 28, 2024
Merged
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
14 changes: 8 additions & 6 deletions cmd/incusd/api_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -3316,13 +3316,15 @@ func evacuateInstances(ctx context.Context, opts evacuateOpts) error {

// Stop the instance if needed.
isRunning := inst.IsRunning()
if opts.stopInstance != nil && isRunning && action != "live-migrate" {
metadata["evacuation_progress"] = fmt.Sprintf("Stopping %q in project %q", inst.Name(), instProject.Name)
_ = opts.op.UpdateMetadata(metadata)
if action != "live-migrate" {
if opts.stopInstance != nil && isRunning {
metadata["evacuation_progress"] = fmt.Sprintf("Stopping %q in project %q", inst.Name(), instProject.Name)
_ = opts.op.UpdateMetadata(metadata)

err := opts.stopInstance(inst, action)
if err != nil {
return err
err := opts.stopInstance(inst, action)
if err != nil {
return err
}
}

if action != "migrate" {
Expand Down
48 changes: 24 additions & 24 deletions internal/server/db/warningtype/warning_type.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,30 +60,30 @@ const (

// TypeNames associates a warning code to its name.
var TypeNames = map[Type]string{
Undefined: "Undefined warning",
MissingCGroupBlkio: "Couldn't find the CGroup blkio",
MissingCGroupBlkioWeight: "Couldn't find the CGroup blkio.weight",
MissingCGroupCPUController: "Couldn't find the CGroup CPU controller",
MissingCGroupCPUsetController: "Couldn't find the CGroup CPUset controller",
MissingCGroupCPUacctController: "Couldn't find the CGroup CPUacct controller",
MissingCGroupDevicesController: "Couldn't find the CGroup devices controller",
MissingCGroupFreezerController: "Couldn't find the CGroup freezer controller",
MissingCGroupHugetlbController: "Couldn't find the CGroup hugetlb controller",
MissingCGroupMemoryController: "Couldn't find the CGroup memory controller",
MissingCGroupPidsController: "Couldn't find the CGroup pids controller",
MissingCGroupMemorySwapAccounting: "Couldn't find the CGroup memory swap accounting",
ClusterTimeSkew: "Time skew detected between leader and local",
AppArmorNotAvailable: "AppArmor support has been disabled",
MissingVirtiofsd: "Missing virtiofsd",
AppArmorDisabledDueToRawDnsmasq: "Skipping AppArmor for dnsmasq due to raw.dnsmasq being set",
LargerIPv6PrefixThanSupported: "IPv6 networks with a prefix larger than 64 aren't properly supported by dnsmasq",
ProxyBridgeNetfilterNotEnabled: "Proxy bridge netfilter not enabled",
NetworkUnvailable: "Network unavailable",
OfflineClusterMember: "Offline cluster member",
InstanceAutostartFailure: "Failed to autostart instance",
InstanceTypeNotOperational: "Instance type not operational",
StoragePoolUnvailable: "Storage pool unavailable",
UnableToUpdateClusterCertificate: "Unable to update cluster certificate",
Undefined: "Undefined warning",
MissingCGroupBlkio: "Couldn't find the CGroup blkio",
MissingCGroupBlkioWeight: "Couldn't find the CGroup blkio.weight",
MissingCGroupCPUController: "Couldn't find the CGroup CPU controller",
MissingCGroupCPUsetController: "Couldn't find the CGroup CPUset controller",
MissingCGroupCPUacctController: "Couldn't find the CGroup CPUacct controller",
MissingCGroupDevicesController: "Couldn't find the CGroup devices controller",
MissingCGroupFreezerController: "Couldn't find the CGroup freezer controller",
MissingCGroupHugetlbController: "Couldn't find the CGroup hugetlb controller",
MissingCGroupMemoryController: "Couldn't find the CGroup memory controller",
MissingCGroupPidsController: "Couldn't find the CGroup pids controller",
MissingCGroupMemorySwapAccounting: "Couldn't find the CGroup memory swap accounting",
ClusterTimeSkew: "Time skew detected between leader and local",
AppArmorNotAvailable: "AppArmor support has been disabled",
MissingVirtiofsd: "Missing virtiofsd",
AppArmorDisabledDueToRawDnsmasq: "Skipping AppArmor for dnsmasq due to raw.dnsmasq being set",
LargerIPv6PrefixThanSupported: "IPv6 networks with a prefix larger than 64 aren't properly supported by dnsmasq",
ProxyBridgeNetfilterNotEnabled: "Proxy bridge netfilter not enabled",
NetworkUnvailable: "Network unavailable",
OfflineClusterMember: "Offline cluster member",
InstanceAutostartFailure: "Failed to autostart instance",
InstanceTypeNotOperational: "Instance type not operational",
StoragePoolUnvailable: "Storage pool unavailable",
UnableToUpdateClusterCertificate: "Unable to update cluster certificate",
}

// Severity returns the severity of the warning type.
Expand Down
13 changes: 12 additions & 1 deletion internal/server/loki/loki.go
Original file line number Diff line number Diff line change
Expand Up @@ -273,8 +273,19 @@ func (c *Client) HandleEvent(event api.Event) {
context["requester-username"] = lifecycleEvent.Requestor.Username
}

// Get a sorted list of context keys.
keys := make([]string, 0, len(context))

for k := range context {
keys = append(keys, k)
}

sort.Strings(keys)

// Add key-value pairs as labels but don't override any labels.
for k, v := range context {
for _, k := range keys {
v := context[k]

if util.ValueInSlice(k, c.cfg.labels) {
_, ok := entry.labels[k]
if !ok {
Expand Down
Loading