Skip to content

Commit

Permalink
machine: Display warning when UpdateConfigRaw returns ErrNotImplemented
Browse files Browse the repository at this point in the history
When this error is returned, this means the user tried to change the VM
settings, but they were not applied. We currently only print a debug log
about such errors, but this deserves a user-visible warning as it's
unexpected that the configuration change did not happen.
  • Loading branch information
cfergeau committed Oct 29, 2020
1 parent bc621e3 commit 5ab0673
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions pkg/crc/machine/machine.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,13 +114,17 @@ func (client *client) updateVMConfig(startConfig StartConfig, api libmachine.API
logging.Debugf("Updating CRC VM configuration")
if err := setMemory(host, startConfig.Memory); err != nil {
logging.Debugf("Failed to update CRC VM configuration: %v", err)
if err != drivers.ErrNotImplemented {
if err == drivers.ErrNotImplemented {
logging.Warn("Memory configuration change has been ignored as the machine driver does not support it")
} else {
return err
}
}
if err := setVcpus(host, startConfig.CPUs); err != nil {
logging.Debugf("Failed to update CRC VM configuration: %v", err)
if err != drivers.ErrNotImplemented {
if err == drivers.ErrNotImplemented {
logging.Warn("CPU configuration change has been ignored as the machine driver does not support it")
} else {
return err
}
}
Expand All @@ -132,7 +136,9 @@ func (client *client) updateVMConfig(startConfig StartConfig, api libmachine.API
if startConfig.DiskSize != constants.DefaultDiskSize {
if err := setDiskSize(host, startConfig.DiskSize); err != nil {
logging.Debugf("Failed to update CRC disk configuration: %v", err)
if err != drivers.ErrNotImplemented {
if err == drivers.ErrNotImplemented {
logging.Warn("Disk size configuration change has been ignored as the machine driver does not support it")
} else {
return err
}
}
Expand Down

0 comments on commit 5ab0673

Please sign in to comment.