refactor: set qemu default values as constants
This commit is contained in:
		| @@ -37,6 +37,13 @@ const ( | |||||||
| 	unsupported = "unsupported" // for test purposes | 	unsupported = "unsupported" // for test purposes | ||||||
| ) | ) | ||||||
|  |  | ||||||
|  | const ( | ||||||
|  | 	DefaultCPUs            = 1 | ||||||
|  | 	DefaultMemory          = 512 // megabytes | ||||||
|  | 	DefaultSSHRetries      = 4 | ||||||
|  | 	DefaultSSHRetryTimeout = time.Second / 4 | ||||||
|  | ) | ||||||
|  |  | ||||||
| // Kernel describe kernel parameters for qemu | // Kernel describe kernel parameters for qemu | ||||||
| type Kernel struct { | type Kernel struct { | ||||||
| 	Name       string | 	Name       string | ||||||
| @@ -123,11 +130,10 @@ func NewSystem(arch arch, kernel Kernel, drivePath string) (q *System, err error | |||||||
| 	} | 	} | ||||||
| 	q.drivePath = drivePath | 	q.drivePath = drivePath | ||||||
|  |  | ||||||
| 	// Default values | 	q.Cpus = DefaultCPUs | ||||||
| 	q.Cpus = 1 | 	q.Memory = DefaultMemory | ||||||
| 	q.Memory = 512 // megabytes | 	q.SSH.Retries = DefaultSSHRetries | ||||||
| 	q.SSH.Retries = 4 | 	q.SSH.RetryTimeout = DefaultSSHRetryTimeout | ||||||
| 	q.SSH.RetryTimeout = time.Second / 4 |  | ||||||
|  |  | ||||||
| 	return | 	return | ||||||
| } | } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user