Commit 46db6047 authored by Alberto Miranda's avatar Alberto Miranda ♨️
Browse files

First implementation of shutdown command

When invoked, the daemon checks whether active tasks remain to be
processed and, if so, returns NORNS_ETASKSPENDING. If there are no
active tasks, but there are tracked namespaces that are not empty, the
daemon return NORNS_ENAMESPACENOTEMPTY. Otherwise, the daemon returns
NORNS_SUCCESS and shuts itself down.
parent 2f40ef61
Loading
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -63,11 +63,13 @@ extern "C" {
/* errors about namespaces */
#define NORNS_ENAMESPACEEXISTS   -30
#define NORNS_ENOSUCHNAMESPACE   -31
#define NORNS_ENAMESPACENOTEMPTY -32

/* errors about tasks */
#define NORNS_ETASKEXISTS        -40
#define NORNS_ENOSUCHTASK        -41
#define NORNS_ETOOMANYTASKS      -42
#define NORNS_ETASKSPENDING      -43

/* task status */
#define NORNS_EPENDING          -100
+2 −0
Original line number Diff line number Diff line
@@ -53,11 +53,13 @@ const char* const norns_errlist[NORNS_ERRMAX + 1] = {
    /* backend errors */
    [ERR_REMAP(NORNS_ENAMESPACEEXISTS)] = "Namespace already exists",
    [ERR_REMAP(NORNS_ENOSUCHNAMESPACE)] = "Namespace does not exist",
    [ERR_REMAP(NORNS_ENAMESPACENOTEMPTY)] = "Namespace is not empty",
    
    /* task errors */
    [ERR_REMAP(NORNS_ETASKEXISTS)] = "Task already exists",
    [ERR_REMAP(NORNS_ENOSUCHTASK)] = "Task does not exist",
    [ERR_REMAP(NORNS_ETOOMANYTASKS)] = "Too many pending tasks",
    [ERR_REMAP(NORNS_ETASKSPENDING)] = "There are still pending tasks",

    /* misc errors */
    [ERR_REMAP(NORNS_ENOTSUPPORTED)] = "Not supported",
+1 −0
Original line number Diff line number Diff line
@@ -60,6 +60,7 @@ public:
    virtual ~backend() {};

    virtual bool is_tracked() const = 0;
    virtual bool is_empty() const = 0;
    virtual bfs::path mount() const = 0;
    virtual uint32_t quota() const = 0;

+5 −0
Original line number Diff line number Diff line
@@ -43,6 +43,11 @@ lustre::is_tracked() const {
    return m_track;
}

bool
lustre::is_empty() const {
    return false;
}

bfs::path lustre::mount() const {
    return m_mount;
}
+1 −0
Original line number Diff line number Diff line
@@ -44,6 +44,7 @@ public:
    lustre(bool track, const bfs::path& mount, uint32_t quota);

    bool is_tracked() const override final;
    bool is_empty() const override final;
    bfs::path mount() const override final;
    uint32_t quota() const override final;

Loading