1 #!/usr/bin/env /usr/bin/plcsh
3 # Bootstraps the PLC database with a default administrator account and
4 # a default site, defines default slice attribute types, and
5 # creates/updates default system slices.
7 # Mark Huang <mlhuang@cs.princeton.edu>
8 # Copyright (C) 2006 The Trustees of Princeton University
13 from plc_config import PLCConfiguration
18 cfg = PLCConfiguration()
20 variables = cfg.variables()
22 # Load variables into dictionaries
23 for category_id, (category, variablelist) in variables.iteritems():
24 globals()[category_id] = dict(zip(variablelist.keys(),
25 [variable['value'] for variable in variablelist.values()]))
27 # Create/update the default administrator account (should be
29 admin = { 'person_id': 2,
30 'first_name': "Default",
31 'last_name': "Administrator",
32 'email': plc['root_user'],
33 'password': plc['root_password'] }
34 persons = GetPersons([admin['person_id']])
36 person_id = AddPerson(admin)
37 if person_id != admin['person_id']:
38 # Huh? Someone deleted the account manually from the database.
39 DeletePerson(person_id)
40 raise Exception, "Someone deleted the \"%s %s\" account from the database!" % \
41 (admin['first_name'], admin['last_name'])
42 UpdatePerson(person_id, { 'enabled': True })
44 person_id = persons[0]['person_id']
45 UpdatePerson(person_id, admin)
47 # Create/update the default site (should be site_id 1)
48 if plc_www['port'] == '80':
49 url = "http://" + plc_www['host'] + "/"
50 elif plc_www['port'] == '443':
51 url = "https://" + plc_www['host'] + "/"
53 url = "http://" + plc_www['host'] + ":" + plc_www['port'] + "/"
54 site = { 'site_id': 1,
55 'name': plc['name'] + " Central",
56 'abbreviated_name': plc['name'],
57 'login_base': plc['slice_prefix'],
62 sites = GetSites([site['site_id']])
64 site_id = AddSite(site['name'], site['abbreviated_name'], site['login_base'], site)
65 if site_id != site['site_id']:
67 raise Exception, "Someone deleted the \"%s\" site from the database!" % \
71 # Must call UpdateSite() even after AddSite() to update max_slices
72 site_id = sites[0]['site_id']
73 UpdateSite(site_id, site)
75 # The default administrator account must be associated with a site
77 AddPersonToSite(admin['person_id'], site['site_id'])
78 SetPersonPrimarySite(admin['person_id'], site['site_id'])
80 # Grant admin and PI roles to the default administrator account
81 AddRoleToPerson(10, admin['person_id'])
82 AddRoleToPerson(20, admin['person_id'])
84 # Setup default PlanetLabConf entries
85 default_conf_files = [
88 'source': 'PlanetLabConf/ntp.conf.php',
89 'dest': '/etc/ntp.conf',
90 'file_permissions': '644',
94 'postinstall_cmd': '/etc/rc.d/init.d/ntpd restart',
96 'ignore_cmd_errors': False,
97 'always_update': False},
99 'source': 'PlanetLabConf/ntp/step-tickers.php',
100 'dest': '/etc/ntp/step-tickers',
101 'file_permissions': '644',
102 'file_owner': 'root',
103 'file_group': 'root',
104 'preinstall_cmd': '',
105 'postinstall_cmd': '/etc/rc.d/init.d/ntpd restart',
107 'ignore_cmd_errors': False,
108 'always_update': False},
110 # SSH server configuration
112 'source': 'PlanetLabConf/sshd_config',
113 'dest': '/etc/ssh/sshd_config',
114 'file_permissions': '600',
115 'file_owner': 'root',
116 'file_group': 'root',
117 'preinstall_cmd': '',
118 'postinstall_cmd': '/etc/init.d/sshd restart',
120 'ignore_cmd_errors': False,
121 'always_update': False},
123 # Administrative SSH keys
125 'source': 'PlanetLabConf/keys.php?root',
126 'dest': '/root/.ssh/authorized_keys',
127 'file_permissions': '644',
128 'file_owner': 'root',
129 'file_group': 'root',
130 'preinstall_cmd': '',
131 'postinstall_cmd': '/bin/chmod 700 /root/.ssh',
133 'ignore_cmd_errors': False,
134 'always_update': False},
136 'source': 'PlanetLabConf/keys.php?site_admin',
137 'dest': '/home/site_admin/.ssh/authorized_keys',
138 'file_permissions': '644',
139 'file_owner': 'site_admin',
140 'file_group': 'site_admin',
141 'preinstall_cmd': 'grep -q site_admin /etc/passwd',
142 'postinstall_cmd': '/bin/chmod 700 /home/site_admin/.ssh',
144 'ignore_cmd_errors': False,
145 'always_update': False},
146 # Log rotation configuration
148 'source': 'PlanetLabConf/logrotate.conf',
149 'dest': '/etc/logrotate.conf',
150 'file_permissions': '644',
151 'file_owner': 'root',
152 'file_group': 'root',
153 'preinstall_cmd': '',
154 'postinstall_cmd': '',
156 'ignore_cmd_errors': False,
157 'always_update': False},
159 # updatedb/locate nightly cron job
161 'source': 'PlanetLabConf/slocate.cron',
162 'dest': '/etc/cron.daily/slocate.cron',
163 'file_permissions': '755',
164 'file_owner': 'root',
165 'file_group': 'root',
166 'preinstall_cmd': '',
167 'postinstall_cmd': '',
169 'ignore_cmd_errors': False,
170 'always_update': False},
174 'source': 'PlanetLabConf/f8/yum.conf',
175 'dest': '/etc/yum.conf',
176 'file_permissions': '644', 'file_owner': 'root', 'file_group': 'root',
177 'preinstall_cmd': '', 'postinstall_cmd': '', 'error_cmd': '',
178 'ignore_cmd_errors': False,
179 'always_update': False},
181 'source': 'PlanetLabConf/myplc.repo.php?gpgcheck=1',
182 'dest': '/etc/yum.myplc.d/myplc.repo',
183 'file_permissions': '644', 'file_owner': 'root', 'file_group': 'root',
184 'preinstall_cmd': '', 'postinstall_cmd': '', 'error_cmd': '',
185 'ignore_cmd_errors': False,
186 'always_update': False},
188 'source': 'PlanetLabConf/f8/yum.myplc.d/fedora.repo',
189 'dest': '/etc/yum.myplc.d/fedora.repo',
190 'file_permissions': '644', 'file_owner': 'root', 'file_group': 'root',
191 'preinstall_cmd': '', 'postinstall_cmd': '', 'error_cmd': '',
192 'ignore_cmd_errors': False,
193 'always_update': False},
195 'source': 'PlanetLabConf/f8/yum.myplc.d/fedora-updates.repo',
196 'dest': '/etc/yum.myplc.d/fedora-updates.repo',
197 'file_permissions': '644', 'file_owner': 'root', 'file_group': 'root',
198 'preinstall_cmd': '', 'postinstall_cmd': '', 'error_cmd': '',
199 'ignore_cmd_errors': False,
200 'always_update': False},
203 'source': 'PlanetLabConf/delete-rpm-list-production',
204 'dest': '/etc/planetlab/delete-rpm-list',
205 'file_permissions': '644',
206 'file_owner': 'root',
207 'file_group': 'root',
208 'preinstall_cmd': '',
209 'postinstall_cmd': '',
211 'ignore_cmd_errors': False,
212 'always_update': False},
216 'source': 'PlanetLabConf/get_plc_config.php',
217 'dest': '/etc/planetlab/plc_config',
218 'file_permissions': '644',
219 'file_owner': 'root',
220 'file_group': 'root',
221 'preinstall_cmd': '',
222 'postinstall_cmd': '',
224 'ignore_cmd_errors': False,
225 'always_update': False},
227 'source': 'PlanetLabConf/get_plc_config.php?python',
228 'dest': '/etc/planetlab/plc_config.py',
229 'file_permissions': '644',
230 'file_owner': 'root',
231 'file_group': 'root',
232 'preinstall_cmd': '',
233 'postinstall_cmd': '',
235 'ignore_cmd_errors': False,
236 'always_update': False},
238 'source': 'PlanetLabConf/get_plc_config.php?perl',
239 'dest': '/etc/planetlab/plc_config.pl',
240 'file_permissions': '644',
241 'file_owner': 'root',
242 'file_group': 'root',
243 'preinstall_cmd': '',
244 'postinstall_cmd': '',
246 'ignore_cmd_errors': False,
247 'always_update': False},
249 'source': 'PlanetLabConf/get_plc_config.php?php',
250 'dest': '/etc/planetlab/php/plc_config.php',
251 'file_permissions': '644',
252 'file_owner': 'root',
253 'file_group': 'root',
254 'preinstall_cmd': '',
255 'postinstall_cmd': '',
257 'ignore_cmd_errors': False,
258 'always_update': False},
260 # XXX Required for old Node Manager
261 # Proper configuration
263 'source': 'PlanetLabConf/propd.conf',
264 'dest': '/etc/proper/propd.conf',
265 'file_permissions': '644',
266 'file_owner': 'root',
267 'file_group': 'root',
268 'preinstall_cmd': '',
269 'postinstall_cmd': '/etc/init.d/proper restart',
271 'ignore_cmd_errors': True,
272 'always_update': False},
274 # XXX Required for old Node Manager
277 'source': 'PlanetLabConf/bwlimit.php',
278 'dest': '/etc/planetlab/bwcap',
279 'file_permissions': '644',
280 'file_owner': 'root',
281 'file_group': 'root',
282 'preinstall_cmd': '',
283 'postinstall_cmd': '',
285 'ignore_cmd_errors': True,
286 'always_update': False},
290 'source': 'PlanetLabConf/proxies.php',
291 'dest': '/etc/planetlab/proxies',
292 'file_permissions': '644',
293 'file_owner': 'root',
294 'file_group': 'root',
295 'preinstall_cmd': '',
296 'postinstall_cmd': '',
298 'ignore_cmd_errors': False,
299 'always_update': False},
301 # Firewall configuration
303 'source': 'PlanetLabConf/blacklist.php',
304 'dest': '/etc/planetlab/blacklist',
305 'file_permissions': '600',
306 'file_owner': 'root',
307 'file_group': 'root',
308 'preinstall_cmd': '',
309 'postinstall_cmd': '/sbin/iptables-restore --noflush < /etc/planetlab/blacklist',
311 'ignore_cmd_errors': True,
312 'always_update': False},
316 'source': 'PlanetLabConf/issue.php',
317 'dest': '/etc/issue',
318 'file_permissions': '644',
319 'file_owner': 'root',
320 'file_group': 'root',
321 'preinstall_cmd': '',
322 'postinstall_cmd': '',
324 'ignore_cmd_errors': False,
325 'always_update': False},
329 'source': 'PlanetLabConf/sysctl.php',
330 'dest': '/etc/sysctl.conf',
331 'file_permissions': '644',
332 'file_owner': 'root',
333 'file_group': 'root',
334 'preinstall_cmd': '',
335 'postinstall_cmd': '/sbin/sysctl -e -p /etc/sysctl.conf',
337 'ignore_cmd_errors': False,
338 'always_update': False},
340 # Sendmail configuration
342 'source': 'PlanetLabConf/sendmail.mc',
343 'dest': '/etc/mail/sendmail.mc',
344 'file_permissions': '644',
345 'file_owner': 'root',
346 'file_group': 'root',
347 'preinstall_cmd': '',
348 'postinstall_cmd': '',
350 'ignore_cmd_errors': False,
351 'always_update': False},
353 'source': 'PlanetLabConf/sendmail.cf',
354 'dest': '/etc/mail/sendmail.cf',
355 'file_permissions': '644',
356 'file_owner': 'root',
357 'file_group': 'root',
358 'preinstall_cmd': '',
359 'postinstall_cmd': 'service sendmail restart',
361 'ignore_cmd_errors': False,
362 'always_update': False},
366 'source': 'PlanetLabConf/RPM-GPG-KEY-fedora',
367 'dest': '/etc/pki/rpm-gpg/RPM-GPG-KEY-fedora',
368 'file_permissions': '644',
369 'file_owner': 'root',
370 'file_group': 'root',
371 'preinstall_cmd': '',
372 'postinstall_cmd': 'rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-fedora',
374 'ignore_cmd_errors': False,
375 'always_update': False},
377 'source': 'PlanetLabConf/get_gpg_key.php',
378 'dest': '/etc/pki/rpm-gpg/RPM-GPG-KEY-planetlab',
379 'file_permissions': '644',
380 'file_owner': 'root',
381 'file_group': 'root',
382 'preinstall_cmd': '',
383 'postinstall_cmd': 'rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-planetlab',
385 'ignore_cmd_errors': False,
386 'always_update': False},
388 # Ping of death configuration
389 # the 'restart' postcommand doesn't work, b/c the pod script doesn't support it.
391 'source': 'PlanetLabConf/ipod.conf.php',
392 'dest': '/etc/ipod.conf',
393 'file_permissions': '644',
394 'file_owner': 'root',
395 'file_group': 'root',
396 'preinstall_cmd': '',
397 'postinstall_cmd': '/etc/init.d/pod start',
399 'ignore_cmd_errors': False,
400 'always_update': False},
404 'source': 'PlanetLabConf/sudoers.php',
405 'dest': '/etc/sudoers',
406 'file_permissions': '440',
407 'file_owner': 'root',
408 'file_group': 'root',
409 'preinstall_cmd': '',
410 'postinstall_cmd': '/usr/sbin/visudo -c',
412 'ignore_cmd_errors': False,
413 'always_update': False}
416 # Get list of existing (enabled, global) files
417 conf_files = GetConfFiles()
418 conf_files = filter(lambda conf_file: conf_file['enabled'] and \
419 not conf_file['node_ids'] and \
420 not conf_file['nodegroup_ids'],
422 dests = [conf_file['dest'] for conf_file in conf_files]
423 conf_files = dict(zip(dests, conf_files))
425 # Create/update default PlanetLabConf entries
426 for default_conf_file in default_conf_files:
427 if default_conf_file['dest'] not in dests:
428 AddConfFile(default_conf_file)
430 conf_file = conf_files[default_conf_file['dest']]
431 UpdateConfFile(conf_file['conf_file_id'], default_conf_file)
433 # Setup default slice attribute types
434 default_attribute_types = [
435 # Slice type (only vserver is supported)
437 'description': "Type of slice (e.g. vserver)",
442 'description': "Is a default system slice (1) or not (0 or unset)",
445 # Slice enabled (1) or suspended (0)
447 'description': "Slice enabled (1 or unset) or suspended (0)",
450 # Slice reference image
452 'description': "Reference image",
455 # Slice initialization script
456 {'name': "initscript",
457 'description': "Slice initialization script",
462 'description': "Reserved CPU percent",
464 {'name': "cpu_share",
465 'description': "Number of CPU shares",
469 {'name': "net_min_rate",
470 'description': "Minimum bandwidth (kbps)",
472 {'name': "net_max_rate",
473 'description': "Maximum bandwidth (kbps)",
475 {'name': "net_i2_min_rate",
476 'description': "Minimum bandwidth over I2 routes (kbps)",
478 {'name': "net_i2_max_rate",
479 'description': "Maximum bandwidth over I2 routes (kbps)",
481 {'name': "net_max_kbyte",
482 'description': "Maximum daily network Tx KByte limit.",
484 {'name': "net_thresh_kbyte",
485 'description': "KByte limit before warning and throttling.",
487 {'name': "net_i2_max_kbyte",
488 'description': "Maximum daily network Tx KByte limit to I2 hosts.",
490 {'name': "net_i2_thresh_kbyte",
491 'description': "KByte limit to I2 hosts before warning and throttling.",
493 {'name': "net_share",
494 'description': "Number of bandwidth shares",
496 {'name': "net_i2_share",
497 'description': "Number of bandwidth shares over I2 routes",
502 'description': "Disk quota (1k disk blocks)",
506 {'name': "proper_op",
507 'description': "Proper operation (e.g. bind_socket)",
510 # VServer capabilities
511 {'name': "capabilities",
512 'description': "VServer bcapabilities (separate by commas)",
517 'description': "Bind vsys script fd's to a slice's vsys directory.",
522 'description': "Demux HTTP between slices using localhost ports. Value in the form 'host, localhost port'.",
526 {'tagname': "delegations",
527 'description': "Coma seperated list of slices to give delegation authority to.",
528 'category' : 'slice/rspec',
533 # add in the platform supported rlimits to the default_attribute_types
534 for entry in resource.__dict__.keys():
535 if entry.find("RLIMIT_")==0:
536 rlim = entry[len("RLIMIT_"):]
538 for ty in ("min","soft","hard"):
540 'name': "%s_%s'%(rlim,ty)",
541 'description': "Per sliver RLIMIT %s_%s."%(rlim,ty),
542 'min_role_id': 40 #admin
544 default_attribute_types.append(attribute)
546 # Get list of existing attribute types
547 attribute_types = GetSliceAttributeTypes()
548 attribute_types = [attribute_type['name'] for attribute_type in attribute_types]
550 # Create/update default slice attribute types
551 for default_attribute_type in default_attribute_types:
552 if default_attribute_type['name'] not in attribute_types:
553 AddSliceAttributeType(default_attribute_type)
555 UpdateSliceAttributeType(default_attribute_type['name'], default_attribute_type)
557 # Default Initscripts
558 default_initscripts = []
560 # Find initscripts and add them to the db
561 for (root, dirs, files) in os.walk("/etc/plc_sliceinitscripts"):
564 file = open(root + "/" + f, "ro")
565 default_initscripts.append({"name": plc['slice_prefix'] + "_" + f,
567 "script": file.read().replace("@SITE@", url).replace("@PREFIX@", plc['slice_prefix'])})
570 # Get list of existing initscripts
571 oldinitscripts = GetInitScripts()
572 oldinitscripts = [script['name'] for script in oldinitscripts]
574 for initscript in default_initscripts:
575 if initscript['name'] not in oldinitscripts: AddInitScript(initscript)
577 # Setup default slice attribute types
578 default_setting_types = [
580 {'category' : "general",
582 'description': "Set interface name, instead of eth0 or the like",
584 {'category' : "Multihome",
586 'description': "Specifies that the network is used for multihoming",
589 {'category' : "hidden",
591 'description': "For testing new settings",
594 { "category" : "WiFi",
596 "description" : "802.11 %s -- see %s"%(y,z),
597 "min_role_id" : 40 } for (x,y,z) in [
598 ("mode","Mode","iwconfig"),
599 ("essid","ESSID","iwconfig"),
600 ("nw","Network Id","iwconfig"),
601 ("freq","Frequency","iwconfig"),
602 ("channel","Channel","iwconfig"),
603 ("sens","sensitivity threshold","iwconfig"),
604 ("rate","Rate","iwconfig"),
605 ("key","key","iwconfig key"),
606 ("key1","key1","iwconfig key [1]"),
607 ("key2","key2","iwconfig key [2]"),
608 ("key3","key3","iwconfig key [3]"),
609 ("key4","key4","iwconfig key [4]"),
610 ("securitymode","Security mode","iwconfig enc"),
611 ("iwconfig","Additional parameters to iwconfig","ifup-wireless"),
612 ("iwpriv","Additional parameters to iwpriv","ifup-wireless"),
617 # Get list of existing attribute types
618 setting_types = GetNodeNetworkSettingTypes()
619 setting_types = [setting_type['name'] for setting_type in setting_types]
621 # Create/update default slice setting types
622 for default_setting_type in default_setting_types:
623 if default_setting_type['name'] not in setting_types:
624 AddNodeNetworkSettingType(default_setting_type)
626 UpdateNodeNetworkSettingType(default_setting_type['name'], default_setting_type)
628 # Create/update system slices
631 {'name': plc['slice_prefix'] + "_netflow",
632 'description': "PlanetFlow Traffic Auditing Service. Logs, captured in the root context using fprobe-ulogd, are stored in a directory in the root context which is bind mounted to the planetflow slice. The Planetflow Central service then periodically rsyncs these logs from the planetflow slice for aggregation.",
634 'instantiation': "plc-instantiated",
635 # Renew forever (minus one day, work around date conversion weirdness)
636 'expires': 0x7fffffff - (60 * 60 * 24),
637 'attributes': [('system', "1"),
638 ('vref', "planetflow"),
639 ('vsys', "pfmount")]},
641 {'name': plc['slice_prefix'] + "_sirius",
642 'description': 'The Sirius Calendar Service.\n\nSirius provides system-wide reservations of 25% CPU and 2Mb/s outgoing\nbandwidth. Sign up for hour-long slots using the Web GUI at the\nPlanetLab website.\n\nThis slice should not generate traffic external to PlanetLab.\n',
643 'url': url + "db/sirius/index.php",
644 'instantiation': "plc-instantiated",
645 # Renew forever (minus one day, work around date conversion weirdness)
646 'expires': 0x7fffffff - (60 * 60 * 24),
647 'attributes': [('system', "1"),
648 ('net_min_rate', "2000"),
650 ('initscript', plc['slice_prefix'] + "_sirius")]}
653 for default_slice in default_slices:
654 slices = GetSlices([default_slice['name']])
657 UpdateSlice(slice['slice_id'], default_slice)
659 AddSlice(default_slice)
660 slice = GetSlices([default_slice['name']])[0]
662 # Create/update all attributes
663 slice_attributes = []
664 if slice['slice_attribute_ids']:
665 # Delete unknown attributes
666 for slice_attribute in GetSliceAttributes(slice['slice_attribute_ids']):
667 if (slice_attribute['name'], slice_attribute['value']) \
668 not in default_slice['attributes']:
669 DeleteSliceAttribute(slice_attribute['slice_attribute_id'])
671 slice_attributes.append((slice_attribute['name'], slice_attribute['value']))
673 for (name, value) in default_slice['attributes']:
674 if (name, value) not in slice_attributes:
675 AddSliceAttribute(slice['name'], name, value)
678 Once the node meets these requirements, please reinitiate the install
681 https://%(PLC_WWW_HOST)s:%(PLC_WWW_SSL_PORT)d/db/nodes/?id=%(node_id)d
683 Update the BootState to 'Reinstall', then reboot the node.
685 If you have already performed this step and are still receiving this
686 message, please reply so that we may investigate the problem.
689 # Load default message templates
690 message_templates = [
691 {'message_id': 'Verify account',
692 'subject': "Verify account registration",
694 Please verify that you registered for a %(PLC_NAME)s account with the
695 username %(email)s by visiting:
697 https://%(PLC_WWW_HOST)s:%(PLC_WWW_SSL_PORT)d/db/persons/register.php?id=%(person_id)d&key=%(verification_key)s
699 If you did not register for a %(PLC_NAME)s account, please ignore this
700 message, or contact %(PLC_NAME)s Support <%(PLC_MAIL_SUPPORT_ADDRESS)s>.
704 {'message_id': 'New PI account',
705 'subject': "New PI account registration from %(first_name)s %(last_name)s <%(email)s> at %(site_name)s",
707 %(first_name)s %(last_name)s <%(email)s> has signed up for a new
708 %(PLC_NAME)s account at %(site_name)s and has requested a PI role. PIs
709 are responsible for enabling user accounts, creating slices, and
710 ensuring that all users abide by the %(PLC_NAME)s Acceptable Use
713 Only %(PLC_NAME)s administrators may enable new PI accounts. If you
714 are a PI at %(site_name)s, please respond and indicate whether this
715 registration is acceptable.
717 To view the request, visit:
719 https://%(PLC_WWW_HOST)s:%(PLC_WWW_SSL_PORT)d/db/persons/index.php?id=%(person_id)d
723 {'message_id': 'New account',
724 'subject': "New account registration from %(first_name)s %(last_name)s <%(email)s> at %(site_name)s",
726 %(first_name)s %(last_name)s <%(email)s> has signed up for a new
727 %(PLC_NAME)s account at %(site_name)s and has requested the following
730 To deny the request or enable the account, visit:
732 https://%(PLC_WWW_HOST)s:%(PLC_WWW_SSL_PORT)d/db/persons/index.php?id=%(person_id)d
736 {'message_id': 'Password reset requested',
737 'subject': "Password reset requested",
739 Someone has requested that the password of your %(PLC_NAME)s account
740 %(email)s be reset. If this person was you, you may continue with the
743 https://%(PLC_WWW_HOST)s:%(PLC_WWW_SSL_PORT)d/db/persons/reset_password.php?id=%(person_id)d&key=%(verification_key)s
745 If you did not request that your password be reset, please contact
746 %(PLC_NAME)s Support <%(PLC_MAIL_SUPPORT_ADDRESS)s>. Do not quote or
747 otherwise include any of this text in any correspondence.
751 {'message_id': 'Password reset',
752 'subject': "Password reset",
754 The password of your %(PLC_NAME)s account %(email)s has been
755 temporarily reset to:
759 Please change it at as soon as possible by visiting:
761 https://%(PLC_WWW_HOST)s:%(PLC_WWW_SSL_PORT)d/db/persons/index.php?id=%(person_id)d
763 If you did not request that your password be reset, please contact
764 %(PLC_NAME)s Support <%(PLC_MAIL_SUPPORT_ADDRESS)s>. Do not quote or
765 otherwise include any of this text in any correspondence.
769 # Boot Manager messages
770 {'message_id': "installfinished",
771 'subject': "%(hostname)s completed installation",
773 %(hostname)s just completed installation.
775 The node should be usable in a couple of minutes if installation was
780 {'message_id': "insufficientdisk",
781 'subject': "%(hostname)s does not have sufficient disk space",
783 %(hostname)s failed to boot because it does not have sufficent disk
784 space, or because its disk controller was not recognized.
786 Please replace the current disk or disk controller or install
787 additional disks to meet the current hardware requirements.
791 {'message_id': "insufficientmemory",
792 'subject': "%(hostname)s does not have sufficient memory",
794 %(hostname)s failed to boot because it does not have sufficent
797 Please install additional memory to meet the current hardware
802 {'message_id': "authfail",
803 'subject': "%(hostname)s failed to authenticate",
806 %(hostname)s failed to authenticate for the following reason:
810 The most common reason for authentication failure is that the
811 authentication key stored in the node configuration file, does not
812 match the key stored in our database. These keys must match in order to
813 authenticate the node successfully.
815 Each time the configuration file is downloaded, either as part of an All-in-One
816 BootImage or by downloading the plnode.txt file, the authentication key is
817 RECREATED. So, which ever file was downloaded most recently is the one we
818 have in our database. Often, users will download both the All-in-One image as
819 well as the plnode.txt file, and inadvertently break the boot image.
821 To repair this problem, simply download your All-in-One BootImage again, and
822 copy it to the appropriate read-only boot media (write-protected USB or
825 If you have already performed this step and are still receiving this
826 message, please reply so that we can help investigate the problem.
830 {'message_id': "notinstalled",
831 'subject': "%(hostname)s is not installed",
834 %(hostname)s failed to boot because it has either never been
835 installed, or the installation is corrupt.
837 Please check if the hard drive has failed, and replace it if so. After
840 https://%(PLC_WWW_HOST)s:%(PLC_WWW_SSL_PORT)d/db/nodes/?id=%(node_id)d
842 Change the 'Boot State' to 'Reinstall', and then reboot the node.
844 If you have already performed this step and are still receiving this
845 message, please reply so that we may investigate the problem.
849 {'message_id': "hostnamenotresolve",
850 'subject': "%(hostname)s does not resolve",
853 %(hostname)s failed to boot because its hostname does not resolve, or
854 does resolve but does not match its configured IP address.
856 Please check the network settings for the node, especially its
857 hostname, IP address, and DNS servers, by visiting:
859 https://%(PLC_WWW_HOST)s:%(PLC_WWW_SSL_PORT)d/db/nodes/?id=%(node_id)d
861 Correct any errors, and change the 'Boot State' to 'Reinstall', and then
864 If you have already performed this step and are still receiving this
865 message, please reply so that we may investigate the problem.
869 # XXX N.B. I don't think these are necessary, since there's no
870 # way that the Boot Manager would even be able to contact the
871 # API to send these messages.
873 {'message_id': "noconfig",
874 'subject': "%(hostname)s does not have a configuration file",
876 %(hostname)s failed to boot because it could not find a PlanetLab
877 configuration file. To create this file, visit:
879 https://%(PLC_WWW_HOST)s:%(PLC_WWW_SSL_PORT)d/db/nodes/?id=%(node_id)d
881 Click the Configuration File link, and save the downloaded file as
882 plnode.txt on either a floppy disk or a USB flash drive. Change the
883 'Boot State' to 'Reinstall', and then reboot the node.
885 If you have already performed this step and are still receiving this
886 message, please reply so that we may investigate the problem.
890 {'message_id': "nodetectednetwork",
891 'subject': "%(hostname)s has unsupported network hardware",
895 %(hostname)s failed to boot because it has network hardware that is
896 unsupported by the current production kernel. If it has booted
897 successfully in the past, please try re-installing it by visiting:
899 https://%(PLC_WWW_HOST)s:%(PLC_WWW_SSL_PORT)d/db/nodes/?id=%(node_id)d
901 Change the 'Boot State' to 'Reinstall', and then reboot the node.
903 If you have already performed this step and are still receiving this
904 message, please reply so that we may investigate the problem.
909 for template in message_templates:
910 messages = GetMessages([template['message_id']])
915 ### Setup Initial PCU information
916 pcu_types = [{'model': 'AP79xx',
917 'name': 'APC AP79xx',
918 'pcu_protocol_types': [{ 'port': 80,
919 'protocol': 'APC79xxHttp',
922 'protocol': 'APC79xx',
925 'protocol': 'APC79xx',
928 {'model': 'Masterswitch',
929 'name': 'APC Masterswitch',
930 'pcu_protocol_types': [{ 'port': 80,
931 'protocol': 'APCMasterHttp',
934 'protocol': 'APCMaster',
937 'protocol': 'APCMaster',
941 'name': 'BayTech DS4-RPC',
942 'pcu_protocol_types': [{ 'port': 80,
943 'protocol': 'BayTechHttp',
946 'protocol': 'BayTech',
949 'protocol': 'BayTech',
952 {'model': 'IP-41x_IP-81x',
953 'name': 'Dataprobe IP-41x & IP-81x',
954 'pcu_protocol_types': [ { 'port': 23,
955 'protocol': 'IPALTelnet',
958 'protocol': 'IPALHttp',
959 'supported': False}],
962 'name': 'Dell RAC Version 3',
963 'pcu_protocol_types': [],
966 'name': 'Dell RAC Version 4',
967 'pcu_protocol_types': [{ 'port': 443,
968 'protocol': 'DRACRacAdm',
971 'protocol': 'DRACRacAdm',
977 {'model': 'ePowerSwitch',
978 'name': 'ePowerSwitch 1/4/8x',
979 'pcu_protocol_types': [{ 'port': 80,
980 'protocol': 'ePowerSwitch',
984 'name': 'HP iLO2 (Integrated Lights-Out)',
985 'pcu_protocol_types': [{ 'port': 443,
986 'protocol': 'HPiLOHttps',
993 'name': 'HP iLO version 1',
994 'pcu_protocol_types': [],
996 {'model': 'PM211-MIP',
997 'name': 'Infratec PM221-MIP',
998 'pcu_protocol_types': [],
1001 'name': 'Intel AMT v2.5 (Active Management Technology)',
1002 'pcu_protocol_types': [],
1005 'name': 'Intel AMT v3.0 (Active Management Technology)',
1006 'pcu_protocol_types': [],
1008 {'model': 'WTI_IPS-4',
1009 'name': 'Western Telematic (WTI IPS-4)',
1010 'pcu_protocol_types': [],
1012 {'model': 'unknown',
1013 'name': 'Unknown Vendor or Model',
1014 'pcu_protocol_types': [{ 'port': 443,
1015 'protocol': 'UnknownPCU',
1016 'supported': False},
1018 'protocol': 'UnknownPCU',
1019 'supported': False},
1021 'protocol': 'UnknownPCU',
1022 'supported': False},
1024 'protocol': 'UnknownPCU',
1025 'supported': False}],
1028 # Get all model names
1029 pcu_models = [type['model'] for type in GetPCUTypes()]
1030 for type in pcu_types:
1031 protocol_types = type['pcu_protocol_types']
1032 # Take this value out of the struct.
1033 del type['pcu_protocol_types']
1034 if type['model'] not in pcu_models:
1035 # Add the name/model info into DB
1036 id = AddPCUType(type)
1037 # for each protocol, also add this.
1038 for ptype in protocol_types:
1039 AddPCUProtocolType(id, ptype)
1042 if __name__ == '__main__':