f-88: api: ressource /floating-ips, refus et affichage sur la VM #88
Signed-off-by: GnomeZworc <nicolas.boufidjeline@g3e.fr>
This commit is contained in:
parent
350a1dd82f
commit
385ee9d1f0
15 changed files with 942 additions and 12 deletions
|
|
@ -198,6 +198,13 @@ func (c StopVMCommand) Prepare(db *badger.DB, _ *configuration.Config) error {
|
|||
if !state.CanDelete(current) {
|
||||
return fmt.Errorf("vm %q cannot be stopped while %s", c.Name, current)
|
||||
}
|
||||
floating, err := floatingIPOf(db, c.Name)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if floating != "" {
|
||||
return fmt.Errorf("floating ip %q must be deleted before deleting vm %q", floating, c.Name)
|
||||
}
|
||||
return state.Set(db, c.Key(), state.Deleting)
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue