示例#1
0
    def migrate_vm(self, auth, dom_list, source_node_id,\
                    dest_node_id, live, force, all,dateval=None,timeval=None):
        task_service = self.svc_central.get_service(self.task_service_id)
        user_name = self._get_username(auth)
        isLive = False
        isForce = False
        migrate_all = False
        if live == 'true':
            isLive = True
        if force == 'true':
            isForce = True
        if all == 'true':
            migrate_all = True
        t = VMMigrateTask(u'Migrate VM', {}, [], \
                          dict(dom_list=dom_list, \
                               source_node_id=source_node_id,\
                               dest_node_id=dest_node_id,\
                               live=isLive, force=isForce, \
                               all=migrate_all), \
                          None, user_name)
        if all == 'true':
            t.set_entity_details(dest_node_id)
        else:
            t.set_entity_details(dom_list[0])

        execution_time = getDateTime(dateval, timeval)
        if execution_time is None:
            task_service.submit_sync(t)
        else:
            task_service.submit_schedule(t, execution_time)
        logger.debug("Migrate Task Submitted")
示例#2
0
    def migrate_vm(self, auth, dom_list, source_node_id,\
                    dest_node_id, live, force, all,dateval=None,timeval=None):
        task_service = self.svc_central.get_service(self.task_service_id)
        user_name = self._get_username(auth)
        isLive = False
        isForce = False
        migrate_all = False
        if live=='true':
            isLive = True 
        if force=='true':
            isForce = True
        if all=='true':
            migrate_all = True
        t = VMMigrateTask(u'Migrate VM', {}, [], \
                          dict(dom_list=dom_list, \
                               source_node_id=source_node_id,\
                               dest_node_id=dest_node_id,\
                               live=isLive, force=isForce, \
                               all=migrate_all), \
                          None, user_name)
        if all=='true':
            t.set_entity_details(dest_node_id)
        else:
             t.set_entity_details(dom_list[0])

        execution_time=getDateTime(dateval,timeval)
        if execution_time is None:
            task_service.submit_sync(t)
        else:
            task_service.submit_schedule(t, execution_time)
        logger.debug("Migrate Task Submitted")
示例#3
0
 def populate_node_info(self, auth, node_id, dateval=None,timeval=None):
     task_service = self.svc_central.get_service(self.task_service_id)
     user_name = self._get_username(auth)
     t = PopulateNodeInfoTask(u'Populate Node Information', {}, [], \
                      dict(node_id=node_id), None, user_name)
     t.set_entity_details(node_id)
     execution_time=getDateTime(dateval,timeval)
     if execution_time is None:
         task_service.submit_sync(t)
     else:
         task_service.submit_schedule(t, execution_time)
     logger.debug("Populate Node Information Task Submitted")
示例#4
0
 def populate_node_info(self, auth, node_id, dateval=None, timeval=None):
     task_service = self.svc_central.get_service(self.task_service_id)
     user_name = self._get_username(auth)
     t = PopulateNodeInfoTask(u'Populate Node Information', {}, [], \
                      dict(node_id=node_id), None, user_name)
     t.set_entity_details(node_id)
     execution_time = getDateTime(dateval, timeval)
     if execution_time is None:
         task_service.submit_sync(t)
     else:
         task_service.submit_schedule(t, execution_time)
     logger.debug("Populate Node Information Task Submitted")
示例#5
0
    def restore_vm(self, auth, node_id, file, dateval=None, timeval=None):
        task_service = self.svc_central.get_service(self.task_service_id)
        user_name = self._get_username(auth)
        t= VMRestoreTask(u'Restore VM', {}, [],\
                    dict(node_id=node_id, file=file), None, user_name)
        t.set_entity_details(node_id)

        execution_time = getDateTime(dateval, timeval)
        if execution_time is None:
            task_service.submit_sync(t)
        else:
            task_service.submit_schedule(t, execution_time)
        logger.debug("Restore Task Submitted")
示例#6
0
    def restore_vm(self, auth, node_id, file,dateval=None,timeval=None):
        task_service = self.svc_central.get_service(self.task_service_id)
        user_name = self._get_username(auth)
        t= VMRestoreTask(u'Restore VM', {}, [],\
                    dict(node_id=node_id, file=file), None, user_name)
        t.set_entity_details(node_id)

        execution_time=getDateTime(dateval,timeval)
        if execution_time is None:
            task_service.submit_sync(t)
        else:
            task_service.submit_schedule(t, execution_time)
        logger.debug("Restore Task Submitted")
