[pve-devel] [PATCH manager 2/2] ceph api: Make systemd unit type suffix optional

Dominic Jäger d.jaeger at proxmox.com
Mon Feb 17 12:28:57 CET 2020


To (re)start and stop Ceph services the API calls systemd units using the
function ceph_service_cmd.  If unspecified, this function assumes the type
".target" for a unit. By making the unit type suffix in the API optional, it
can make use of this assumption.

Signed-off-by: Dominic Jäger <d.jaeger at proxmox.com>
---
 PVE/API2/Ceph.pm | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/PVE/API2/Ceph.pm b/PVE/API2/Ceph.pm
index e2097825..391382f8 100644
--- a/PVE/API2/Ceph.pm
+++ b/PVE/API2/Ceph.pm
@@ -424,7 +424,7 @@ __PACKAGE__->register_method ({
 		type => 'string',
 		optional => 1,
 		default => 'ceph.target',
-		pattern => '(ceph|mon|mds|osd|mgr)\.[A-Za-z0-9\-]{1,32}',
+		pattern => '(ceph|mon|mds|osd|mgr)(\.[A-Za-z0-9\-]{1,32})?',
 	    },
 	},
     },
@@ -475,7 +475,7 @@ __PACKAGE__->register_method ({
 		type => 'string',
 		optional => 1,
 		default => 'ceph.target',
-		pattern => '(ceph|mon|mds|osd|mgr)\.[A-Za-z0-9\-]{1,32}',
+		pattern => '(ceph|mon|mds|osd|mgr)(\.[A-Za-z0-9\-]{1,32})?',
 	    },
 	},
     },
@@ -526,7 +526,7 @@ __PACKAGE__->register_method ({
 		type => 'string',
 		optional => 1,
 		default => 'ceph.target',
-		pattern => '(mon|mds|osd|mgr)\.[A-Za-z0-9\-]{1,32}',
+		pattern => '(mon|mds|osd|mgr)(\.[A-Za-z0-9\-]{1,32})?',
 	    },
 	},
     },
-- 
2.20.1



More information about the pve-devel mailing list