Skip to content

Commit

Permalink
Added autostart to domain in mkvm
Browse files Browse the repository at this point in the history
  • Loading branch information
Iain M Conochie committed Dec 22, 2023
1 parent e957aa3 commit ca9db41
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
8 changes: 8 additions & 0 deletions TODO
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
23/12/2023
Systems with less than 768MB RAM will pause installation with a low memory
warning. This can be overcome by adding lowmem=1 to the bootline

22/12/2023
Check writing DHCP hosts file, as we write it out even if the hostname given
to cbc -w is incorrect

09/08/2023
The main issue with mkvm is it does not add a _build_ into cmdb. It can add
the server in there, but there is no build. We need to add this!
Expand Down
12 changes: 11 additions & 1 deletion src/virtual.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,11 @@ typedef struct ailsa_virt_stor_s {

// End of Storage

// Used for autostarting domains

#define DOMAIN_AUTOSTART_TRUE 1
#define DOMAIN_AUTOSTART_FALSE 0

static int
mkvm_add_to_cmdb(ailsa_cmdb_s *cms, ailsa_mkvm_s *vm);

Expand Down Expand Up @@ -153,9 +158,14 @@ mkvm_create_vm(ailsa_cmdb_s *cms, ailsa_mkvm_s *vm)
retval = -1;
goto cleanup;
}
if ((retval = virDomainSetAutostart(dom, DOMAIN_AUTOSTART_TRUE)) != 0) {
fprintf(stderr, "Unable to set autostart to true.\n");
fprintf(stderr, "You can still do this manually.\n");
}

/* If we put this inside cleanup, then we will always add to cmdb. This is
probably what we want, as even if the domain fails, we want to try to add
to cmdb. mkvm_add_to_cmdb will need to be idempotent so if will not add
to cmdb. mkvm_add_to_cmdb will need to be idempotent so it will not add
the server and hardware twice. */
if (vm->cmdb > 0)
retval = mkvm_add_to_cmdb(cms, vm);
Expand Down

0 comments on commit ca9db41

Please sign in to comment.