def _add_io(instance_offering_xml_obj, session_uuid):
     action = api_actions.CreateInstanceOfferingAction()
     action.sessionUuid = session_uuid
     action.name = instance_offering_xml_obj.name_
     action.description = instance_offering_xml_obj.description__
     action.cpuNum = instance_offering_xml_obj.cpuNum_
     action.cpuSpeed = instance_offering_xml_obj.cpuSpeed_
     action.memorySize = sizeunit.get_size(instance_offering_xml_obj.memorySize_)
     if instance_offering_xml_obj.uuid__:
         action.resourceUuid = instance_offering_xml_obj.uuid__
     evt = action.run()
     deploy_logger(jsonobject.dumps(evt))
示例#2
0
def create_instance_offering(instance_offering_option, session_uuid = None):
    action = api_actions.CreateInstanceOfferingAction()
    action.cpuNum = instance_offering_option.get_cpuNum()
    action.cpuSpeed = instance_offering_option.get_cpuSpeed()
    action.memorySize = instance_offering_option.get_memorySize()
    action.allocatorStrategy = instance_offering_option.get_allocatorStrategy()
    action.type = instance_offering_option.get_type()
    action.name = instance_offering_option.get_name()
    action.description = instance_offering_option.get_description()

    test_util.action_logger('create instance offering: name: %s cpuNum: %s, cpuSpeed: %s, memorySize: %s, allocatorStrategy: %s, type: %s '\
            % (action.name, action.cpuNum, action.cpuSpeed, action.memorySize, action.allocatorStrategy, action.type))
    evt = account_operations.execute_action_with_session(action, session_uuid)
    test_util.test_logger('Instance Offering: %s is created' % evt.inventory.uuid)
    return evt.inventory
示例#3
0
    def _add_io(instance_offering_xml_obj, session_uuid):
        action = api_actions.CreateInstanceOfferingAction()
        action.sessionUuid = session_uuid
        action.name = instance_offering_xml_obj.name_
        action.description = instance_offering_xml_obj.description__
        action.cpuNum = instance_offering_xml_obj.cpuNum_
        action.cpuSpeed = instance_offering_xml_obj.cpuSpeed_
        if instance_offering_xml_obj.memorySize__:
            action.memorySize = sizeunit.get_size(instance_offering_xml_obj.memorySize_)
        elif instance_offering_xml_obj.memoryCapacity_:
            action.memorySize = sizeunit.get_size(instance_offering_xml_obj.memoryCapacity_)

        try:
            evt = action.run()
            test_util.test_logger(jsonobject.dumps(evt))
        except:
            exc_info.append(sys.exc_info())