def list_vms(self, allow_clone=False):
        """
        Gets VirtualBox VM list.
        """

        vbox_vms = []
        result = yield from self.execute("list", ["vms"])
        for line in result:
            if len(line) == 0 or line[0] != '"' or line[-1:] != "}":
                continue  # Broken output (perhaps a carriage return in VM name)
            vmname, _ = line.rsplit(' ', 1)
            vmname = vmname.strip('"')
            if vmname == "<inaccessible>":
                continue  # ignore inaccessible VMs
            extra_data = yield from self.execute("getextradata", [vmname, "GNS3/Clone"])
            if allow_clone or len(extra_data) == 0 or not extra_data[0].strip() == "Value: yes":
                # get the amount of RAM
                info_results = yield from self.execute("showvminfo", [vmname, "--machinereadable"])
                ram = 0
                for info in info_results:
                    try:
                        name, value = info.split('=', 1)
                        if name.strip() == "memory":
                            ram = int(value.strip())
                            break
                    except ValueError:
                        continue
                vbox_vms.append({"vmname": vmname, "ram": ram})
        return vbox_vms
def list_vms ( self , allow_clone = False ) : vbox_vms = [ ] result = yield from self . execute ( "list" , [ "vms" ] ) for line in result : if len ( line ) == 0 or line [ 0 ] != '"' or line [ - 1 : ] != "}" : continue vmname , _ = line . rsplit ( ' ' , 1 ) vmname = vmname . strip ( '"' ) if vmname == "<inaccessible>" : continue extra_data = yield from self . execute ( "getextradata" , [ vmname , "GNS3/Clone" ] ) if allow_clone or len ( extra_data ) == 0 or not extra_data [ 0 ] . strip ( ) == "Value: yes" : info_results = yield from self . execute ( "showvminfo" , [ vmname , "--machinereadable" ] ) ram = 0 for info in info_results : try : name , value = info . split ( '=' , 1 ) if name . strip ( ) == "memory" : ram = int ( value . strip ( ) ) break except ValueError : continue vbox_vms . append ( { "vmname" : vmname , "ram" : ram } ) return vbox_vms
Gets VirtualBox VM list.