예제 #1
0
    def apply_options(self):
        """Set the options"""

        Application.apply_options(self)

        # sanity check
        for entry in self.args.xpl_files:
            if not os.path.isfile(entry):
                error("%s not found." %entry)
                exit(1)
예제 #2
0
    def apply_options(self):
        """Configure object based on the options form the argparser"""

        Application.apply_options(self)

        if not os.path.exists(self.args.indir):
            error("%s does not exist, stop." %self.args.indir)
            sys.exit(1)

        if not os.path.exists(self.args.outdir):
            info("%s does not exist, creating. " % self.args.outdir)
            os.mkdir(self.args.outdir)
예제 #3
0
    def apply_options(self):
        """Configure object based on the options form the argparser"""

        Application.apply_options(self)

        if not os.path.exists(self.args.indir):
            error("%s does not exist, stop." %self.args.indir)
            sys.exit(1)

        if not os.path.exists(self.args.outdir):
            info("%s does not exist, creating." %self.args.outdir)
            os.mkdir(self.args.outdir)
예제 #4
0
    def apply_options(self):
        """Configure XEN object based on the options form the argparser.
        On the given options perform some sanity checks
        """

        # for all commands
        Application.apply_options(self)

        # for all commands except "list"
        if not self.args.action == "list":
            # VM IDs are never negative
            for vm_id in self.args.vm_ids:
                if vm_id < 2:
                    error(
                        "A domU ID must be greater than zero and greater than 1 because 1 is reserved for the host becaus of an ip-matter"
                    )
                    sys.exit(1)

            # if desired build a range of domU IDs
            if self.args.range:
                # can only generate a range if exact two IDs are given
                if not len(self.args.vm_ids) == 2:
                    error("Can only generate an 'ID range' if exact two domU "\
                            "IDs are given")
                    sys.exit(1)
                else:
                    self.__vm_ids = range(self.args.vm_ids[0],
                                          self.args.vm_ids[1] + 1)
            # for convinced copy domU IDs
            else:
                self.__vm_ids = self.args.vm_ids

        # for command "create" only
        if self.args.action == "create":
            # cannot attach console if we start multiple VMs
            if self.args.console and len(self.args.vm_ids) > 1:
                warn("Starting more than VMs with attached console is almost "\
                        "certainly not what you want. Console option is "\
                        "deactivated")
                self.args.console = False

        # for command "list" only
        if self.args.action == "list":
            # default values are strings, a command line option given by the
            # user is a list. In oder to access the argument always in the same
            # way, we convert the string into a list
            if type(self.args.vm_host) == str:
                self.args.vm_host = str(self.args.vm_host).split()
예제 #5
0
    def apply_options(self):
        """Configure XEN object based on the options form the argparser.
        On the given options perform some sanity checks
        """

        # for all commands
        Application.apply_options(self)

        # for all commands except "list"
        if not self.args.action == "list":
            # VM IDs are never negative
            for vm_id in self.args.vm_ids:
                if vm_id < 2:
                    error("A domU ID must be greater than zero and greater than 1 because 1 is reserved for the host becaus of an ip-matter")
                    sys.exit(1)

            # if desired build a range of domU IDs
            if self.args.range:
                # can only generate a range if exact two IDs are given
                if not len(self.args.vm_ids) == 2:
                    error("Can only generate an 'ID range' if exact two domU "\
                            "IDs are given")
                    sys.exit(1)
                else:
                    self.__vm_ids = range(self.args.vm_ids[0],
                            self.args.vm_ids[1] + 1)
            # for convinced copy domU IDs
            else:
                self.__vm_ids = self.args.vm_ids

        # for command "create" only
        if self.args.action == "create":
            # cannot attach console if we start multiple VMs
            if self.args.console and len(self.args.vm_ids) > 1:
                warn("Starting more than VMs with attached console is almost "\
                        "certainly not what you want. Console option is "\
                        "deactivated")
                self.args.console = False

        # for command "list" only
        if self.args.action == "list":
            # default values are strings, a command line option given by the
            # user is a list. In oder to access the argument always in the same
            # way, we convert the string into a list
            if type(self.args.vm_host) == str:
                self.args.vm_host = str(self.args.vm_host).split()
예제 #6
0
    def apply_options(self):
        """Configure object based on the options form the argparser.
        On the given options perform some sanity checks
        """

        Application.apply_options(self)

        if not os.path.exists(self.args.outdir):
            info("%s does not exist, creating. " % self.args.outdir)
            os.mkdir(self.args.outdir)

        # create an array with the graphics we want produce
        if "all" not in self.args.graphic:
            self.graphics_array = self.args.graphic

        # default values are string or int, a command line option given by the
        # user is a list. In oder to access the argument always in the same
        # way, we convert the string/int into a list
        if type(self.args.flownumber) == int:
            self.args.flownumber = [self.args.flownumber]
예제 #7
0
    def apply_options(self):
        """Configure object based on the options form the argparser.
        On the given options perform some sanity checks
        """

        Application.apply_options(self)

        if not os.path.exists(self.args.outdir):
            info("%s does not exist, creating. " % self.args.outdir)
            os.mkdir(self.args.outdir)

        # create an array with the graphics we want produce
        if "all" not in self.args.graphic:
            self.graphics_array = self.args.graphic

        # default values are string or int, a command line option given by the
        # user is a list. In oder to access the argument always in the same
        # way, we convert the string/int into a list
        if type(self.args.flownumber) == int:
            self.args.flownumber = [self.args.flownumber]
예제 #8
0
파일: vmnet.py 프로젝트: Puneeth-n/tcp-eval
    def apply_options(self):
        """Set the options for the BuildVmesh object"""

        Application.apply_options(self)

        self.conf = self.parse_config(self.args.config_file)
예제 #9
0
    def apply_options(self):
        """Configure XplotCut object based on the options form the argparser"""

        Application.apply_options(self)
예제 #10
0
    def apply_options(self):
        """Configure XplotCut object based on the options form the argparser"""

        Application.apply_options(self)
예제 #11
0
    def apply_options(self):
        """Set the options for the BuildVmesh object"""

        Application.apply_options(self)

        self.conf = self.parse_config(self.args.config_file)