From: root Date: Mon, 6 Oct 2008 15:09:07 +0000 (+0200) Subject: Update so after migration we will still try to publish the domain. X-Git-Url: https://repo.or.cz/w/handlervirt.git/commitdiff_plain/0abd569cd8c7f3248340eae00a317eb77c19d786 Update so after migration we will still try to publish the domain. --- diff --git a/node/configs/etc/fstab b/node/configs/etc/fstab new file mode 100644 index 0000000..48fdc6a --- /dev/null +++ b/node/configs/etc/fstab @@ -0,0 +1,34 @@ +# /etc/fstab: static file system information. +# +# noatime turns off atimes for increased performance (atimes normally aren't +# needed; notail increases performance of ReiserFS (at the expense of storage +# efficiency). It's safe to drop the noatime options if you want and to +# switch between notail / tail freely. +# +# The root filesystem should have a pass number of either 0 or 1. +# All other filesystems should have a pass number of 0 or greater than 1. +# +# See the manpage fstab(5) for more information. +# + +# + +tmpfs /root tmpfs nodev,nosuid,noexec 0 0 +tmpfs /tmp tmpfs nodev,nosuid,noexec 0 0 +tmpfs /var/lock tmpfs nodev,nosuid,noexec 0 0 +tmpfs /var/log tmpfs nodev,nosuid,noexec 0 0 +tmpfs /var/lib/init.d tmpfs nodev,nosuid,noexec 0 0 +tmpfs /var/lib/run tmpfs nodev,nosuid,noexec 0 0 +tmpfs /var/lib/xen tmpfs nodev,nosuid,noexec 0 0 +tmpfs /var/lib/xend tmpfs nodev,nosuid,noexec 0 0 +tmpfs /var/lib/xenstored tmpfs nodev,nosuid,noexec 0 0 +tmpfs /var/tmp tmpfs nodev,nosuid,noexec 0 0 +tmpfs /var/run tmpfs nodev,nosuid,noexec 0 0 +tmpfs /etc/pki/libvirt tmpfs nodev,nosuid,noexec 0 0 +tmpfs /var/run tmpfs nodev,nosuid,noexec 0 0 + +# glibc 2.2 and above expects tmpfs to be mounted at /dev/shm for +# POSIX shared memory (shm_open, shm_unlink). +# (tmpfs is a dynamically expandable/shrinkable ramdisk, and will +# use almost no memory if not populated with files) +shm /dev/shm tmpfs nodev,nosuid,noexec 0 0 diff --git a/node/publish.c b/node/publish.c index d5d25bb..5f020ed 100644 --- a/node/publish.c +++ b/node/publish.c @@ -60,8 +60,10 @@ void remove_everything() { if (domus) { int i; for (i = 0; i < domu_count; i++) { - avahi_entry_group_free(domus[i].group); - domus[i].group = NULL; + if (domus[i].group) { + avahi_entry_group_free(domus[i].group); + domus[i].group = NULL; + } } free(domus); domus = NULL; @@ -112,6 +114,26 @@ void migrate_everything() { } } +static void entry_group_callback_publish(AvahiEntryGroup *g, AvahiEntryGroupState state, void *userdata) { + domu *this = userdata; + + switch (state) { + case AVAHI_ENTRY_GROUP_ESTABLISHED: + this->group = g; + break; + + case AVAHI_ENTRY_GROUP_FAILURE: + case AVAHI_ENTRY_GROUP_COLLISION: + fprintf(stderr, "Collision\n"); + avahi_entry_group_free(g); + this->group = NULL; + break; + + default: + break; + } +} + void create_services(AvahiClient *c) { virConnectPtr conn = virConnectOpenReadOnly(NULL); @@ -145,7 +167,7 @@ void create_services(AvahiClient *c) { if (thisDomain) { const char *name; name = virDomainGetName(thisDomain); - if (name) { + if (name && domus_old[j].group) { domus[i].group = domus_old[j].group; AvahiStringList *domainProps; domainProps = domainProperties(thisDomain); @@ -162,13 +184,15 @@ void create_services(AvahiClient *c) { AvahiStringList *domainProps; virDomainPtr thisDomain = virDomainLookupByID(conn, ids[i+1]); if (thisDomain) { - domus[i].group = avahi_entry_group_new(c, entry_group_callback, NULL); + AvahiEntryGroup *group; + group = avahi_entry_group_new(c, entry_group_callback_publish, &domus[i]); domainProps = domainProperties(thisDomain); name = virDomainGetName(thisDomain); if (name) { - avahi_entry_group_add_service_strlst(domus[i].group, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, 0, name, type, NULL, NULL, 651, domainProps); - avahi_entry_group_commit(domus[i].group); + avahi_entry_group_add_service_strlst(group, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, 0, name, type, NULL, NULL, 651, domainProps); + avahi_entry_group_commit(group); + domus[i].keep = 1; } else { domus[i].keep = 0; }