示例#1
0
 def get_uuid_be_dic():
     """Return a dictionary of all boot environment names on the
             system, keyed by uuid"""
     beList = BootEnv.get_be_list()
     uuid_bes = {}
     for be in beList:
         uuid_bes[be.get("uuid_str")] = be.get("orig_be_name")
     return uuid_bes
示例#2
0
文件: bootenv.py 项目: aszeszo/test
 def get_uuid_be_dic():
         """Return a dictionary of all boot environment names on the
         system, keyed by uuid"""
         beList = BootEnv.get_be_list()
         uuid_bes = {}
         for be in beList:
                 uuid_bes[be.get("uuid_str")] = be.get("orig_be_name")
         return uuid_bes
示例#3
0
    def get_active_be_name():
        try:
            beList = BootEnv.get_be_list()

            for be in beList:
                if be.get("active"):
                    return be.get("orig_be_name")
        except AttributeError:
            raise api_errors.BENamingNotSupported(be_name)
示例#4
0
文件: bootenv.py 项目: aszeszo/test
        def get_active_be_name():
                try:
                        beList = BootEnv.get_be_list()

                        for be in beList:
                                if be.get("active"):
                                        return be.get("orig_be_name")
                except AttributeError:
                        raise api_errors.BENamingNotSupported(be_name)
示例#5
0
    def get_activated_be_name():
        try:
            beList = BootEnv.get_be_list()

            for be in beList:
                # don't look at active but unbootable BEs.
                # (happens in zones when we have ZBEs
                # associated with other global zone BEs.)
                if be.get("active_unbootable", False):
                    continue
                if be.get("active_boot") and be.get("global_active", True):
                    return be.get("orig_be_name")
        except AttributeError:
            raise api_errors.BENamingNotSupported(be_name)
示例#6
0
文件: bootenv.py 项目: aszeszo/test
        def get_activated_be_name():
                try:
                        beList = BootEnv.get_be_list()

                        for be in beList:
                                # don't look at active but unbootable BEs.
                                # (happens in zones when we have ZBEs
                                # associated with other global zone BEs.)
                                if be.get("active_unbootable", False):
                                        continue
                                if be.get("active_boot"):
                                        return be.get("orig_be_name")
                except AttributeError:
                        raise api_errors.BENamingNotSupported(be_name)
示例#7
0
    def get_be_name(path):
        """Looks for the name of the boot environment corresponding to
                an image root, returning name and uuid """
        beList = BootEnv.get_be_list()

        for be in beList:
            be_name = be.get("orig_be_name")
            be_uuid = be.get("uuid_str")

            if not be_name or not be.get("mounted"):
                continue

            # Check if we're operating on the live BE.
            # If so it must also be active. If we are not
            # operating on the live BE, then verify
            # that the mountpoint of the BE matches
            # the path argument passed in by the user.
            if path == '/':
                if be.get("active"):
                    return be_name, be_uuid
            else:
                if be.get("mountpoint") == path:
                    return be_name, be_uuid
        return None, None
示例#8
0
文件: bootenv.py 项目: aszeszo/test
        def get_be_name(path):
                """Looks for the name of the boot environment corresponding to
                an image root, returning name and uuid """
                beList = BootEnv.get_be_list()

                for be in beList:
                        be_name = be.get("orig_be_name")
                        be_uuid = be.get("uuid_str")

                        if not be_name or not be.get("mounted"):
                                continue

                        # Check if we're operating on the live BE.
                        # If so it must also be active. If we are not
                        # operating on the live BE, then verify
                        # that the mountpoint of the BE matches
                        # the path argument passed in by the user.
                        if path == '/':
                                if be.get("active"):
                                        return be_name, be_uuid
                        else:
                                if be.get("mountpoint") == path:
                                        return be_name, be_uuid
                return None, None
示例#9
0
    def check_be_name(be_name):
        try:
            if be_name is None:
                return

            if be.beVerifyBEName(be_name) != 0:
                raise api_errors.InvalidBENameException(be_name)

            beList = BootEnv.get_be_list()

            # If there is already a BE with the same name as
            # be_name, then raise an exception.
            if be_name in (be.get("orig_be_name") for be in beList):
                raise api_errors.DuplicateBEName(be_name)
        except AttributeError:
            raise api_errors.BENamingNotSupported(be_name)
示例#10
0
文件: bootenv.py 项目: aszeszo/test
        def check_be_name(be_name):
                try:
                        if be_name is None:
                                return

                        if be.beVerifyBEName(be_name) != 0:
                                raise api_errors.InvalidBENameException(be_name)

                        beList = BootEnv.get_be_list()

                        # If there is already a BE with the same name as
                        # be_name, then raise an exception.
                        if be_name in (be.get("orig_be_name") for be in beList):
                                raise api_errors.DuplicateBEName(be_name)
                except AttributeError:
                        raise api_errors.BENamingNotSupported(be_name)
示例#11
0
    def check_be_name(be_name):
        try:
            if be_name is None:
                return

            if be.beVerifyBEName(be_name) != 0:
                raise api_errors.InvalidBENameException(be_name)

            # Check for the old beList() API since pkg(1) can be
            # back published and live on a system without the
            # latest libbe.
            beVals = be.beList()
            if isinstance(beVals[0], int):
                rc, beList = beVals
            else:
                beList = beVals

            # If there is already a BE with the same name as
            # be_name, then raise an exception.
            if be_name in (be.get("orig_be_name") for be in beList):
                raise api_errors.DuplicateBEName(be_name)
        except AttributeError:
            raise api_errors.BENamingNotSupported(be_name)
示例#12
0
        def check_be_name(be_name):
                try:
                        if be_name is None:
                                return

                        if be.beVerifyBEName(be_name) != 0:
                                raise api_errors.InvalidBENameException(be_name)

                        # Check for the old beList() API since pkg(1) can be
                        # back published and live on a system without the 
                        # latest libbe.
                        beVals = be.beList()
                        if isinstance(beVals[0], int):
                                rc, beList = beVals
                        else:
                                beList = beVals

                        # If there is already a BE with the same name as
                        # be_name, then raise an exception.
                        if be_name in (be.get("orig_be_name") for be in beList):
                                raise api_errors.DuplicateBEName(be_name)
                except AttributeError:
                        raise api_errors.BENamingNotSupported(be_name)