Commit 3f6599e675df86d89313e1ef7ce8edb8f7c2d039
Committed by
Anthony Liguori
1 parent
c1d6eed7
Add machine type aliases
Add an 'alias' field to QEMUMachine and display it in the output of 'qemu -M ?' with an '(aliased to foo)' suffix. Aliases can change targets in newer versions of qemu, so management tools may choose canonicalize machine types to ensure that if a user chooses an alias, that the actual machine type used will remain compatible in future. This is intended to mimic a symlink to a machine description file. Signed-off-by: Mark McLoughlin <markmc@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Showing
2 changed files
with
6 additions
and
0 deletions
hw/boards.h
@@ -14,6 +14,7 @@ typedef void QEMUMachineInitFunc(ram_addr_t ram_size, | @@ -14,6 +14,7 @@ typedef void QEMUMachineInitFunc(ram_addr_t ram_size, | ||
14 | 14 | ||
15 | typedef struct QEMUMachine { | 15 | typedef struct QEMUMachine { |
16 | const char *name; | 16 | const char *name; |
17 | + const char *alias; | ||
17 | const char *desc; | 18 | const char *desc; |
18 | QEMUMachineInitFunc *init; | 19 | QEMUMachineInitFunc *init; |
19 | int use_scsi; | 20 | int use_scsi; |
vl.c
@@ -3359,6 +3359,8 @@ static QEMUMachine *find_machine(const char *name) | @@ -3359,6 +3359,8 @@ static QEMUMachine *find_machine(const char *name) | ||
3359 | for(m = first_machine; m != NULL; m = m->next) { | 3359 | for(m = first_machine; m != NULL; m = m->next) { |
3360 | if (!strcmp(m->name, name)) | 3360 | if (!strcmp(m->name, name)) |
3361 | return m; | 3361 | return m; |
3362 | + if (m->alias && !strcmp(m->alias, name)) | ||
3363 | + return m; | ||
3362 | } | 3364 | } |
3363 | return NULL; | 3365 | return NULL; |
3364 | } | 3366 | } |
@@ -4995,6 +4997,9 @@ int main(int argc, char **argv, char **envp) | @@ -4995,6 +4997,9 @@ int main(int argc, char **argv, char **envp) | ||
4995 | QEMUMachine *m; | 4997 | QEMUMachine *m; |
4996 | printf("Supported machines are:\n"); | 4998 | printf("Supported machines are:\n"); |
4997 | for(m = first_machine; m != NULL; m = m->next) { | 4999 | for(m = first_machine; m != NULL; m = m->next) { |
5000 | + if (m->alias) | ||
5001 | + printf("%-10s %s (alias of %s)\n", | ||
5002 | + m->alias, m->desc, m->name); | ||
4998 | printf("%-10s %s%s\n", | 5003 | printf("%-10s %s%s\n", |
4999 | m->name, m->desc, | 5004 | m->name, m->desc, |
5000 | m->is_default ? " (default)" : ""); | 5005 | m->is_default ? " (default)" : ""); |