示例#7
0
 def submit_task(self, task, dateval=None, timeval=None):
     result = None
     try:
         task_service = self.svc_central.get_service(self.task_service_id)
         execution_time = getDateTime(dateval, timeval)
         if execution_time is None:
             task_service.submit_sync(task)
         else:
             task_service.submit_schedule(task, execution_time)
         logger.debug("Task : " + task.name + " Submitted")
         result = task.task_id
     except Exception, ex:
         traceback.print_exc()
         raise ex
示例#8
0
 def import_vm_action(self, auth, node_id, directory,filenames,dateval=None,timeval=None):
     task_service = self.svc_central.get_service(self.task_service_id)
     user_name = self._get_username(auth)
     t = VMImportTask("Import VM", {}, [], \
                          dict(node_id=node_id,directory=directory,filenames=filenames),\
                          None, user_name)
     t.set_entity_details(node_id)
     execution_time=getDateTime(dateval,timeval)
     if execution_time is None:
         task_service.submit_sync(t)
     else:
         task_service.submit_schedule(t, execution_time)
     logger.debug("Import VM Task Submitted")
     return t.task_id
示例#9
0
    def save_vm(self, auth, dom_id, node_id, file, directory, dateval=None,timeval=None):
        task_service = self.svc_central.get_service(self.task_service_id)
        user_name = self._get_username(auth)
        t= VMSnapshotTask(u'Hibernate', {}, [],\
                          dict(dom_id=dom_id, node_id=node_id, file=file,\
                               directory=directory), None, user_name)
        t.set_entity_details(dom_id)

        execution_time=getDateTime(dateval,timeval)
        if execution_time is None:
            task_service.submit_sync(t)
        else:
            task_service.submit_schedule(t, execution_time)
        logger.debug("Snapshot Task Submitted")
示例#10
0
 def submit_task(self, task, dateval=None, timeval=None):
     result=None
     try:
         task_service = self.svc_central.get_service(self.task_service_id)
         execution_time=getDateTime(dateval,timeval)
         if execution_time is None:
             task_service.submit_sync(task)
         else:
             task_service.submit_schedule(task, execution_time)
         logger.debug("Task : "+ task.name+ " Submitted")
         result=task.task_id
     except Exception, ex:
         traceback.print_exc()
         raise ex
示例#11
0
    def server_action(self, auth, node_id, action,dateval=None,timeval=None):
        task_service = self.svc_central.get_service(self.task_service_id)
        user_name = self._get_username(auth)
        t = ServerActionTask(action, {}, [], \
                             dict(node_id=node_id,action=action),\
                             None, user_name)
        t.set_entity_details(node_id)

        execution_time=getDateTime(dateval,timeval)
        print execution_time
        if execution_time is None:
            task_service.submit_sync(t)
        else:
            task_service.submit_schedule(t, execution_time)
        logger.debug("Server Action Task Submitted")
示例#12
0
    def add_annotation(self, auth, node_id,text,user,dateval=None, timeval=None):
        task_service = self.svc_central.get_service(self.task_service_id)
        user_name = self._get_username(auth)
        t = AddAnnotationTask(u"Add Annotation ", {}, [],
                            dict(node_id=node_id,text=text,user=user),
                             None, user_name)
        t.set_entity_details(node_id)

        execution_time=getDateTime(dateval,timeval)
        if execution_time is None:
            task_service.submit_sync(t)
        else:
            task_service.submit_schedule(t, execution_time)
        logger.debug("Add Annotation Task Submitted")
        return t.task_id
示例#13
0
 def vm_remove_action(self, auth, dom_id, node_id, force=False, \
               dateval=None,timeval=None):
     task_service = self.svc_central.get_service(self.task_service_id)
     user_name = self._get_username(auth)
     t = VMRemoveTask(u'Remove VM', {}, [], \
                      dict(dom_id=dom_id,node_id=node_id,force=force),\
                      None, user_name)
     t.set_entity_details(node_id)
     execution_time = getDateTime(dateval, timeval)
     print execution_time
     if execution_time is None:
         task_service.submit_sync(t)
     else:
         task_service.submit_schedule(t, execution_time)
     logger.debug("Remove VM Task Submitted")
