Beispiel #1
0
 def destroy(self, chassis_name=None):
     if Workspace.check_workspace_exists(chassis_name):
         try:
             chassis_info = ChassisWorkspace.get_chassis_info_in_workspace(chassis_name)
         except InfraSimError, e:
             print e.value
             logger_cmd.error("cmd res: {}".format(e.value))
             return
Beispiel #2
0
    def stop(self, chassis_name=None):
        try:
            if ChassisWorkspace.check_workspace_exists(chassis_name):
                chassis_info = ChassisWorkspace.get_chassis_info_in_workspace(chassis_name)
            else:
                chassis_info = cm.get_item_info(chassis_name)
            chassis = model.CChassis(chassis_name, chassis_info)
            chassis.init()

        except InfraSimError, e:
            print e.value
            logger_cmd.error("cmd res: {}".format(e.value))
            return
Beispiel #3
0
    def start(self, chassis_name=None):
        try:
            if ChassisWorkspace.check_workspace_exists(chassis_name):
                chassis_info = ChassisWorkspace.get_chassis_info_in_workspace(
                    chassis_name)
            else:
                chassis_info = cm.get_item_info(chassis_name)

            chassis = model.CChassis(chassis_name, chassis_info)
            chassis.precheck()
            chassis.init()

        except InfraSimError as e:
            print e.value
            logger_cmd.error("cmd res: {}".format(e.value))
            return

        chassis.start()

        # get IP address
        print "Chassis service for {} started".format(chassis_name)
        logger_cmd.info(
            "cmd res: start node {} chassis OK".format(chassis_name))
Beispiel #4
0
 def destroy(self, chassis_name=None):
     if Workspace.check_workspace_exists(chassis_name):
         try:
             chassis_info = ChassisWorkspace.get_chassis_info_in_workspace(
                 chassis_name)
         except InfraSimError as e:
             print e.value
             logger_cmd.error("cmd res: {}".format(e.value))
             return
     else:
         print "Chassis {} runtime workspace is not found, destroy action is not applied.".\
             format(chassis_name)
         logger_cmd.warning(
             "cmd res: Chassis {} runtime workspace is not found, "
             "destroy action is not applied.".format(chassis_name))
         return
     chassis = model.CChassis(chassis_name, chassis_info)
     try:
         chassis.init()
         chassis.destroy()
     except InfraSimError as e:
         print e.value
         logger_cmd.error("cmd res: {}".format(e.value))
     logger_cmd.info("cmd res: destroy chassis {} OK".format(chassis_name))