def headnode_create_hnic(headnode, hnic): """Create hnic attached to given headnode. If the node does not exist, a NotFoundError will be raised. If there is already an hnic with that name, a DuplicateError will be raised. """ db = model.Session() headnode = _must_find(db, model.Headnode, headnode) _assert_absent_n(db, headnode, model.Hnic, hnic) if not headnode.dirty: raise IllegalStateError hnic = model.Hnic(headnode, hnic) db.add(hnic) if cfg.getboolean('recursive', 'rHaaS'): project = headnode.project.label bHaaS_out = check_output([ 'haas', 'headnode_create_hnic', headnode.label + '_' + project, hnic.label + '_' + project ], stderr=STDOUT, shell=False) error_checker(bHaaS_out) db.commit()
def headnode_create_hnic(headnode, hnic): """Create hnic attached to given headnode. If the node does not exist, a NotFoundError will be raised. If there is already an hnic with that name, a DuplicateError will be raised. """ db = model.Session() headnode = _must_find(db, model.Headnode, headnode) _assert_absent_n(db, headnode, model.Hnic, hnic) if not headnode.dirty: raise IllegalStateError hnic = model.Hnic(headnode, hnic) db.add(hnic) db.commit()
def headnode_create_hnic(headnode, hnic): """Create hnic attached to given headnode. If the node does not exist, a NotFoundError will be raised. If there is already an hnic with that name, a DuplicateError will be raised. If the headnode's VM has already created (headnode is not "dirty"), raises an IllegalStateError """ headnode = _must_find(model.Headnode, headnode) get_auth_backend().require_project_access(headnode.project) _assert_absent_n(headnode, model.Hnic, hnic) if not headnode.dirty: raise IllegalStateError hnic = model.Hnic(headnode, hnic) db.session.add(hnic) db.session.commit()