示例#14
0
 def vm_remove_action(self, auth, dom_id, node_id, force=False, \
               dateval=None,timeval=None):
     task_service = self.svc_central.get_service(self.task_service_id)
     user_name = self._get_username(auth)
     t = VMRemoveTask(u'Remove VM', {}, [], \
                      dict(dom_id=dom_id,node_id=node_id,force=force),\
                      None, user_name)
     t.set_entity_details(node_id)
     execution_time=getDateTime(dateval,timeval)
     print execution_time
     if execution_time is None:
         task_service.submit_sync(t)
     else:
         task_service.submit_schedule(t, execution_time)
     logger.debug("Remove VM Task Submitted")
示例#15
0
    def clear_annotation(self, auth, node_id, dateval=None, timeval=None):

        task_service = self.svc_central.get_service(self.task_service_id)
        user_name = self._get_username(auth)
        t = ClearAnnotationTask(u"Remove Annotation ", {}, [],
                                dict(node_id=node_id), None, user_name)
        t.set_entity_details(node_id)

        execution_time = getDateTime(dateval, timeval)
        if execution_time is None:
            task_service.submit_sync(t)
        else:
            task_service.submit_schedule(t, execution_time)
        logger.debug("Clear Annotation Task Submitted")
        return t.task_id
示例#16
0
    def server_action(self, auth, node_id, action, dateval=None, timeval=None):
        task_service = self.svc_central.get_service(self.task_service_id)
        user_name = self._get_username(auth)
        t = ServerActionTask(action, {}, [], \
                             dict(node_id=node_id,action=action),\
                             None, user_name)
        t.set_entity_details(node_id)

        execution_time = getDateTime(dateval, timeval)
        print execution_time
        if execution_time is None:
            task_service.submit_sync(t)
        else:
            task_service.submit_schedule(t, execution_time)
        logger.debug("Server Action Task Submitted")
示例#17
0
    def import_appliance(self, auth, appliance_entry, image_store, \
                         group_id, image_name, platform, force,dateval=None,timeval=None):
        task_service = self.svc_central.get_service(self.task_service_id)
        user_name = self._get_username(auth)
        t= ImportApplianceTask(u'Import Appliance', {}, [],\
                               dict(appliance_entry=appliance_entry, \
                                    image_store=image_store, group_id=group_id,\
                                    image_name=image_name,platform=platform,\
                                    force=force),  None, user_name)
        t.set_entity_details(group_id)

        execution_time = getDateTime(dateval, timeval)
        if execution_time is None:
            task_service.submit_sync(t)
        else:
            task_service.submit_schedule(t, execution_time)
        logger.debug("Import appliance task submitted")
示例#18
0
    def import_appliance(self, auth, appliance_entry, image_store, \
                         group_id, image_name, platform, force,dateval=None,timeval=None):
        task_service = self.svc_central.get_service(self.task_service_id)
        user_name = self._get_username(auth)
        t= ImportApplianceTask(u'Import Appliance', {}, [],\
                               dict(appliance_entry=appliance_entry, \
                                    image_store=image_store, group_id=group_id,\
                                    image_name=image_name,platform=platform,\
                                    force=force),  None, user_name)
        t.set_entity_details(group_id)

        execution_time=getDateTime(dateval,timeval)
        if execution_time is None:
            task_service.submit_sync(t)
        else:
            task_service.submit_schedule(t, execution_time)
        logger.debug("Import appliance task submitted")
示例#19
0
    def remove_node(self, auth, node_id, node_name, grp_id, grp_name, force, \
                                                dateval=None, timeval=None):
        task_service = self.svc_central.get_service(self.task_service_id)
        user_name = self._get_username(auth)
        t = RemoveServerTask(u"Remove "+node_name, {}, [], \
                             dict(node_id=node_id,node_name=node_name,\
                             grp_id=grp_id,grp_name=grp_name,force=force),\
                             None, user_name)
        t.set_entity_details(node_id)
        #t.cancellable = True

        execution_time = getDateTime(dateval, timeval)
        if execution_time is None:
            task_service.submit_sync(t)
        else:
            task_service.submit_schedule(t, execution_time)
        logger.debug("Remove Server Task Submitted")
        return t.task_id
