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
10 # $Id: db-config 7454 2007-12-11 18:55:00Z faiyaza $
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/yum.conf.php?gpgcheck=1',
174 'dest': '/etc/yum.conf',
175 'file_permissions': '644',
176 'file_owner': 'root',
177 'file_group': 'root',
178 'preinstall_cmd': '',
179 'postinstall_cmd': '',
181 'ignore_cmd_errors': False,
182 'always_update': False},
184 'source': 'PlanetLabConf/delete-rpm-list-production',
185 'dest': '/etc/planetlab/delete-rpm-list',
186 'file_permissions': '644',
187 'file_owner': 'root',
188 'file_group': 'root',
189 'preinstall_cmd': '',
190 'postinstall_cmd': '',
192 'ignore_cmd_errors': False,
193 'always_update': False},
197 'source': 'PlanetLabConf/get_plc_config.php',
198 'dest': '/etc/planetlab/plc_config',
199 'file_permissions': '644',
200 'file_owner': 'root',
201 'file_group': 'root',
202 'preinstall_cmd': '',
203 'postinstall_cmd': '',
205 'ignore_cmd_errors': False,
206 'always_update': False},
208 'source': 'PlanetLabConf/get_plc_config.php?python',
209 'dest': '/etc/planetlab/plc_config.py',
210 'file_permissions': '644',
211 'file_owner': 'root',
212 'file_group': 'root',
213 'preinstall_cmd': '',
214 'postinstall_cmd': '',
216 'ignore_cmd_errors': False,
217 'always_update': False},
219 'source': 'PlanetLabConf/get_plc_config.php?perl',
220 'dest': '/etc/planetlab/plc_config.pl',
221 'file_permissions': '644',
222 'file_owner': 'root',
223 'file_group': 'root',
224 'preinstall_cmd': '',
225 'postinstall_cmd': '',
227 'ignore_cmd_errors': False,
228 'always_update': False},
230 'source': 'PlanetLabConf/get_plc_config.php?php',
231 'dest': '/etc/planetlab/php/plc_config.php',
232 'file_permissions': '644',
233 'file_owner': 'root',
234 'file_group': 'root',
235 'preinstall_cmd': '',
236 'postinstall_cmd': '',
238 'ignore_cmd_errors': False,
239 'always_update': False},
241 # XXX Required for old Node Manager
242 # Proper configuration
244 'source': 'PlanetLabConf/propd.conf',
245 'dest': '/etc/proper/propd.conf',
246 'file_permissions': '644',
247 'file_owner': 'root',
248 'file_group': 'root',
249 'preinstall_cmd': '',
250 'postinstall_cmd': '/etc/init.d/proper restart',
252 'ignore_cmd_errors': True,
253 'always_update': False},
255 # XXX Required for old Node Manager
258 'source': 'PlanetLabConf/bwlimit.php',
259 'dest': '/etc/planetlab/bwcap',
260 'file_permissions': '644',
261 'file_owner': 'root',
262 'file_group': 'root',
263 'preinstall_cmd': '',
264 'postinstall_cmd': '',
266 'ignore_cmd_errors': True,
267 'always_update': False},
271 'source': 'PlanetLabConf/proxies.php',
272 'dest': '/etc/planetlab/proxies',
273 'file_permissions': '644',
274 'file_owner': 'root',
275 'file_group': 'root',
276 'preinstall_cmd': '',
277 'postinstall_cmd': '',
279 'ignore_cmd_errors': False,
280 'always_update': False},
282 # Firewall configuration
284 'source': 'PlanetLabConf/iptables',
285 'dest': '/etc/sysconfig/iptables',
286 'file_permissions': '600',
287 'file_owner': 'root',
288 'file_group': 'root',
289 'preinstall_cmd': '',
290 'postinstall_cmd': '',
292 'ignore_cmd_errors': False,
293 'always_update': False},
295 'source': 'PlanetLabConf/blacklist.php',
296 'dest': '/etc/planetlab/blacklist',
297 'file_permissions': '600',
298 'file_owner': 'root',
299 'file_group': 'root',
300 'preinstall_cmd': '',
301 'postinstall_cmd': '/sbin/iptables-restore --noflush < /etc/planetlab/blacklist',
303 'ignore_cmd_errors': True,
304 'always_update': False},
308 'source': 'PlanetLabConf/issue.php',
309 'dest': '/etc/issue',
310 'file_permissions': '644',
311 'file_owner': 'root',
312 'file_group': 'root',
313 'preinstall_cmd': '',
314 'postinstall_cmd': '',
316 'ignore_cmd_errors': False,
317 'always_update': False},
321 'source': 'PlanetLabConf/sysctl.php',
322 'dest': '/etc/sysctl.conf',
323 'file_permissions': '644',
324 'file_owner': 'root',
325 'file_group': 'root',
326 'preinstall_cmd': '',
327 'postinstall_cmd': '/sbin/sysctl -e -p /etc/sysctl.conf',
329 'ignore_cmd_errors': False,
330 'always_update': False},
332 # Sendmail configuration
334 'source': 'PlanetLabConf/sendmail.mc',
335 'dest': '/etc/mail/sendmail.mc',
336 'file_permissions': '644',
337 'file_owner': 'root',
338 'file_group': 'root',
339 'preinstall_cmd': '',
340 'postinstall_cmd': '',
342 'ignore_cmd_errors': False,
343 'always_update': False},
345 'source': 'PlanetLabConf/sendmail.cf',
346 'dest': '/etc/mail/sendmail.cf',
347 'file_permissions': '644',
348 'file_owner': 'root',
349 'file_group': 'root',
350 'preinstall_cmd': '',
351 'postinstall_cmd': 'service sendmail restart',
353 'ignore_cmd_errors': False,
354 'always_update': False},
358 'source': 'PlanetLabConf/RPM-GPG-KEY-fedora',
359 'dest': '/etc/pki/rpm-gpg/RPM-GPG-KEY-fedora',
360 'file_permissions': '644',
361 'file_owner': 'root',
362 'file_group': 'root',
363 'preinstall_cmd': '',
364 'postinstall_cmd': 'rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-fedora',
366 'ignore_cmd_errors': False,
367 'always_update': False},
369 'source': 'PlanetLabConf/get_gpg_key.php',
370 'dest': '/etc/pki/rpm-gpg/RPM-GPG-KEY-planetlab',
371 'file_permissions': '644',
372 'file_owner': 'root',
373 'file_group': 'root',
374 'preinstall_cmd': '',
375 'postinstall_cmd': 'rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-planetlab',
377 'ignore_cmd_errors': False,
378 'always_update': False},
380 # Ping of death configuration
381 # the 'restart' postcommand doesn't work, b/c the pod script doesn't support it.
383 'source': 'PlanetLabConf/ipod.conf.php',
384 'dest': '/etc/ipod.conf',
385 'file_permissions': '644',
386 'file_owner': 'root',
387 'file_group': 'root',
388 'preinstall_cmd': '',
389 'postinstall_cmd': '/etc/init.d/pod start',
391 'ignore_cmd_errors': False,
392 'always_update': False},
396 'source': 'PlanetLabConf/sudoers',
397 'dest': '/etc/sudoers',
398 'file_permissions': '440',
399 'file_owner': 'root',
400 'file_group': 'root',
401 'preinstall_cmd': '',
402 'postinstall_cmd': '/usr/sbin/visudo -c',
404 'ignore_cmd_errors': False,
405 'always_update': False}
408 # Get list of existing (enabled, global) files
409 conf_files = GetConfFiles()
410 conf_files = filter(lambda conf_file: conf_file['enabled'] and \
411 not conf_file['node_ids'] and \
412 not conf_file['nodegroup_ids'],
414 dests = [conf_file['dest'] for conf_file in conf_files]
415 conf_files = dict(zip(dests, conf_files))
417 # Create/update default PlanetLabConf entries
418 for default_conf_file in default_conf_files:
419 if default_conf_file['dest'] not in dests:
420 AddConfFile(default_conf_file)
422 conf_file = conf_files[default_conf_file['dest']]
423 UpdateConfFile(conf_file['conf_file_id'], default_conf_file)
425 # Setup default slice attribute types
426 default_attribute_types = [
427 # Slice type (only vserver is supported)
429 'description': "Type of slice (e.g. vserver)",
434 'description': "Is a default system slice (1) or not (0 or unset)",
437 # Slice enabled (1) or suspended (0)
439 'description': "Slice enabled (1 or unset) or suspended (0)",
442 # Slice reference image
444 'description': "Reference image",
447 # Slice initialization script
448 {'name': "initscript",
449 'description': "Slice initialization script",
454 'description': "Reserved CPU percent",
456 {'name': "cpu_share",
457 'description': "Number of CPU shares",
461 {'name': "net_min_rate",
462 'description': "Minimum bandwidth (kbps)",
464 {'name': "net_max_rate",
465 'description': "Maximum bandwidth (kbps)",
467 {'name': "net_i2_min_rate",
468 'description': "Minimum bandwidth over I2 routes (kbps)",
470 {'name': "net_i2_max_rate",
471 'description': "Maximum bandwidth over I2 routes (kbps)",
473 {'name': "net_max_kbyte",
474 'description': "Maximum daily network Tx KByte limit.",
476 {'name': "net_thresh_kbyte",
477 'description': "KByte limit before warning and throttling.",
479 {'name': "net_i2_max_kbyte",
480 'description': "Maximum daily network Tx KByte limit to I2 hosts.",
482 {'name': "net_i2_thresh_kbyte",
483 'description': "KByte limit to I2 hosts before warning and throttling.",
485 {'name': "net_share",
486 'description': "Number of bandwidth shares",
488 {'name': "net_i2_share",
489 'description': "Number of bandwidth shares over I2 routes",
494 'description': "Disk quota (1k disk blocks)",
498 {'name': "proper_op",
499 'description': "Proper operation (e.g. bind_socket)",
502 # VServer capabilities
503 {'name': "capabilities",
504 'description': "VServer bcapabilities (separate by commas)",
509 'description': "Bind vsys script fd's to a slice's vsys directory.",
514 # Get list of existing attribute types
515 attribute_types = GetSliceAttributeTypes()
516 attribute_types = [attribute_type['name'] for attribute_type in attribute_types]
518 # Create/update default slice attribute types
519 for default_attribute_type in default_attribute_types:
520 if default_attribute_type['name'] not in attribute_types:
521 AddSliceAttributeType(default_attribute_type)
523 UpdateSliceAttributeType(default_attribute_type['name'], default_attribute_type)
525 # Default Initscripts
526 default_initscripts = []
528 # Find initscripts and add them to the db
529 for (root, dirs, files) in os.walk("/etc/plc_sliceinitscripts"):
532 file = open(root + "/" + f, "ro")
533 default_initscripts.append({"name": plc['slice_prefix'] + "_" + f,
535 "script": file.read()})
538 # Get list of existing initscripts
539 oldinitscripts = GetInitScripts()
540 oldinitscripts = [script['name'] for script in oldinitscripts]
542 for initscript in default_initscripts:
543 if initscript['name'] not in oldinitscripts: AddInitScript(initscript)
545 # Setup default slice attribute types
546 default_setting_types = [
548 {'category' : "general",
550 'description': "Set interface name, instead of eth0 or the like",
552 {'category' : "general",
554 'description': "Use this to specify an alternate driver",
555 'min_role_id' : 40 },
556 {'category' : "general",
558 'description': "Allows to reuse an interface as eth0:alias",
561 {'category' : "hidden",
563 'description': "For testing new settings",
566 { "category" : "WiFi",
568 "description" : "802.11 %s -- see %s"%(y,z),
569 "min_role_id" : 40 } for (x,y,z) in [
570 ("mode","Mode","iwconfig"),
571 ("essid","ESSID","iwconfig"),
572 ("nw","Network Id","iwconfig"),
573 ("freq","Frequency","iwconfig"),
574 ("channel","Channel","iwconfig"),
575 ("sens","sensitivity threshold","iwconfig"),
576 ("rate","Rate","iwconfig"),
577 ("key","key","iwconfig key"),
578 ("key1","key1","iwconfig key [1]"),
579 ("key2","key2","iwconfig key [2]"),
580 ("key3","key3","iwconfig key [3]"),
581 ("key4","key4","iwconfig key [4]"),
582 ("securitymode","Security mode","iwconfig enc"),
583 ("iwconfig","Additional parameters to iwconfig","ifup-wireless"),
584 ("iwpriv","Additional parameters to iwpriv","ifup-wireless"),
589 # Get list of existing attribute types
590 setting_types = GetNodeNetworkSettingTypes()
591 setting_types = [setting_type['name'] for setting_type in setting_types]
593 # Create/update default slice setting types
594 for default_setting_type in default_setting_types:
595 if default_setting_type['name'] not in setting_types:
596 AddNodeNetworkSettingType(default_setting_type)
598 UpdateNodeNetworkSettingType(default_setting_type['name'], default_setting_type)
600 # Create/update system slices
603 {'name': plc['slice_prefix'] + "_netflow",
604 'description': "PlanetFlow Traffic Auditing Service",
606 'instantiation': "plc-instantiated",
607 # Renew forever (minus one day, work around date conversion weirdness)
608 'expires': sys.maxint - (60 * 60 * 24),
609 'attributes': [('system', "1"),
610 ('vref', "planetflow"),
611 ('proper_op', "open file=/etc/passwd, flags=r"),
612 ('proper_op', "create_socket"),
613 ('proper_op', "bind_socket")]},
615 {'name': plc['slice_prefix'] + "_sirius",
616 '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',
618 'instantiation': "plc-instantiated",
619 # Renew forever (minus one day, work around date conversion weirdness)
620 'expires': sys.maxint - (60 * 60 * 24),
621 'attributes': [('system', "1"),
622 ('net_min_rate', "2000"),
624 ('initscript', plc['slice_prefix'] + "_sirius")]}
627 for default_slice in default_slices:
628 slices = GetSlices([default_slice['name']])
631 UpdateSlice(slice['slice_id'], default_slice)
633 AddSlice(default_slice)
634 slice = GetSlices([default_slice['name']])[0]
636 # Create/update all attributes
637 slice_attributes = []
638 if slice['slice_attribute_ids']:
639 # Delete unknown attributes
640 for slice_attribute in GetSliceAttributes(slice['slice_attribute_ids']):
641 if (slice_attribute['name'], slice_attribute['value']) \
642 not in default_slice['attributes']:
643 DeleteSliceAttribute(slice_attribute['slice_attribute_id'])
645 slice_attributes.append((slice_attribute['name'], slice_attribute['value']))
647 for (name, value) in default_slice['attributes']:
648 if (name, value) not in slice_attributes:
649 AddSliceAttribute(slice['name'], name, value)
652 Once the node meets these requirements, please reinitiate the install
655 https://%(PLC_WWW_HOST)s:%(PLC_WWW_SSL_PORT)d/db/nodes/?id=%(node_id)d
657 Update the BootState to 'Reinstall', then reboot the node.
659 If you have already performed this step and are still receiving this
660 message, please reply so that we may investigate the problem.
663 # Load default message templates
664 message_templates = [
665 {'message_id': 'Verify account',
666 'subject': "Verify account registration",
668 Please verify that you registered for a %(PLC_NAME)s account with the
669 username %(email)s by visiting:
671 https://%(PLC_WWW_HOST)s:%(PLC_WWW_SSL_PORT)d/db/persons/register.php?id=%(person_id)d&key=%(verification_key)s
673 If you did not register for a %(PLC_NAME)s account, please ignore this
674 message, or contact %(PLC_NAME)s Support <%(PLC_MAIL_SUPPORT_ADDRESS)s>.
678 {'message_id': 'New PI account',
679 'subject': "New PI account registration from %(first_name)s %(last_name)s <%(email)s> at %(site_name)s",
681 %(first_name)s %(last_name)s <%(email)s> has signed up for a new
682 %(PLC_NAME)s account at %(site_name)s and has requested a PI role. PIs
683 are responsible for enabling user accounts, creating slices, and
684 ensuring that all users abide by the %(PLC_NAME)s Acceptable Use
687 Only %(PLC_NAME)s administrators may enable new PI accounts. If you
688 are a PI at %(site_name)s, please respond and indicate whether this
689 registration is acceptable.
691 To view the request, visit:
693 https://%(PLC_WWW_HOST)s:%(PLC_WWW_SSL_PORT)d/db/persons/index.php?id=%(person_id)d
697 {'message_id': 'New account',
698 'subject': "New account registration from %(first_name)s %(last_name)s <%(email)s> at %(site_name)s",
700 %(first_name)s %(last_name)s <%(email)s> has signed up for a new
701 %(PLC_NAME)s account at %(site_name)s and has requested the following
704 To deny the request or enable the account, visit:
706 https://%(PLC_WWW_HOST)s:%(PLC_WWW_SSL_PORT)d/db/persons/index.php?id=%(person_id)d
710 {'message_id': 'Password reset requested',
711 'subject': "Password reset requested",
713 Someone has requested that the password of your %(PLC_NAME)s account
714 %(email)s be reset. If this person was you, you may continue with the
717 https://%(PLC_WWW_HOST)s:%(PLC_WWW_SSL_PORT)d/db/persons/reset_password.php?id=%(person_id)d&key=%(verification_key)s
719 If you did not request that your password be reset, please contact
720 %(PLC_NAME)s Support <%(PLC_MAIL_SUPPORT_ADDRESS)s>. Do not quote or
721 otherwise include any of this text in any correspondence.
725 {'message_id': 'Password reset',
726 'subject': "Password reset",
728 The password of your %(PLC_NAME)s account %(email)s has been
729 temporarily reset to:
733 Please change it at as soon as possible by visiting:
735 https://%(PLC_WWW_HOST)s:%(PLC_WWW_SSL_PORT)d/db/persons/index.php?id=%(person_id)d
737 If you did not request that your password be reset, please contact
738 %(PLC_NAME)s Support <%(PLC_MAIL_SUPPORT_ADDRESS)s>. Do not quote or
739 otherwise include any of this text in any correspondence.
743 # Boot Manager messages
744 {'message_id': "installfinished",
745 'subject': "%(hostname)s completed installation",
747 %(hostname)s just completed installation.
749 The node should be usable in a couple of minutes if installation was
754 {'message_id': "insufficientdisk",
755 'subject': "%(hostname)s does not have sufficient disk space",
757 %(hostname)s failed to boot because it does not have sufficent disk
758 space, or because its disk controller was not recognized.
760 Please replace the current disk or disk controller or install
761 additional disks to meet the current hardware requirements.
765 {'message_id': "insufficientmemory",
766 'subject': "%(hostname)s does not have sufficient memory",
768 %(hostname)s failed to boot because it does not have sufficent
771 Please install additional memory to meet the current hardware
776 {'message_id': "authfail",
777 'subject': "%(hostname)s failed to authenticate",
780 %(hostname)s failed to authenticate for the following reason:
784 The most common reason for authentication failure is that the
785 authentication key stored in the node configuration file, does not
786 match the key on record.
788 There are two possible steps to resolve the problem.
790 1. If you have used an All-in-one BootCD that includes the plnode.txt file,
791 then please check your machine for any old boot media, either in the
792 floppy drive, or on a USB stick. It is likely that an old configuration
793 is being used instead of the new configuration stored on the BootCD.
795 2. If you are using Generic BootCD image, then regenerate the node
796 configuration file by visiting:
798 https://%(PLC_WWW_HOST)s:%(PLC_WWW_SSL_PORT)d/db/nodes/?id=%(node_id)d
800 Under 'Download', follow the 'Download plnode.txt file for %(hostname)s'
801 option, and save the downloaded file as plnode.txt on either a floppy
802 disk or a USB flash drive. Be sure the 'Boot State' is set to 'Boot',
803 and, then reboot the node.
805 If you have already performed this step and are still receiving this
806 message, please reply so that we can help investigate the problem.
810 {'message_id': "notinstalled",
811 'subject': "%(hostname)s is not installed",
814 %(hostname)s failed to boot because it has either never been
815 installed, or the installation is corrupt.
817 Please check if the hard drive has failed, and replace it if so. After
820 https://%(PLC_WWW_HOST)s:%(PLC_WWW_SSL_PORT)d/db/nodes/?id=%(node_id)d
822 Change the 'Boot State' to 'Reinstall', and then reboot the node.
824 If you have already performed this step and are still receiving this
825 message, please reply so that we may investigate the problem.
829 {'message_id': "hostnamenotresolve",
830 'subject': "%(hostname)s does not resolve",
833 %(hostname)s failed to boot because its hostname does not resolve, or
834 does resolve but does not match its configured IP address.
836 Please check the network settings for the node, especially its
837 hostname, IP address, and DNS servers, by visiting:
839 https://%(PLC_WWW_HOST)s:%(PLC_WWW_SSL_PORT)d/db/nodes/?id=%(node_id)d
841 Correct any errors, and change the 'Boot State' to 'Reinstall', and then
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 # XXX N.B. I don't think these are necessary, since there's no
850 # way that the Boot Manager would even be able to contact the
851 # API to send these messages.
853 {'message_id': "noconfig",
854 'subject': "%(hostname)s does not have a configuration file",
856 %(hostname)s failed to boot because it could not find a PlanetLab
857 configuration file. To create this file, visit:
859 https://%(PLC_WWW_HOST)s:%(PLC_WWW_SSL_PORT)d/db/nodes/?id=%(node_id)d
861 Click the Configuration File link, and save the downloaded file as
862 plnode.txt on either a floppy disk or a USB flash drive. Change the
863 'Boot State' to 'Reinstall', and then reboot the node.
865 If you have already performed this step and are still receiving this
866 message, please reply so that we may investigate the problem.
870 {'message_id': "nodetectednetwork",
871 'subject': "%(hostname)s has unsupported network hardware",
875 %(hostname)s failed to boot because it has network hardware that is
876 unsupported by the current production kernel. If it has booted
877 successfully in the past, please try re-installing it by visiting:
879 https://%(PLC_WWW_HOST)s:%(PLC_WWW_SSL_PORT)d/db/nodes/?id=%(node_id)d
881 Change the 'Boot State' to 'Reinstall', and then reboot the node.
883 If you have already performed this step and are still receiving this
884 message, please reply so that we may investigate the problem.
889 for template in message_templates:
890 messages = GetMessages([template['message_id']])
895 ### Setup Initial PCU information
896 pcu_types = [{'model': 'AP79xx',
897 'name': 'APC AP79xx',
898 'pcu_protocol_types': [{ 'port': 80,
899 'protocol': 'APC79xxHttp',
902 'protocol': 'APC79xx',
905 'protocol': 'APC79xx',
908 {'model': 'Masterswitch',
909 'name': 'APC Masterswitch',
910 'pcu_protocol_types': [{ 'port': 80,
911 'protocol': 'APCMasterHttp',
914 'protocol': 'APCMaster',
917 'protocol': 'APCMaster',
921 'name': 'BayTech DS4-RPC',
922 'pcu_protocol_types': [{ 'port': 80,
923 'protocol': 'BayTechHttp',
926 'protocol': 'BayTech',
929 'protocol': 'BayTech',
932 {'model': 'IP-41x_IP-81x',
933 'name': 'Dataprobe IP-41x & IP-81x',
934 'pcu_protocol_types': [ { 'port': 23,
935 'protocol': 'IPALTelnet',
938 'protocol': 'IPALHttp',
939 'supported': False}],
942 'name': 'Dell RAC Version 3',
943 'pcu_protocol_types': [],
946 'name': 'Dell RAC Version 4',
947 'pcu_protocol_types': [{ 'port': 443,
948 'protocol': 'DRACRacAdm',
951 'protocol': 'DRACRacAdm',
957 {'model': 'ePowerSwitch',
958 'name': 'ePowerSwitch 1/4/8x',
959 'pcu_protocol_types': [{ 'port': 80,
960 'protocol': 'ePowerSwitch',
964 'name': 'HP iLO2 (Integrated Lights-Out)',
965 'pcu_protocol_types': [{ 'port': 443,
966 'protocol': 'HPiLOHttps',
973 'name': 'HP iLO version 1',
974 'pcu_protocol_types': [],
976 {'model': 'PM211-MIP',
977 'name': 'Infratec PM221-MIP',
978 'pcu_protocol_types': [],
981 'name': 'Intel AMT v2.5 (Active Management Technology)',
982 'pcu_protocol_types': [],
985 'name': 'Intel AMT v3.0 (Active Management Technology)',
986 'pcu_protocol_types': [],
988 {'model': 'WTI_IPS-4',
989 'name': 'Western Telematic (WTI IPS-4)',
990 'pcu_protocol_types': [],
993 'name': 'Unknown Vendor or Model',
994 'pcu_protocol_types': [{ 'port': 443,
995 'protocol': 'UnknownPCU',
998 'protocol': 'UnknownPCU',
1001 'protocol': 'UnknownPCU',
1002 'supported': False},
1004 'protocol': 'UnknownPCU',
1005 'supported': False}],
1008 # Get all model names
1009 pcu_models = [type['model'] for type in GetPCUTypes()]
1010 for type in pcu_types:
1011 protocol_types = type['pcu_protocol_types']
1012 # Take this value out of the struct.
1013 del type['pcu_protocol_types']
1014 if type['model'] not in pcu_models:
1015 # Add the name/model info into DB
1016 id = AddPCUType(type)
1017 # for each protocol, also add this.
1018 for ptype in protocol_types:
1019 AddPCUProtocolType(id, ptype)
1022 if __name__ == '__main__':