2 Copyright (C) 2010 Proxmox Server Solutions GmbH
4 This program is free software: you can redistribute it and/or modify
5 it under the terms of the GNU Affero General Public License as published by
6 the Free Software Foundation, either version 3 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU Affero General Public License for more details.
14 You should have received a copy of the GNU Affero General Public License
15 along with this program. If not, see <http://www.gnu.org/licenses/>.
17 Author: Dietmar Maurer <dietmar@proxmox.com>
23 #endif /* HAVE_CONFIG_H */
30 #include <sys/types.h>
32 #include <sys/mount.h>
36 #include <sys/types.h>
38 #include <sys/utsname.h>
41 #include <sys/socket.h>
42 #include <netinet/in.h>
43 #include <arpa/inet.h>
45 #include <qb/qbdefs.h>
46 #include <qb/qbutil.h>
49 #include "cfs-utils.h"
51 #include "cfs-plug-memdb.h"
59 #define DBFILENAME VARLIBDIR "/config.db"
60 #define LOCKFILE VARLIBDIR "/.pmxcfs.lockfile"
62 #define CFSDIR "/etc/pve"
68 static struct fuse
*fuse
= NULL
;
70 static cfs_plug_t
*root_plug
;
72 static void glib_print_handler(const gchar
*string
)
77 static void glib_log_handler(const gchar
*log_domain
,
78 GLogLevelFlags log_level
,
83 cfs_log(log_domain
, log_level
, NULL
, 0, NULL
, message
);
86 static gboolean
write_pidfile(pid_t pid
)
88 char *strpid
= g_strdup_printf("%d\n", pid
);
89 gboolean res
= atomic_write_file(CFS_PID_FN
, strpid
, strlen(strpid
), 0644, getgid());
95 static cfs_plug_t
*find_plug(const char *path
, char **sub
)
97 g_return_val_if_fail(root_plug
!= NULL
, NULL
);
98 g_return_val_if_fail(path
!= NULL
, NULL
);
100 while(*path
== '/') path
++;
102 cfs_debug("find_plug start %s", path
);
104 char *tmppath
= g_strdup(path
);
105 char *subpath
= tmppath
;
107 cfs_plug_t
*plug
= root_plug
->lookup_plug(root_plug
, &subpath
);
109 cfs_debug("find_plug end %s = %p (%s)", path
, plug
, subpath
);
111 if (subpath
&& subpath
[0])
112 *sub
= g_strdup(subpath
);
119 void *cfs_fuse_init(struct fuse_conn_info
*conn
)
124 static int cfs_fuse_getattr(const char *path
, struct stat
*stbuf
)
126 cfs_debug("enter cfs_fuse_getattr %s", path
);
130 char *subpath
= NULL
;
131 cfs_plug_t
*plug
= find_plug(path
, &subpath
);
133 if (plug
&& plug
->ops
&& plug
->ops
->getattr
) {
134 ret
= plug
->ops
->getattr(plug
, subpath
? subpath
: "", stbuf
);
136 stbuf
->st_gid
= cfs
.gid
;
138 stbuf
->st_mode
&= 0777750; // no access for other users
140 if (path_is_private(path
))
141 stbuf
->st_mode
&= 0777700;
144 cfs_debug("leave cfs_fuse_getattr %s (%d)", path
, ret
);
153 static int cfs_fuse_readdir(const char *path
, void *buf
, fuse_fill_dir_t filler
,
154 off_t offset
, struct fuse_file_info
*fi
)
159 cfs_debug("enter cfs_fuse_readdir %s", path
);
163 char *subpath
= NULL
;
164 cfs_plug_t
*plug
= find_plug(path
, &subpath
);
169 if (plug
->ops
&& plug
->ops
->readdir
)
170 ret
= plug
->ops
->readdir(plug
, subpath
? subpath
: "", buf
, filler
, 0, fi
);
172 cfs_debug("leave cfs_fuse_readdir %s (%d)", path
, ret
);
180 static int cfs_fuse_mkdir(const char *path
, mode_t mode
)
182 cfs_debug("enter cfs_fuse_mkdir %s", path
);
186 char *subpath
= NULL
;
187 cfs_plug_t
*plug
= find_plug(path
, &subpath
);
192 if (subpath
&& plug
->ops
&& plug
->ops
->mkdir
)
193 ret
= plug
->ops
->mkdir(plug
, subpath
, mode
);
196 cfs_debug("leave cfs_fuse_mkdir %s (%d)", path
, ret
);
204 static int cfs_fuse_rmdir(const char *path
)
206 cfs_debug("enter cfs_fuse_rmdir %s", path
);
210 char *subpath
= NULL
;
211 cfs_plug_t
*plug
= find_plug(path
, &subpath
);
216 if (subpath
&& plug
->ops
&& plug
->ops
->rmdir
)
217 ret
= plug
->ops
->rmdir(plug
, subpath
);
220 cfs_debug("leave cfs_fuse_rmdir %s (%d)", path
, ret
);
228 static int cfs_fuse_rename(const char *from
, const char *to
)
230 cfs_debug("enter cfs_fuse_rename from %s to %s", from
, to
);
234 char *sub_from
= NULL
;
235 cfs_plug_t
*plug_from
= find_plug(from
, &sub_from
);
238 cfs_plug_t
*plug_to
= find_plug(to
, &sub_to
);
240 if (!plug_from
|| !plug_to
|| plug_from
!= plug_to
)
243 if (plug_from
->ops
&& plug_from
->ops
->rename
&& sub_from
&& sub_to
)
244 ret
= plug_from
->ops
->rename(plug_from
, sub_from
, sub_to
);
247 cfs_debug("leave cfs_fuse_rename from %s to %s (%d)", from
, to
, ret
);
258 static int cfs_fuse_open(const char *path
, struct fuse_file_info
*fi
)
260 cfs_debug("enter cfs_fuse_open %s", path
);
267 char *subpath
= NULL
;
268 cfs_plug_t
*plug
= find_plug(path
, &subpath
);
270 if (plug
&& plug
->ops
) {
271 if ((subpath
|| !plug
->ops
->readdir
) && plug
->ops
->open
) {
272 ret
= plug
->ops
->open(plug
, subpath
? subpath
: "", fi
);
276 cfs_debug("leave cfs_fuse_open %s (%d)", path
, ret
);
284 static int cfs_fuse_read(const char *path
, char *buf
, size_t size
, off_t offset
,
285 struct fuse_file_info
*fi
)
289 cfs_debug("enter cfs_fuse_read %s %lu %ld", path
, size
, offset
);
293 char *subpath
= NULL
;
294 cfs_plug_t
*plug
= find_plug(path
, &subpath
);
296 if (plug
&& plug
->ops
) {
297 if ((subpath
|| !plug
->ops
->readdir
) && plug
->ops
->read
)
298 ret
= plug
->ops
->read(plug
, subpath
? subpath
: "", buf
, size
, offset
, fi
);
301 cfs_debug("leave cfs_fuse_read %s (%d)", path
, ret
);
309 static int cfs_fuse_write(const char *path
, const char *buf
, size_t size
,
310 off_t offset
, struct fuse_file_info
*fi
)
314 cfs_debug("enter cfs_fuse_write %s %lu %ld", path
, size
, offset
);
318 char *subpath
= NULL
;
319 cfs_plug_t
*plug
= find_plug(path
, &subpath
);
321 if (plug
&& plug
->ops
) {
322 if ((subpath
|| !plug
->ops
->readdir
) && plug
->ops
->write
)
323 ret
= plug
->ops
->write(plug
, subpath
? subpath
: "",
324 buf
, size
, offset
, fi
);
327 cfs_debug("leave cfs_fuse_write %s (%d)", path
, ret
);
335 static int cfs_fuse_truncate(const char *path
, off_t size
)
337 cfs_debug("enter cfs_fuse_truncate %s %ld", path
, size
);
341 char *subpath
= NULL
;
342 cfs_plug_t
*plug
= find_plug(path
, &subpath
);
344 if (plug
&& plug
->ops
) {
345 if ((subpath
|| !plug
->ops
->readdir
) && plug
->ops
->truncate
)
346 ret
= plug
->ops
->truncate(plug
, subpath
? subpath
: "", size
);
349 cfs_debug("leave cfs_fuse_truncate %s (%d)", path
, ret
);
357 static int cfs_fuse_create(const char *path
, mode_t mode
, struct fuse_file_info
*fi
)
359 cfs_debug("enter cfs_fuse_create %s", path
);
363 char *subpath
= NULL
;
364 cfs_plug_t
*plug
= find_plug(path
, &subpath
);
369 if (subpath
&& plug
->ops
&& plug
->ops
->create
)
370 ret
= plug
->ops
->create(plug
, subpath
, mode
, fi
);
373 cfs_debug("leave cfs_fuse_create %s (%d)", path
, ret
);
381 static int cfs_fuse_unlink(const char *path
)
383 cfs_debug("enter cfs_fuse_unlink %s", path
);
387 char *subpath
= NULL
;
388 cfs_plug_t
*plug
= find_plug(path
, &subpath
);
393 if (subpath
&& plug
->ops
&& plug
->ops
->unlink
)
394 ret
= plug
->ops
->unlink(plug
, subpath
);
397 cfs_debug("leave cfs_fuse_unlink %s (%d)", path
, ret
);
405 static int cfs_fuse_readlink(const char *path
, char *buf
, size_t max
)
407 cfs_debug("enter cfs_fuse_readlink %s", path
);
411 char *subpath
= NULL
;
412 cfs_plug_t
*plug
= find_plug(path
, &subpath
);
417 if (plug
->ops
&& plug
->ops
->readlink
)
418 ret
= plug
->ops
->readlink(plug
, subpath
? subpath
: "", buf
, max
);
421 cfs_debug("leave cfs_fuse_readlink %s (%d)", path
, ret
);
429 static int cfs_fuse_utimens(const char *path
, const struct timespec tv
[2])
431 cfs_debug("enter cfs_fuse_utimens %s", path
);
435 char *subpath
= NULL
;
436 cfs_plug_t
*plug
= find_plug(path
, &subpath
);
441 if (plug
->ops
&& plug
->ops
->utimens
)
442 ret
= plug
->ops
->utimens(plug
, subpath
? subpath
: "", tv
);
445 cfs_debug("leave cfs_fuse_utimens %s (%d)", path
, ret
);
453 static int cfs_fuse_statfs(const char *path
, struct statvfs
*stbuf
)
455 g_return_val_if_fail(root_plug
!= NULL
, PARAM_CHECK_ERRNO
);
457 cfs_debug("enter cfs_fuse_statfs %s", path
);
461 if (root_plug
&& root_plug
->ops
&& root_plug
->ops
->statfs
)
462 ret
= root_plug
->ops
->statfs(root_plug
, "", stbuf
);
467 static struct fuse_operations fuse_ops
= {
468 .getattr
= cfs_fuse_getattr
,
469 .readdir
= cfs_fuse_readdir
,
470 .mkdir
= cfs_fuse_mkdir
,
471 .rmdir
= cfs_fuse_rmdir
,
472 .rename
= cfs_fuse_rename
,
473 .open
= cfs_fuse_open
,
474 .read
= cfs_fuse_read
,
475 .write
= cfs_fuse_write
,
476 .truncate
= cfs_fuse_truncate
,
477 .create
= cfs_fuse_create
,
478 .unlink
= cfs_fuse_unlink
,
479 .readlink
= cfs_fuse_readlink
,
480 .utimens
= cfs_fuse_utimens
,
481 .statfs
= cfs_fuse_statfs
,
482 .init
= cfs_fuse_init
486 create_dot_version_cb(cfs_plug_t
*plug
)
488 GString
*outbuf
= g_string_new(NULL
);
491 if (cfs_create_version_msg(outbuf
) == 0) {
493 g_string_free(outbuf
, FALSE
);
495 g_string_free(outbuf
, TRUE
);
502 create_dot_members_cb(cfs_plug_t
*plug
)
504 GString
*outbuf
= g_string_new(NULL
);
507 if (cfs_create_memberlist_msg(outbuf
) == 0) {
509 g_string_free(outbuf
, FALSE
);
511 g_string_free(outbuf
, TRUE
);
518 create_dot_vmlist_cb(cfs_plug_t
*plug
)
520 GString
*outbuf
= g_string_new(NULL
);
523 if (cfs_create_vmlist_msg(outbuf
) == 0) {
525 g_string_free(outbuf
, FALSE
);
527 g_string_free(outbuf
, TRUE
);
534 create_dot_rrd_cb(cfs_plug_t
*plug
)
536 GString
*outbuf
= g_string_new(NULL
);
538 cfs_rrd_dump(outbuf
);
539 char *data
= outbuf
->str
;
540 g_string_free(outbuf
, FALSE
);
546 create_dot_clusterlog_cb(cfs_plug_t
*plug
)
548 GString
*outbuf
= g_string_new(NULL
);
550 cfs_cluster_log_dump(outbuf
, NULL
, 50);
551 char *data
= outbuf
->str
;
552 g_string_free(outbuf
, FALSE
);
558 read_debug_setting_cb(cfs_plug_t
*plug
)
560 return g_strdup_printf("%d\n", !!cfs
.debug
);
564 update_qb_log_settings(void)
567 qb_log_format_set(QB_LOG_SYSLOG
, "[%g] %p: %b (%f:%l:%n)");
568 qb_log_format_set(QB_LOG_STDERR
, "[%g] %p: %b (%f:%l:%n)");
569 qb_log_ctl(QB_LOG_SYSLOG
, QB_LOG_CONF_PRIORITY_BUMP
, LOG_INFO
- LOG_DEBUG
);
570 qb_log_ctl(QB_LOG_STDERR
, QB_LOG_CONF_PRIORITY_BUMP
, LOG_INFO
- LOG_DEBUG
);
572 qb_log_format_set(QB_LOG_SYSLOG
, "[%g] %p: %b");
573 qb_log_format_set(QB_LOG_STDERR
, "[%g] %p: %b");
574 qb_log_ctl(QB_LOG_SYSLOG
, QB_LOG_CONF_PRIORITY_BUMP
, LOG_DEBUG
- LOG_INFO
);
575 qb_log_ctl(QB_LOG_STDERR
, QB_LOG_CONF_PRIORITY_BUMP
, LOG_DEBUG
- LOG_INFO
);
579 static int write_debug_setting_cb(
589 if (strncmp(buf
, "0\n", 2) == 0) {
591 cfs_message("disable debug mode");
593 update_qb_log_settings();
596 } else if (strncmp(buf
, "1\n", 2) == 0) {
599 update_qb_log_settings();
600 cfs_message("enable debug mode");
610 create_symlinks(cfs_plug_base_t
*bplug
, const char *nodename
)
612 g_return_if_fail(bplug
!= NULL
);
613 g_return_if_fail(nodename
!= NULL
);
615 char *lnktarget
= g_strdup_printf("nodes/%s", nodename
);
616 cfs_plug_link_t
*lnk
= cfs_plug_link_new("local", lnktarget
);
618 cfs_plug_base_insert(bplug
, (cfs_plug_t
*)lnk
);
620 lnktarget
= g_strdup_printf("nodes/%s/qemu-server", nodename
);
621 lnk
= cfs_plug_link_new("qemu-server", lnktarget
);
623 cfs_plug_base_insert(bplug
, (cfs_plug_t
*)lnk
);
625 lnktarget
= g_strdup_printf("nodes/%s/openvz", nodename
);
626 lnk
= cfs_plug_link_new("openvz", lnktarget
);
628 cfs_plug_base_insert(bplug
, (cfs_plug_t
*)lnk
);
630 cfs_plug_func_t
*fplug
= cfs_plug_func_new(".version", 0440, create_dot_version_cb
, NULL
);
631 cfs_plug_base_insert(bplug
, (cfs_plug_t
*)fplug
);
633 fplug
= cfs_plug_func_new(".members", 0440, create_dot_members_cb
, NULL
);
634 cfs_plug_base_insert(bplug
, (cfs_plug_t
*)fplug
);
636 fplug
= cfs_plug_func_new(".vmlist", 0440, create_dot_vmlist_cb
, NULL
);
637 cfs_plug_base_insert(bplug
, (cfs_plug_t
*)fplug
);
639 fplug
= cfs_plug_func_new(".rrd", 0440, create_dot_rrd_cb
, NULL
);
640 cfs_plug_base_insert(bplug
, (cfs_plug_t
*)fplug
);
642 fplug
= cfs_plug_func_new(".clusterlog", 0440, create_dot_clusterlog_cb
, NULL
);
643 cfs_plug_base_insert(bplug
, (cfs_plug_t
*)fplug
);
645 fplug
= cfs_plug_func_new(".debug", 0640, read_debug_setting_cb
, write_debug_setting_cb
);
646 cfs_plug_base_insert(bplug
, (cfs_plug_t
*)fplug
);
652 lookup_node_ip(const char *nodename
)
654 struct addrinfo
*ainfo
;
655 struct addrinfo ahints
;
656 memset(&ahints
, 0, sizeof(ahints
));
658 if (getaddrinfo(nodename
, NULL
, &ahints
, &ainfo
))
661 if (ainfo
->ai_family
== AF_INET
) {
662 char buf
[INET6_ADDRSTRLEN
];
663 struct sockaddr_in
*sa
= (struct sockaddr_in
*)ainfo
->ai_addr
;
664 inet_ntop(ainfo
->ai_family
, &sa
->sin_addr
, buf
, sizeof(buf
));
665 if (strncmp(buf
, "127.", 4) != 0) {
666 return g_strdup(buf
);
676 log_tags_stringify(uint32_t tags
) {
677 if (qb_bit_is_set(tags
, QB_LOG_TAG_LIBQB_MSG_BIT
)) {
681 const char *domain
= g_quark_to_string(quark
);
682 if (domain
!= NULL
) {
690 int main(int argc
, char *argv
[])
695 gboolean foreground
= FALSE
;
696 gboolean force_local_mode
= FALSE
;
697 gboolean wrote_pidfile
= FALSE
;
698 memdb_t
*memdb
= NULL
;
700 dfsm_t
*status_fsm
= NULL
;
702 qb_log_init("pmxcfs", LOG_DAEMON
, LOG_DEBUG
);
703 qb_log_tags_stringify_fn_set(log_tags_stringify
);
705 qb_log_ctl(QB_LOG_STDERR
, QB_LOG_CONF_ENABLED
, QB_TRUE
);
706 qb_log_filter_ctl(QB_LOG_STDERR
, QB_LOG_FILTER_ADD
,
707 QB_LOG_FILTER_FILE
, "*", LOG_DEBUG
);
709 update_qb_log_settings();
711 g_set_print_handler(glib_print_handler
);
712 g_set_printerr_handler(glib_print_handler
);
713 g_log_set_default_handler(glib_log_handler
, NULL
);
715 GOptionContext
*context
;
717 GOptionEntry entries
[] = {
718 { "debug", 'd', 0, G_OPTION_ARG_NONE
, &cfs
.debug
, "Turn on debug messages", NULL
},
719 { "foreground", 'f', 0, G_OPTION_ARG_NONE
, &foreground
, "Do not daemonize server", NULL
},
720 { "local", 'l', 0, G_OPTION_ARG_NONE
, &force_local_mode
,
721 "Force local mode (ignore cluster.conf, force quorum)", NULL
},
725 context
= g_option_context_new ("");
726 g_option_context_add_main_entries (context
, entries
, NULL
);
729 if (!g_option_context_parse (context
, &argc
, &argv
, &err
))
731 cfs_critical("option parsing failed: %s", err
->message
);
736 g_option_context_free(context
);
739 cfs_critical("too many arguments");
745 update_qb_log_settings();
748 struct utsname utsname
;
749 if (uname(&utsname
) != 0) {
750 cfs_critical("Unable to read local node name");
755 for (int i
=0; i
< sizeof(utsname
.nodename
); i
++) {
756 if (utsname
.nodename
[i
] =='.') utsname
.nodename
[i
] = 0;
759 cfs
.nodename
= g_strdup(utsname
.nodename
);
761 if (!(cfs
.ip
= lookup_node_ip(cfs
.nodename
))) {
762 cfs_critical("Unable to get local IP address");
767 struct group
*www_data
= getgrnam("www-data");
769 cfs_critical("Unable to get www-data group ID");
773 cfs
.gid
= www_data
->gr_gid
;
779 mkdir(VARLIBDIR
, 0755);
781 if ((lockfd
= open(LOCKFILE
, O_RDWR
|O_CREAT
|O_APPEND
)) == -1) {
782 cfs_critical("unable to create lock '%s': %s", LOCKFILE
, strerror (errno
));
786 for (int i
= 10; i
>= 0; i
--) {
787 if (flock(lockfd
, LOCK_EX
|LOCK_NB
) != 0) {
789 cfs_critical("unable to aquire pmxcfs lock: %s", strerror (errno
));
793 cfs_message("unable to aquire pmxcfs lock - trying again");
801 gboolean create
= !g_file_test(DBFILENAME
, G_FILE_TEST_EXISTS
);
803 if (!(memdb
= memdb_open (DBFILENAME
))) {
804 cfs_critical("memdb_open failed - unable to open database '%s'", DBFILENAME
);
808 // automatically import cluster.conf from host
809 if (create
&& !force_local_mode
) {
812 if (g_file_get_contents(HOST_CLUSTER_CONF_FN
, &cdata
, &clen
, NULL
)) {
814 guint32 mtime
= time(NULL
);
816 memdb_create(memdb
, "/cluster.conf", 0, mtime
);
817 if (memdb_write(memdb
, "/cluster.conf", 0, mtime
, cdata
, clen
, 0, 1) < 0) {
818 cfs_critical("memdb_write failed - unable to import cluster.conf");
824 // does cluster.conf exist?
825 gpointer conf_data
= NULL
;
826 int len
= memdb_read(memdb
, "cluster.conf", &conf_data
);
828 if (force_local_mode
) {
829 cfs_message("forcing local mode (althought cluster.conf exists)");
830 cfs_set_quorate(1, TRUE
);
832 if (!(dcdb
= dcdb_new(memdb
)))
834 dcdb_sync_cluster_conf(memdb
, 1);
837 cfs_debug("using local mode (cluster.conf does not exist)");
838 cfs_set_quorate(1, TRUE
);
840 if (conf_data
) g_free(conf_data
);
842 cfs_plug_memdb_t
*config
= cfs_plug_memdb_new("memdb", memdb
, dcdb
);
844 cfs_plug_base_t
*bplug
= cfs_plug_base_new("", (cfs_plug_t
*)config
);
846 create_symlinks(bplug
, cfs
.nodename
);
848 root_plug
= (cfs_plug_t
*)bplug
;
850 system("umount -f " CFSDIR
" >/dev/null 2>&1");
852 char *fa
[] = { "-f", "-odefault_permissions", "-oallow_other", NULL
};
854 struct fuse_args fuse_args
= FUSE_ARGS_INIT(sizeof (fa
)/sizeof(gpointer
) - 1, fa
);
856 struct fuse_chan
*fuse_chan
= fuse_mount(CFSDIR
, &fuse_args
);
858 cfs_critical("fuse_mount error: %s", strerror(errno
));
862 if (!(fuse
= fuse_new(fuse_chan
, &fuse_args
, &fuse_ops
, sizeof(fuse_ops
), NULL
))) {
863 cfs_critical("fuse_new error: %s", strerror(errno
));
867 fuse_set_signal_handlers(fuse_get_session(fuse
));
873 cfs_critical("failed to daemonize program - %s", strerror (errno
));
884 if ((nullfd
= open("/dev/null", O_RDWR
, 0)) != -1) {
892 // do not print to the console after this point
893 qb_log_ctl(QB_LOG_STDERR
, QB_LOG_CONF_ENABLED
, QB_FALSE
);
898 write_pidfile(getpid());
901 wrote_pidfile
= TRUE
;
903 cfs_loop_t
*corosync_loop
= cfs_loop_new(fuse
);
905 cfs_service_t
*service_quorum
= NULL
;
906 cfs_service_t
*service_confdb
= NULL
;
907 cfs_service_t
*service_dcdb
= NULL
;
908 cfs_service_t
*service_status
= NULL
;
912 service_quorum
= service_quorum_new();
914 cfs_loop_add_service(corosync_loop
, service_quorum
, QB_LOOP_HIGH
);
916 service_confdb
= service_confdb_new();
918 cfs_loop_add_service(corosync_loop
, service_confdb
, QB_LOOP_MED
);
920 service_dcdb
= service_dfsm_new(dcdb
);
921 cfs_service_set_timer(service_dcdb
, DCDB_VERIFY_TIME
);
923 cfs_loop_add_service(corosync_loop
, service_dcdb
, QB_LOOP_MED
);
925 status_fsm
= cfs_status_dfsm_new();
926 service_status
= service_dfsm_new(status_fsm
);
928 cfs_loop_add_service(corosync_loop
, service_status
, QB_LOOP_LOW
);
932 cfs_loop_start_worker(corosync_loop
);
936 ret
= fuse_loop_mt(fuse
);
938 cfs_message("teardown filesystem");
942 fuse_unmount(CFSDIR
, fuse_chan
);
946 cfs_debug("set stop event loop flag");
948 cfs_loop_stop_worker(corosync_loop
);
950 cfs_loop_destroy(corosync_loop
);
952 cfs_debug("worker finished");
955 service_dfsm_destroy(service_dcdb
);
958 service_confdb_destroy(service_confdb
);
961 service_quorum_destroy(service_quorum
);
964 service_dfsm_destroy(service_status
);
966 sleep(1); /* do not restart too fast */
970 dfsm_destroy(status_fsm
);
981 cfs_message("exit proxmox configuration filesystem (%d)", ret
);
983 cfs_status_cleanup();