Skip to content

Commit

Permalink
Merge pull request #447 from stgraber/main
Browse files Browse the repository at this point in the history
Various fixes
  • Loading branch information
brauner authored Jan 28, 2024
2 parents b11757c + 48920a1 commit 514038a
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 31 deletions.
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

0 comments on commit 514038a

Please sign in to comment.