示例#20
0
    def remove_node(self, auth, node_id, node_name, grp_id, grp_name, force, \
                                                dateval=None, timeval=None):
        task_service = self.svc_central.get_service(self.task_service_id)
        user_name = self._get_username(auth)
        t = RemoveServerTask(u"Remove "+node_name, {}, [], \
                             dict(node_id=node_id,node_name=node_name,\
                             grp_id=grp_id,grp_name=grp_name,force=force),\
                             None, user_name)
        t.set_entity_details(node_id)
        #t.cancellable = True

        execution_time=getDateTime(dateval,timeval)
        if execution_time is None:
            task_service.submit_sync(t)
        else:
            task_service.submit_schedule(t, execution_time)
        logger.debug("Remove Server Task Submitted")
        return t.task_id
示例#21
0
 def import_vm_action(self,
                      auth,
                      node_id,
                      directory,
                      filenames,
                      dateval=None,
                      timeval=None):
     task_service = self.svc_central.get_service(self.task_service_id)
     user_name = self._get_username(auth)
     t = VMImportTask("Import VM", {}, [], \
                          dict(node_id=node_id,directory=directory,filenames=filenames),\
                          None, user_name)
     t.set_entity_details(node_id)
     execution_time = getDateTime(dateval, timeval)
     if execution_time is None:
         task_service.submit_sync(t)
     else:
         task_service.submit_schedule(t, execution_time)
     logger.debug("Import VM Task Submitted")
     return t.task_id
示例#22
0
    def save_vm(self,
                auth,
                dom_id,
                node_id,
                file,
                directory,
                dateval=None,
                timeval=None):
        task_service = self.svc_central.get_service(self.task_service_id)
        user_name = self._get_username(auth)
        t= VMSnapshotTask(u'Hibernate', {}, [],\
                          dict(dom_id=dom_id, node_id=node_id, file=file,\
                               directory=directory), None, user_name)
        t.set_entity_details(dom_id)

        execution_time = getDateTime(dateval, timeval)
        if execution_time is None:
            task_service.submit_sync(t)
        else:
            task_service.submit_schedule(t, execution_time)
        logger.debug("Snapshot Task Submitted")
示例#23
0
 def config_settings(self, auth, image_id, config, mode,\
                     node_id, group_id, dom_id, vm_name,dateval=None,timeval=None):
     task_service = self.svc_central.get_service(self.task_service_id)
     user_name = self._get_username(auth)
     t= VMConfigSettingsTask(u'Provision VM', {}, [],\
                  dict(image_id=image_id, config=config, mode=mode,\
                       node_id=node_id, group_id=group_id, dom_id=dom_id,\
                       vm_name=vm_name), None, user_name)
     if mode == 'PROVISION_VM':
         t.set_entity_details(node_id)
     elif mode == 'EDIT_VM_INFO':
          manager=Basic.getGridManager()
          managed_node =manager.getNode(auth,node_id)
          if managed_node is not None:
              dom=managed_node.get_dom(dom_id)
              t.set_entity_details(dom.id)
         
     execution_time=getDateTime(dateval,timeval)
     if execution_time is None:
         task_service.submit_sync(t)
     else:
         task_service.submit_schedule(t, execution_time)
     logger.debug("Configuration Task Submitted")
示例#24
0
    def config_settings(self, auth, image_id, config, mode,\
                        node_id, group_id, dom_id, vm_name,dateval=None,timeval=None):
        task_service = self.svc_central.get_service(self.task_service_id)
        user_name = self._get_username(auth)
        t= VMConfigSettingsTask(u'Provision VM', {}, [],\
                     dict(image_id=image_id, config=config, mode=mode,\
                          node_id=node_id, group_id=group_id, dom_id=dom_id,\
                          vm_name=vm_name), None, user_name)
        if mode == 'PROVISION_VM':
            t.set_entity_details(node_id)
        elif mode == 'EDIT_VM_INFO':
            manager = Basic.getGridManager()
            managed_node = manager.getNode(auth, node_id)
            if managed_node is not None:
                dom = managed_node.get_dom(dom_id)
                t.set_entity_details(dom.id)

        execution_time = getDateTime(dateval, timeval)
        if execution_time is None:
            task_service.submit_sync(t)
        else:
            task_service.submit_schedule(t, execution_time)
        logger.debug("Configuration Task Submitted")