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
17 cfg = PLCConfiguration()
19 variables = cfg.variables()
21 # Load variables into dictionaries
22 for category_id, (category, variablelist) in variables.iteritems():
23 globals()[category_id] = dict(zip(variablelist.keys(),
24 [variable['value'] for variable in variablelist.values()]))
26 # Create/update the default administrator account (should be
28 admin = { 'person_id': 2,
29 'first_name': "Default",
30 'last_name': "Administrator",
31 'email': plc['root_user'],
32 'password': plc['root_password'] }
33 persons = GetPersons([admin['person_id']])
35 person_id = AddPerson(admin)
36 if person_id != admin['person_id']:
37 # Huh? Someone deleted the account manually from the database.
38 DeletePerson(person_id)
39 raise Exception, "Someone deleted the \"%s %s\" account from the database!" % \
40 (admin['first_name'], admin['last_name'])
41 UpdatePerson(person_id, { 'enabled': True })
43 person_id = persons[0]['person_id']
44 UpdatePerson(person_id, admin)
46 # Create/update the default site (should be site_id 1)
47 if plc_www['port'] == '80':
48 url = "http://" + plc_www['host'] + "/"
49 elif plc_www['port'] == '443':
50 url = "https://" + plc_www['host'] + "/"
52 url = "http://" + plc_www['host'] + ":" + plc_www['port'] + "/"
53 site = { 'site_id': 1,
54 'name': plc['name'] + " Central",
55 'abbreviated_name': plc['name'],
56 'login_base': plc['slice_prefix'],
61 sites = GetSites([site['site_id']])
63 site_id = AddSite(site['name'], site['abbreviated_name'], site['login_base'], site)
64 if site_id != site['site_id']:
66 raise Exception, "Someone deleted the \"%s\" site from the database!" % \
70 # Must call UpdateSite() even after AddSite() to update max_slices
71 site_id = sites[0]['site_id']
72 UpdateSite(site_id, site)
74 # The default administrator account must be associated with a site
76 AddPersonToSite(admin['person_id'], site['site_id'])
77 SetPersonPrimarySite(admin['person_id'], site['site_id'])
79 # Grant admin and PI roles to the default administrator account
80 AddRoleToPerson(10, admin['person_id'])
81 AddRoleToPerson(20, admin['person_id'])
83 # Setup default PlanetLabConf entries
84 default_conf_files = [
87 'source': 'PlanetLabConf/ntp.conf.php',
88 'dest': '/etc/ntp.conf',
89 'file_permissions': '644',
93 'postinstall_cmd': '/etc/rc.d/init.d/ntpd restart',
95 'ignore_cmd_errors': False,
96 'always_update': False},
98 'source': 'PlanetLabConf/ntp/step-tickers.php',
99 'dest': '/etc/ntp/step-tickers',
100 'file_permissions': '644',
101 'file_owner': 'root',
102 'file_group': 'root',
103 'preinstall_cmd': '',
104 'postinstall_cmd': '/etc/rc.d/init.d/ntpd restart',
106 'ignore_cmd_errors': False,
107 'always_update': False},
109 # SSH server configuration
111 'source': 'PlanetLabConf/sshd_config',
112 'dest': '/etc/ssh/sshd_config',
113 'file_permissions': '600',
114 'file_owner': 'root',
115 'file_group': 'root',
116 'preinstall_cmd': '',
117 'postinstall_cmd': '/etc/init.d/sshd restart',
119 'ignore_cmd_errors': False,
120 'always_update': False},
122 # Administrative SSH keys
124 'source': 'PlanetLabConf/keys.php?root',
125 'dest': '/root/.ssh/authorized_keys',
126 'file_permissions': '644',
127 'file_owner': 'root',
128 'file_group': 'root',
129 'preinstall_cmd': '',
130 'postinstall_cmd': '/bin/chmod 700 /root/.ssh',
132 'ignore_cmd_errors': False,
133 'always_update': False},
135 'source': 'PlanetLabConf/keys.php?site_admin',
136 'dest': '/home/site_admin/.ssh/authorized_keys',
137 'file_permissions': '644',
138 'file_owner': 'site_admin',
139 'file_group': 'site_admin',
140 'preinstall_cmd': 'grep -q site_admin /etc/passwd',
141 'postinstall_cmd': '/bin/chmod 700 /home/site_admin/.ssh',
143 'ignore_cmd_errors': False,
144 'always_update': False},
145 # Log rotation configuration
147 'source': 'PlanetLabConf/logrotate.conf',
148 'dest': '/etc/logrotate.conf',
149 'file_permissions': '644',
150 'file_owner': 'root',
151 'file_group': 'root',
152 'preinstall_cmd': '',
153 'postinstall_cmd': '',
155 'ignore_cmd_errors': False,
156 'always_update': False},
158 # updatedb/locate nightly cron job
160 'source': 'PlanetLabConf/slocate.cron',
161 'dest': '/etc/cron.daily/slocate.cron',
162 'file_permissions': '755',
163 'file_owner': 'root',
164 'file_group': 'root',
165 'preinstall_cmd': '',
166 'postinstall_cmd': '',
168 'ignore_cmd_errors': False,
169 'always_update': False},
173 'source': 'PlanetLabConf/f8/yum.conf',
174 'dest': '/etc/yum.conf',
175 'file_permissions': '644', 'file_owner': 'root', 'file_group': 'root',
176 'preinstall_cmd': '', 'postinstall_cmd': '', 'error_cmd': '',
177 'ignore_cmd_errors': False,
178 'always_update': False},
180 'source': 'PlanetLabConf/myplc.repo.php?gpgcheck=1',
181 'dest': '/etc/yum.myplc.d/myplc.repo',
182 'file_permissions': '644', 'file_owner': 'root', 'file_group': 'root',
183 'preinstall_cmd': '', 'postinstall_cmd': '', 'error_cmd': '',
184 'ignore_cmd_errors': False,
185 'always_update': False},
187 'source': 'PlanetLabConf/f8/yum.myplc.d/fedora.repo',
188 'dest': '/etc/yum.myplc.d/fedora.repo',
189 'file_permissions': '644', 'file_owner': 'root', 'file_group': 'root',
190 'preinstall_cmd': '', 'postinstall_cmd': '', 'error_cmd': '',
191 'ignore_cmd_errors': False,
192 'always_update': False},
194 'source': 'PlanetLabConf/f8/yum.myplc.d/fedora-updates.repo',
195 'dest': '/etc/yum.myplc.d/fedora-updates.repo',
196 'file_permissions': '644', 'file_owner': 'root', 'file_group': 'root',
197 'preinstall_cmd': '', 'postinstall_cmd': '', 'error_cmd': '',
198 'ignore_cmd_errors': False,
199 'always_update': False},
202 'source': 'PlanetLabConf/delete-rpm-list-production',
203 'dest': '/etc/planetlab/delete-rpm-list',
204 'file_permissions': '644',
205 'file_owner': 'root',
206 'file_group': 'root',
207 'preinstall_cmd': '',
208 'postinstall_cmd': '',
210 'ignore_cmd_errors': False,
211 'always_update': False},
215 'source': 'PlanetLabConf/get_plc_config.php',
216 'dest': '/etc/planetlab/plc_config',
217 'file_permissions': '644',
218 'file_owner': 'root',
219 'file_group': 'root',
220 'preinstall_cmd': '',
221 'postinstall_cmd': '',
223 'ignore_cmd_errors': False,
224 'always_update': False},
226 'source': 'PlanetLabConf/get_plc_config.php?python',
227 'dest': '/etc/planetlab/plc_config.py',
228 'file_permissions': '644',
229 'file_owner': 'root',
230 'file_group': 'root',
231 'preinstall_cmd': '',
232 'postinstall_cmd': '',
234 'ignore_cmd_errors': False,
235 'always_update': False},
237 'source': 'PlanetLabConf/get_plc_config.php?perl',
238 'dest': '/etc/planetlab/plc_config.pl',
239 'file_permissions': '644',
240 'file_owner': 'root',
241 'file_group': 'root',
242 'preinstall_cmd': '',
243 'postinstall_cmd': '',
245 'ignore_cmd_errors': False,
246 'always_update': False},
248 'source': 'PlanetLabConf/get_plc_config.php?php',
249 'dest': '/etc/planetlab/php/plc_config.php',
250 'file_permissions': '644',
251 'file_owner': 'root',
252 'file_group': 'root',
253 'preinstall_cmd': '',
254 'postinstall_cmd': '',
256 'ignore_cmd_errors': False,
257 'always_update': False},
259 # XXX Required for old Node Manager
260 # Proper configuration
262 'source': 'PlanetLabConf/propd.conf',
263 'dest': '/etc/proper/propd.conf',
264 'file_permissions': '644',
265 'file_owner': 'root',
266 'file_group': 'root',
267 'preinstall_cmd': '',
268 'postinstall_cmd': '/etc/init.d/proper restart',
270 'ignore_cmd_errors': True,
271 'always_update': False},
273 # XXX Required for old Node Manager
276 'source': 'PlanetLabConf/bwlimit.php',
277 'dest': '/etc/planetlab/bwcap',
278 'file_permissions': '644',
279 'file_owner': 'root',
280 'file_group': 'root',
281 'preinstall_cmd': '',
282 'postinstall_cmd': '',
284 'ignore_cmd_errors': True,
285 'always_update': False},
289 'source': 'PlanetLabConf/proxies.php',
290 'dest': '/etc/planetlab/proxies',
291 'file_permissions': '644',
292 'file_owner': 'root',
293 'file_group': 'root',
294 'preinstall_cmd': '',
295 'postinstall_cmd': '',
297 'ignore_cmd_errors': False,
298 'always_update': False},
300 # Firewall configuration
302 'source': 'PlanetLabConf/blacklist.php',
303 'dest': '/etc/planetlab/blacklist',
304 'file_permissions': '600',
305 'file_owner': 'root',
306 'file_group': 'root',
307 'preinstall_cmd': '',
308 'postinstall_cmd': '/sbin/iptables-restore --noflush < /etc/planetlab/blacklist',
310 'ignore_cmd_errors': True,
311 'always_update': False},
315 'source': 'PlanetLabConf/issue.php',
316 'dest': '/etc/issue',
317 'file_permissions': '644',
318 'file_owner': 'root',
319 'file_group': 'root',
320 'preinstall_cmd': '',
321 'postinstall_cmd': '',
323 'ignore_cmd_errors': False,
324 'always_update': False},
328 'source': 'PlanetLabConf/sysctl.php',
329 'dest': '/etc/sysctl.conf',
330 'file_permissions': '644',
331 'file_owner': 'root',
332 'file_group': 'root',
333 'preinstall_cmd': '',
334 'postinstall_cmd': '/sbin/sysctl -e -p /etc/sysctl.conf',
336 'ignore_cmd_errors': False,
337 'always_update': False},
339 # Sendmail configuration
341 'source': 'PlanetLabConf/sendmail.mc',
342 'dest': '/etc/mail/sendmail.mc',
343 'file_permissions': '644',
344 'file_owner': 'root',
345 'file_group': 'root',
346 'preinstall_cmd': '',
347 'postinstall_cmd': '',
349 'ignore_cmd_errors': False,
350 'always_update': False},
352 'source': 'PlanetLabConf/sendmail.cf',
353 'dest': '/etc/mail/sendmail.cf',
354 'file_permissions': '644',
355 'file_owner': 'root',
356 'file_group': 'root',
357 'preinstall_cmd': '',
358 'postinstall_cmd': 'service sendmail restart',
360 'ignore_cmd_errors': False,
361 'always_update': False},
365 'source': 'PlanetLabConf/RPM-GPG-KEY-fedora',
366 'dest': '/etc/pki/rpm-gpg/RPM-GPG-KEY-fedora',
367 'file_permissions': '644',
368 'file_owner': 'root',
369 'file_group': 'root',
370 'preinstall_cmd': '',
371 'postinstall_cmd': 'rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-fedora',
373 'ignore_cmd_errors': False,
374 'always_update': False},
376 'source': 'PlanetLabConf/get_gpg_key.php',
377 'dest': '/etc/pki/rpm-gpg/RPM-GPG-KEY-planetlab',
378 'file_permissions': '644',
379 'file_owner': 'root',
380 'file_group': 'root',
381 'preinstall_cmd': '',
382 'postinstall_cmd': 'rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-planetlab',
384 'ignore_cmd_errors': False,
385 'always_update': False},
387 # Ping of death configuration
388 # the 'restart' postcommand doesn't work, b/c the pod script doesn't support it.
390 'source': 'PlanetLabConf/ipod.conf.php',
391 'dest': '/etc/ipod.conf',
392 'file_permissions': '644',
393 'file_owner': 'root',
394 'file_group': 'root',
395 'preinstall_cmd': '',
396 'postinstall_cmd': '/etc/init.d/pod start',
398 'ignore_cmd_errors': False,
399 'always_update': False},
403 'source': 'PlanetLabConf/sudoers.php',
404 'dest': '/etc/sudoers',
405 'file_permissions': '440',
406 'file_owner': 'root',
407 'file_group': 'root',
408 'preinstall_cmd': '',
409 'postinstall_cmd': '/usr/sbin/visudo -c',
411 'ignore_cmd_errors': False,
412 'always_update': False}
415 # Get list of existing (enabled, global) files
416 conf_files = GetConfFiles()
417 conf_files = filter(lambda conf_file: conf_file['enabled'] and \
418 not conf_file['node_ids'] and \
419 not conf_file['nodegroup_ids'],
421 dests = [conf_file['dest'] for conf_file in conf_files]
422 conf_files = dict(zip(dests, conf_files))
424 # Create/update default PlanetLabConf entries
425 for default_conf_file in default_conf_files:
426 if default_conf_file['dest'] not in dests:
427 AddConfFile(default_conf_file)
429 conf_file = conf_files[default_conf_file['dest']]
430 UpdateConfFile(conf_file['conf_file_id'], default_conf_file)
432 # Setup default slice attribute types
433 default_attribute_types = [
434 # Slice type (only vserver is supported)
436 'description': "Type of slice (e.g. vserver)",
441 'description': "Is a default system slice (1) or not (0 or unset)",
444 # Slice enabled (1) or suspended (0)
446 'description': "Slice enabled (1 or unset) or suspended (0)",
449 # Slice reference image
451 'description': "Reference image",
454 # Slice initialization script
455 {'name': "initscript",
456 'description': "Slice initialization script",
461 'description': "Reserved CPU percent",
463 {'name': "cpu_share",
464 'description': "Number of CPU shares",
468 {'name': "net_min_rate",
469 'description': "Minimum bandwidth (kbps)",
471 {'name': "net_max_rate",
472 'description': "Maximum bandwidth (kbps)",
474 {'name': "net_i2_min_rate",
475 'description': "Minimum bandwidth over I2 routes (kbps)",
477 {'name': "net_i2_max_rate",
478 'description': "Maximum bandwidth over I2 routes (kbps)",
480 {'name': "net_max_kbyte",
481 'description': "Maximum daily network Tx KByte limit.",
483 {'name': "net_thresh_kbyte",
484 'description': "KByte limit before warning and throttling.",
486 {'name': "net_i2_max_kbyte",
487 'description': "Maximum daily network Tx KByte limit to I2 hosts.",
489 {'name': "net_i2_thresh_kbyte",
490 'description': "KByte limit to I2 hosts before warning and throttling.",
492 {'name': "net_share",
493 'description': "Number of bandwidth shares",
495 {'name': "net_i2_share",
496 'description': "Number of bandwidth shares over I2 routes",
501 'description': "Disk quota (1k disk blocks)",
505 {'name': "proper_op",
506 'description': "Proper operation (e.g. bind_socket)",
509 # VServer capabilities
510 {'name': "capabilities",
511 'description': "VServer bcapabilities (separate by commas)",
516 'description': "Bind vsys script fd's to a slice's vsys directory.",
521 'description': "Demux HTTP between slices using localhost ports. Value in the form 'host, localhost port'.",
526 # Get list of existing attribute types
527 attribute_types = GetSliceAttributeTypes()
528 attribute_types = [attribute_type['name'] for attribute_type in attribute_types]
530 # Create/update default slice attribute types
531 for default_attribute_type in default_attribute_types:
532 if default_attribute_type['name'] not in attribute_types:
533 AddSliceAttributeType(default_attribute_type)
535 UpdateSliceAttributeType(default_attribute_type['name'], default_attribute_type)
537 # Default Initscripts
538 default_initscripts = []
540 # Find initscripts and add them to the db
541 for (root, dirs, files) in os.walk("/etc/plc_sliceinitscripts"):
544 file = open(root + "/" + f, "ro")
545 default_initscripts.append({"name": plc['slice_prefix'] + "_" + f,
547 "script": file.read().replace("@SITE@", url).replace("@PREFIX@", plc['slice_prefix'])})
550 # Get list of existing initscripts
551 oldinitscripts = GetInitScripts()
552 oldinitscripts = [script['name'] for script in oldinitscripts]
554 for initscript in default_initscripts:
555 if initscript['name'] not in oldinitscripts: AddInitScript(initscript)
557 # Setup default slice attribute types
558 default_setting_types = [
560 {'category' : "general",
562 'description': "Set interface name, instead of eth0 or the like",
564 {'category' : "Multihome",
566 'description': "Specifies that the network is used for multihoming",
569 {'category' : "hidden",
571 'description': "For testing new settings",
574 { "category" : "WiFi",
576 "description" : "802.11 %s -- see %s"%(y,z),
577 "min_role_id" : 40 } for (x,y,z) in [
578 ("mode","Mode","iwconfig"),
579 ("essid","ESSID","iwconfig"),
580 ("nw","Network Id","iwconfig"),
581 ("freq","Frequency","iwconfig"),
582 ("channel","Channel","iwconfig"),
583 ("sens","sensitivity threshold","iwconfig"),
584 ("rate","Rate","iwconfig"),
585 ("key","key","iwconfig key"),
586 ("key1","key1","iwconfig key [1]"),
587 ("key2","key2","iwconfig key [2]"),
588 ("key3","key3","iwconfig key [3]"),
589 ("key4","key4","iwconfig key [4]"),
590 ("securitymode","Security mode","iwconfig enc"),
591 ("iwconfig","Additional parameters to iwconfig","ifup-wireless"),
592 ("iwpriv","Additional parameters to iwpriv","ifup-wireless"),
597 # Get list of existing attribute types
598 setting_types = GetNodeNetworkSettingTypes()
599 setting_types = [setting_type['name'] for setting_type in setting_types]
601 # Create/update default slice setting types
602 for default_setting_type in default_setting_types:
603 if default_setting_type['name'] not in setting_types:
604 AddNodeNetworkSettingType(default_setting_type)
606 UpdateNodeNetworkSettingType(default_setting_type['name'], default_setting_type)
608 # Create/update system slices
611 {'name': plc['slice_prefix'] + "_netflow",
612 '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.",
614 'instantiation': "plc-instantiated",
615 # Renew forever (minus one day, work around date conversion weirdness)
616 'expires': 0x7fffffff - (60 * 60 * 24),
617 'attributes': [('system', "1"),
618 ('vref', "planetflow"),
619 ('vsys', "pfmount")]},
621 {'name': plc['slice_prefix'] + "_sirius",
622 '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',
623 'url': url + "db/sirius/index.php",
624 'instantiation': "plc-instantiated",
625 # Renew forever (minus one day, work around date conversion weirdness)
626 'expires': 0x7fffffff - (60 * 60 * 24),
627 'attributes': [('system', "1"),
628 ('net_min_rate', "2000"),
630 ('initscript', plc['slice_prefix'] + "_sirius")]}
633 for default_slice in default_slices:
634 slices = GetSlices([default_slice['name']])
637 UpdateSlice(slice['slice_id'], default_slice)
639 AddSlice(default_slice)
640 slice = GetSlices([default_slice['name']])[0]
642 # Create/update all attributes
643 slice_attributes = []
644 if slice['slice_attribute_ids']:
645 # Delete unknown attributes
646 for slice_attribute in GetSliceAttributes(slice['slice_attribute_ids']):
647 if (slice_attribute['name'], slice_attribute['value']) \
648 not in default_slice['attributes']:
649 DeleteSliceAttribute(slice_attribute['slice_attribute_id'])
651 slice_attributes.append((slice_attribute['name'], slice_attribute['value']))
653 for (name, value) in default_slice['attributes']:
654 if (name, value) not in slice_attributes:
655 AddSliceAttribute(slice['name'], name, value)
658 Once the node meets these requirements, please reinitiate the install
661 https://%(PLC_WWW_HOST)s:%(PLC_WWW_SSL_PORT)d/db/nodes/?id=%(node_id)d
663 Update the BootState to 'Reinstall', then reboot the node.
665 If you have already performed this step and are still receiving this
666 message, please reply so that we may investigate the problem.
669 # Load default message templates
670 message_templates = [
671 {'message_id': 'Verify account',
672 'subject': "Verify account registration",
674 Please verify that you registered for a %(PLC_NAME)s account with the
675 username %(email)s by visiting:
677 https://%(PLC_WWW_HOST)s:%(PLC_WWW_SSL_PORT)d/db/persons/register.php?id=%(person_id)d&key=%(verification_key)s
679 If you did not register for a %(PLC_NAME)s account, please ignore this
680 message, or contact %(PLC_NAME)s Support <%(PLC_MAIL_SUPPORT_ADDRESS)s>.
684 {'message_id': 'New PI account',
685 'subject': "New PI account registration from %(first_name)s %(last_name)s <%(email)s> at %(site_name)s",
687 %(first_name)s %(last_name)s <%(email)s> has signed up for a new
688 %(PLC_NAME)s account at %(site_name)s and has requested a PI role. PIs
689 are responsible for enabling user accounts, creating slices, and
690 ensuring that all users abide by the %(PLC_NAME)s Acceptable Use
693 Only %(PLC_NAME)s administrators may enable new PI accounts. If you
694 are a PI at %(site_name)s, please respond and indicate whether this
695 registration is acceptable.
697 To view the request, visit:
699 https://%(PLC_WWW_HOST)s:%(PLC_WWW_SSL_PORT)d/db/persons/index.php?id=%(person_id)d
703 {'message_id': 'New account',
704 'subject': "New account registration from %(first_name)s %(last_name)s <%(email)s> at %(site_name)s",
706 %(first_name)s %(last_name)s <%(email)s> has signed up for a new
707 %(PLC_NAME)s account at %(site_name)s and has requested the following
710 To deny the request or enable the account, visit:
712 https://%(PLC_WWW_HOST)s:%(PLC_WWW_SSL_PORT)d/db/persons/index.php?id=%(person_id)d
716 {'message_id': 'Password reset requested',
717 'subject': "Password reset requested",
719 Someone has requested that the password of your %(PLC_NAME)s account
720 %(email)s be reset. If this person was you, you may continue with the
723 https://%(PLC_WWW_HOST)s:%(PLC_WWW_SSL_PORT)d/db/persons/reset_password.php?id=%(person_id)d&key=%(verification_key)s
725 If you did not request that your password be reset, please contact
726 %(PLC_NAME)s Support <%(PLC_MAIL_SUPPORT_ADDRESS)s>. Do not quote or
727 otherwise include any of this text in any correspondence.
731 {'message_id': 'Password reset',
732 'subject': "Password reset",
734 The password of your %(PLC_NAME)s account %(email)s has been
735 temporarily reset to:
739 Please change it at as soon as possible by visiting:
741 https://%(PLC_WWW_HOST)s:%(PLC_WWW_SSL_PORT)d/db/persons/index.php?id=%(person_id)d
743 If you did not request that your password be reset, please contact
744 %(PLC_NAME)s Support <%(PLC_MAIL_SUPPORT_ADDRESS)s>. Do not quote or
745 otherwise include any of this text in any correspondence.
749 # Boot Manager messages
750 {'message_id': "installfinished",
751 'subject': "%(hostname)s completed installation",
753 %(hostname)s just completed installation.
755 The node should be usable in a couple of minutes if installation was
760 {'message_id': "insufficientdisk",
761 'subject': "%(hostname)s does not have sufficient disk space",
763 %(hostname)s failed to boot because it does not have sufficent disk
764 space, or because its disk controller was not recognized.
766 Please replace the current disk or disk controller or install
767 additional disks to meet the current hardware requirements.
771 {'message_id': "insufficientmemory",
772 'subject': "%(hostname)s does not have sufficient memory",
774 %(hostname)s failed to boot because it does not have sufficent
777 Please install additional memory to meet the current hardware
782 {'message_id': "authfail",
783 'subject': "%(hostname)s failed to authenticate",
786 %(hostname)s failed to authenticate for the following reason:
790 The most common reason for authentication failure is that the
791 authentication key stored in the node configuration file, does not
792 match the key on record.
794 There are two possible steps to resolve the problem.
796 1. If you have used an All-in-one BootCD that includes the plnode.txt file,
797 then please check your machine for any old boot media, either in the
798 floppy drive, or on a USB stick. It is likely that an old configuration
799 is being used instead of the new configuration stored on the BootCD.
801 2. If you are using Generic BootCD image, then regenerate the node
802 configuration file by visiting:
804 https://%(PLC_WWW_HOST)s:%(PLC_WWW_SSL_PORT)d/db/nodes/?id=%(node_id)d
806 Under 'Download', follow the 'Download plnode.txt file for %(hostname)s'
807 option, and save the downloaded file as plnode.txt on either a floppy
808 disk or a USB flash drive. Be sure the 'Boot State' is set to 'Boot',
809 and, then reboot the node.
811 If you have already performed this step and are still receiving this
812 message, please reply so that we can help investigate the problem.
816 {'message_id': "notinstalled",
817 'subject': "%(hostname)s is not installed",
820 %(hostname)s failed to boot because it has either never been
821 installed, or the installation is corrupt.
823 Please check if the hard drive has failed, and replace it if so. After
826 https://%(PLC_WWW_HOST)s:%(PLC_WWW_SSL_PORT)d/db/nodes/?id=%(node_id)d
828 Change the 'Boot State' to 'Reinstall', and then reboot the node.
830 If you have already performed this step and are still receiving this
831 message, please reply so that we may investigate the problem.
835 {'message_id': "hostnamenotresolve",
836 'subject': "%(hostname)s does not resolve",
839 %(hostname)s failed to boot because its hostname does not resolve, or
840 does resolve but does not match its configured IP address.
842 Please check the network settings for the node, especially its
843 hostname, IP address, and DNS servers, by visiting:
845 https://%(PLC_WWW_HOST)s:%(PLC_WWW_SSL_PORT)d/db/nodes/?id=%(node_id)d
847 Correct any errors, and change the 'Boot State' to 'Reinstall', and then
850 If you have already performed this step and are still receiving this
851 message, please reply so that we may investigate the problem.
855 # XXX N.B. I don't think these are necessary, since there's no
856 # way that the Boot Manager would even be able to contact the
857 # API to send these messages.
859 {'message_id': "noconfig",
860 'subject': "%(hostname)s does not have a configuration file",
862 %(hostname)s failed to boot because it could not find a PlanetLab
863 configuration file. To create this file, visit:
865 https://%(PLC_WWW_HOST)s:%(PLC_WWW_SSL_PORT)d/db/nodes/?id=%(node_id)d
867 Click the Configuration File link, and save the downloaded file as
868 plnode.txt on either a floppy disk or a USB flash drive. Change the
869 'Boot State' to 'Reinstall', and then reboot the node.
871 If you have already performed this step and are still receiving this
872 message, please reply so that we may investigate the problem.
876 {'message_id': "nodetectednetwork",
877 'subject': "%(hostname)s has unsupported network hardware",
881 %(hostname)s failed to boot because it has network hardware that is
882 unsupported by the current production kernel. If it has booted
883 successfully in the past, please try re-installing it by visiting:
885 https://%(PLC_WWW_HOST)s:%(PLC_WWW_SSL_PORT)d/db/nodes/?id=%(node_id)d
887 Change the 'Boot State' to 'Reinstall', and then reboot the node.
889 If you have already performed this step and are still receiving this
890 message, please reply so that we may investigate the problem.
895 for template in message_templates:
896 messages = GetMessages([template['message_id']])
901 ### Setup Initial PCU information
902 pcu_types = [{'model': 'AP79xx',
903 'name': 'APC AP79xx',
904 'pcu_protocol_types': [{ 'port': 80,
905 'protocol': 'APC79xxHttp',
908 'protocol': 'APC79xx',
911 'protocol': 'APC79xx',
914 {'model': 'Masterswitch',
915 'name': 'APC Masterswitch',
916 'pcu_protocol_types': [{ 'port': 80,
917 'protocol': 'APCMasterHttp',
920 'protocol': 'APCMaster',
923 'protocol': 'APCMaster',
927 'name': 'BayTech DS4-RPC',
928 'pcu_protocol_types': [{ 'port': 80,
929 'protocol': 'BayTechHttp',
932 'protocol': 'BayTech',
935 'protocol': 'BayTech',
938 {'model': 'IP-41x_IP-81x',
939 'name': 'Dataprobe IP-41x & IP-81x',
940 'pcu_protocol_types': [ { 'port': 23,
941 'protocol': 'IPALTelnet',
944 'protocol': 'IPALHttp',
945 'supported': False}],
948 'name': 'Dell RAC Version 3',
949 'pcu_protocol_types': [],
952 'name': 'Dell RAC Version 4',
953 'pcu_protocol_types': [{ 'port': 443,
954 'protocol': 'DRACRacAdm',
957 'protocol': 'DRACRacAdm',
963 {'model': 'ePowerSwitch',
964 'name': 'ePowerSwitch 1/4/8x',
965 'pcu_protocol_types': [{ 'port': 80,
966 'protocol': 'ePowerSwitch',
970 'name': 'HP iLO2 (Integrated Lights-Out)',
971 'pcu_protocol_types': [{ 'port': 443,
972 'protocol': 'HPiLOHttps',
979 'name': 'HP iLO version 1',
980 'pcu_protocol_types': [],
982 {'model': 'PM211-MIP',
983 'name': 'Infratec PM221-MIP',
984 'pcu_protocol_types': [],
987 'name': 'Intel AMT v2.5 (Active Management Technology)',
988 'pcu_protocol_types': [],
991 'name': 'Intel AMT v3.0 (Active Management Technology)',
992 'pcu_protocol_types': [],
994 {'model': 'WTI_IPS-4',
995 'name': 'Western Telematic (WTI IPS-4)',
996 'pcu_protocol_types': [],
999 'name': 'Unknown Vendor or Model',
1000 'pcu_protocol_types': [{ 'port': 443,
1001 'protocol': 'UnknownPCU',
1002 'supported': False},
1004 'protocol': 'UnknownPCU',
1005 'supported': False},
1007 'protocol': 'UnknownPCU',
1008 'supported': False},
1010 'protocol': 'UnknownPCU',
1011 'supported': False}],
1014 # Get all model names
1015 pcu_models = [type['model'] for type in GetPCUTypes()]
1016 for type in pcu_types:
1017 protocol_types = type['pcu_protocol_types']
1018 # Take this value out of the struct.
1019 del type['pcu_protocol_types']
1020 if type['model'] not in pcu_models:
1021 # Add the name/model info into DB
1022 id = AddPCUType(type)
1023 # for each protocol, also add this.
1024 for ptype in protocol_types:
1025 AddPCUProtocolType(id, ptype)
1028 if __name__ == '__main__':