EpocTime: Use proper errors on setting time failure

Depends on the time config setting, setting property of EpochTime
interface may fail, e.g. not allowed, or systemd prevents the time
setting.

It was using InsufficientPermission to indicate not allowed error, but
it is not ideal.

Use proper errors, e.g. NotAllowed for this interface, so it reports
error correctly.

Note that phosphor-logging now supports inherits of errors without meta.
So NotAllowed is defined in Common without meta, and inherited in
Time with extra meta.

Change-Id: I3e660905d6bcb94680303a030eb7b1402e2f0075
Signed-off-by: Lei YU <mine260309@gmail.com>
diff --git a/xyz/openbmc_project/Common.errors.yaml b/xyz/openbmc_project/Common.errors.yaml
index f6b2734..fe0e531 100644
--- a/xyz/openbmc_project/Common.errors.yaml
+++ b/xyz/openbmc_project/Common.errors.yaml
@@ -6,3 +6,5 @@
   description: Invalid argument was given.
 - name: InsufficientPermission
   description: Insufficient permission to perform operation
+- name: NotAllowed
+  description: The operation is not allowed
diff --git a/xyz/openbmc_project/Common.metadata.yaml b/xyz/openbmc_project/Common.metadata.yaml
index e2b76cc..83a923c 100644
--- a/xyz/openbmc_project/Common.metadata.yaml
+++ b/xyz/openbmc_project/Common.metadata.yaml
@@ -12,3 +12,8 @@
   level: ERR
 - name: InsufficientPermission
   level: INFO
+- name: NotAllowed
+  level: INFO
+  meta:
+    - str: "REASON=%s"
+      type: string
diff --git a/xyz/openbmc_project/Time.errors.yaml b/xyz/openbmc_project/Time.errors.yaml
new file mode 100644
index 0000000..9bff979
--- /dev/null
+++ b/xyz/openbmc_project/Time.errors.yaml
@@ -0,0 +1,4 @@
+- name: NotAllowed
+  description: The operation is not allowed
+- name: Failed
+  description: The operation failed
diff --git a/xyz/openbmc_project/Time.metadata.yaml b/xyz/openbmc_project/Time.metadata.yaml
new file mode 100644
index 0000000..cfef584
--- /dev/null
+++ b/xyz/openbmc_project/Time.metadata.yaml
@@ -0,0 +1,14 @@
+- name: NotAllowed
+  inherits:
+    - xyz.openbmc_project.Common.NotAllowed
+  meta:
+    - str: "OWNER=%s"
+      type: string
+    - str: "SYNC_METHOD=%s"
+      type: string
+- name: Failed
+  inherits:
+    - xyz.openbmc_project.Common.InternalFailure
+  meta:
+    - str: "REASON=%s"
+      type: string
diff --git a/xyz/openbmc_project/Time/EpochTime.interface.yaml b/xyz/openbmc_project/Time/EpochTime.interface.yaml
index 7b49fc0..26f7b3a 100644
--- a/xyz/openbmc_project/Time/EpochTime.interface.yaml
+++ b/xyz/openbmc_project/Time/EpochTime.interface.yaml
@@ -12,7 +12,7 @@
           InsufficientPermission means it is not allowed to set time depend
           on the time settings.
       errors:
-        - xyz.openbmc_project.Common.Error.InternalFailure
-        - xyz.openbmc_project.Common.Error.InsufficientPermission
+        - xyz.openbmc_project.Time.Error.NotAllowed
+        - xyz.openbmc_project.Time.Error.Failed
 
 # vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4