예제 #1
0
 def test_update_available_cached(self):
     # If we try to check twice on the same mediator object, the second one
     # will return the cached update.
     self._setup_server_keyrings()
     mediator = Mediator()
     update_1 = mediator.check_for_update()
     self.assertTrue(update_1.is_available)
     update_2 = mediator.check_for_update()
     self.assertTrue(update_2.is_available)
     self.assertIs(update_1, update_2)
예제 #2
0
 def __init__(self, bus, object_path, loop):
     super().__init__(bus, object_path)
     self.loop = loop
     self._api = Mediator(self._progress_callback)
     log.info('Mediator created {}', self._api)
     self._checking = Lock()
     self._downloading = Lock()
     self._update = None
     self._paused = False
     self._applicable = False
     self._failure_count = 0
     self._last_error = ''
예제 #3
0
 def test_factory_reset(self):
     mediator = Mediator()
     with patch('systemimage.apply.Reboot.apply') as mock:
         mediator.factory_reset()
     self.assertTrue(mock.called)
     path = Path(config.updater.cache_partition) / 'ubuntu_command'
     with path.open('r', encoding='utf-8') as fp:
         command = fp.read()
     self.assertMultiLineEqual(
         command, dedent("""\
         format data
         """))
예제 #4
0
class _LiveTestableService(Service):
    """For testing purposes only."""
    def __init__(self, bus, object_path, loop):
        super().__init__(bus, object_path, loop)
        self._debug_handler = None

    @log_and_exit
    @method('com.canonical.SystemImage')
    def Reset(self):
        config.reload()
        self._api = Mediator()
        try:
            self._checking.release()
        except RuntimeError:
            # Lock is already released.
            pass
        self._update = None
        self._rebootable = False
        self._failure_count = 0
        del config.build_number
        safe_remove(config.system.settings_db)

    @log_and_exit
    @method('com.canonical.SystemImage')
    def TearDown(self):
        # Like CancelUpdate() except it sends a different signal that's only
        # useful for the test suite.
        self._api.cancel()
        self.TornDown()

    @log_and_exit
    @signal('com.canonical.SystemImage')
    def TornDown(self):
        pass

    @log_and_exit
    @method('com.canonical.SystemImage', in_signature='ss', out_signature='ss')
    def DebugDBusTo(self, filename, level_name):
        # Get the existing logging level and logging file name.
        dbus_log = logging.getLogger('systemimage.dbus')
        old_level = logging.getLevelName(dbus_log.getEffectiveLevel())
        old_filename = config.system.logfile
        # Remove any previous D-Bus debugging handler.
        if self._debug_handler is not None:
            dbus_log.removeHandler(self._debug_handler)
            self._debug_handler = None
        new_level = getattr(logging, level_name.upper())
        dbus_log.setLevel(new_level)
        if filename != '':
            self._debug_handler = make_handler(Path(filename))
            self._debug_handler.setLevel(new_level)
            dbus_log.addHandler(self._debug_handler)
        return old_filename, old_level
예제 #5
0
 def Reset(self):
     config.reload()
     self._api = Mediator()
     try:
         self._checking.release()
     except RuntimeError:
         # Lock is already released.
         pass
     self._update = None
     self._rebootable = False
     self._failure_count = 0
     del config.build_number
     safe_remove(config.system.settings_db)
예제 #6
0
    def test_download(self):
        # After checking that an update is available, complete the update, but
        # don't reboot.
        self._setup_server_keyrings()
        mediator = Mediator()
        self.assertTrue(mediator.check_for_update())
        # Make sure a reboot did not get issued.
        with patch('systemimage.apply.Reboot.apply') as mock:
            mediator.download()
        # The update was not applied.
        self.assertFalse(mock.called)
        # But the command file did get written, and all the files are present.
        path = Path(config.updater.cache_partition) / 'ubuntu_command'
        with path.open('r', encoding='utf-8') as fp:
            command = fp.read()
        self.assertMultiLineEqual(
            command, """\
load_keyring image-master.tar.xz image-master.tar.xz.asc
load_keyring image-signing.tar.xz image-signing.tar.xz.asc
load_keyring device-signing.tar.xz device-signing.tar.xz.asc
format system
mount system
update 6.txt 6.txt.asc
update 7.txt 7.txt.asc
update 5.txt 5.txt.asc
unmount system
""")
        self.assertEqual(
            set(os.listdir(config.updater.cache_partition)),
            set([
                '5.txt',
                '5.txt.asc',
                '6.txt',
                '6.txt.asc',
                '7.txt',
                '7.txt.asc',
                'device-signing.tar.xz',
                'device-signing.tar.xz.asc',
                'image-master.tar.xz',
                'image-master.tar.xz.asc',
                'image-signing.tar.xz',
                'image-signing.tar.xz.asc',
                'ubuntu_command',
            ]))
        # And the blacklist keyring is available too.
        self.assertEqual(set(os.listdir(config.updater.data_partition)),
                         set([
                             'blacklist.tar.xz',
                             'blacklist.tar.xz.asc',
                         ]))
예제 #7
0
 def test_get_channels_nexus4(self):
     DEVICE = 'nexus4'
     self._setup_server_keyrings()
     mediator = Mediator()
     mediator.check_for_update()
     channels = mediator.get_channels()
     self.assertEqual(channels, [
         {
             'alias': None,
             'hidden': False,
             'name': 'daily',
             'redirect': None
         },
     ])
예제 #8
0
 def test_no_update_available_version(self):
     # No update is available, so the target version number is zero.
     self._setup_server_keyrings()
     touch_build(1600)
     update = Mediator().check_for_update()
     self.assertFalse(update.is_available)
     self.assertEqual(update.version, '')
예제 #9
0
 def test_no_update_available_newer(self):
     # Because our build number is higher than the latest available in the
     # index file, there is no update available.
     self._setup_server_keyrings()
     touch_build(1700)
     update = Mediator().check_for_update()
     self.assertFalse(update.is_available)
예제 #10
0
 def test_state_machine_exceptions(self, config):
     # An exception in the state machine captures the exception and returns
     # an error string in the Update instance.
     self._setup_server_keyrings()
     with chmod(config.updater.cache_partition, 0):
         update = Mediator().check_for_update()
     # There's no winning path, but there is an error.
     self.assertFalse(update.is_available)
     self.assertIn('Permission denied', update.error)
예제 #11
0
 def test_apply(self):
     # Run the intermediate steps, applying the update at the end.
     self._setup_server_keyrings()
     mediator = Mediator()
     # Mock to check the state of reboot.
     with patch('systemimage.apply.Reboot.apply') as mock:
         mediator.check_for_update()
         mediator.download()
         self.assertFalse(mock.called)
         mediator.apply()
         self.assertTrue(mock.called)
예제 #12
0
 def test_cancel(self):
     # When we get to the step of downloading the files, cancel it.
     self._setup_server_keyrings()
     mediator = Mediator()
     mediator.check_for_update()
     mediator.cancel()
     self.assertRaises(Canceled, mediator.download)
예제 #13
0
    def CheckForUpdate(self):
        """Find out whether an update is available.

        This method is used to explicitly check whether an update is
        available, by communicating with the server and calculating an
        upgrade path from the current build number to a later build
        available on the server.

        This method runs asynchronously and thus does not return a result.
        Instead, an `UpdateAvailableStatus` signal is triggered when the check
        completes.  The argument to that signal is a boolean indicating
        whether the update is available or not.
        """
        self.loop.keepalive()
        # Check-and-acquire the lock.
        log.info('CheckForUpdate(): checking lock test and acquire')
        if not self._checking.acquire(blocking=False):
            log.info('CheckForUpdate(): checking lock not acquired')
            # Check is already in progress, so there's nothing more to do.  If
            # there's status available (i.e. we are in the auto-downloading
            # phase of the last CFU), then send the status.
            if self._update is not None:
                self.UpdateAvailableStatus(self._update.is_available,
                                           self._downloading.locked(),
                                           self._update.version,
                                           self._update.size,
                                           last_update_date(), "")
            return
        log.info('CheckForUpdate(): checking lock acquired')
        # We've now acquired the lock.  Reset any failure or in-progress
        # state.  Get a new mediator to reset any of its state.
        self._api = Mediator(self._progress_callback)
        log.info('Mediator recreated {}', self._api)
        self._failure_count = 0
        self._last_error = ''
        # Arrange for the actual check to happen in a little while, so that
        # this method can return immediately.
        GLib.timeout_add(50, self._check_for_update)
예제 #14
0
 def test_get_details(self):
     # Get the details of an available update.
     self._setup_server_keyrings()
     # Index 14 has a more interesting upgrade path, and will yield a
     # richer description set.
     index_dir = Path(self._serverdir) / self.CHANNEL / self.DEVICE
     index_path = index_dir / 'index.json'
     copy('api.index_02.json', index_dir, 'index.json')
     sign(index_path, 'device-signing.gpg')
     setup_index('api.index_02.json', self._serverdir, 'device-signing.gpg')
     # Get the descriptions.
     update = Mediator().check_for_update()
     self.assertTrue(update.is_available)
     self.assertEqual(update.size, 180009)
     self.assertEqual(len(update.descriptions), 3)
     # The first contains the descriptions for the full update.
     self.assertEqual(update.descriptions[0], {
         'description': 'Full B',
         'description-en': 'The full B',
     })
     # The first delta.
     self.assertEqual(
         update.descriptions[1], {
             'description': 'Delta B.1',
             'description-en_US': 'This is the delta B.1',
             'description-xx': 'XX This is the delta B.1',
             'description-yy': 'YY This is the delta B.1',
             'description-yy_ZZ': 'YY-ZZ This is the delta B.1',
         })
     # The second delta.
     self.assertEqual(
         update.descriptions[2], {
             'description': 'Delta B.2',
             'description-xx': 'Oh delta, my delta',
             'description-xx_CC': 'This hyar is the delta B.2',
         })
예제 #15
0
    def test_callback(self):
        # When downloading, we get callbacks.
        self._setup_server_keyrings()
        received_bytes = 0
        total_bytes = 0

        def callback(received, total):
            nonlocal received_bytes, total_bytes
            received_bytes = received
            total_bytes = total

        mediator = Mediator(callback)
        mediator.check_for_update()
        # Checking for updates does not trigger the callback.
        self.assertEqual(received_bytes, 0)
        self.assertEqual(total_bytes, 0)
        mediator.download()
        # We don't know exactly how many bytes got downloaded, but we know
        # some did.
        self.assertNotEqual(received_bytes, 0)
        self.assertNotEqual(total_bytes, 0)
예제 #16
0
class Service(Object):
    """Main dbus service."""
    def __init__(self, bus, object_path, loop):
        super().__init__(bus, object_path)
        self.loop = loop
        self._api = Mediator(self._progress_callback)
        log.info('Mediator created {}', self._api)
        self._checking = Lock()
        self._downloading = Lock()
        self._update = None
        self._paused = False
        self._applicable = False
        self._failure_count = 0
        self._last_error = ''

    @log_and_exit
    def _check_for_update(self):
        # Asynchronous method call.
        log.info('Enter _check_for_update()')
        self._update = self._api.check_for_update()
        log.info('_check_for_update(): checking lock releasing')
        try:
            self._checking.release()
        except RuntimeError:  # pragma: no udm
            log.info('_check_for_update(): checking lock already released')
        else:
            log.info('_check_for_update(): checking lock released')
        # Do we have an update and can we auto-download it?
        delayed_download = False
        if self._update.is_available:
            settings = Settings()
            auto = settings.get('auto_download')
            log.info('Update available; auto-download: {}', auto)
            if auto in ('1', '2'):
                # XXX When we have access to the download service, we can
                # check if we're on the wifi (auto == '1').
                delayed_download = True
                GLib.timeout_add(50, self._download)
        # We have a timing issue.  We can't lock the downloading lock here,
        # otherwise when _download() starts running in ~50ms it will think a
        # download is already in progress.  But we want to send the UAS signal
        # here and now, *and* indicate whether the download is about to happen.
        # So just lie for now since in ~50ms the download will begin.
        self.UpdateAvailableStatus(self._update.is_available, delayed_download,
                                   self._update.version, self._update.size,
                                   last_update_date(), self._update.error)
        # Stop GLib from calling this method again.
        return False

    # 2013-07-25 BAW: should we use the rather underdocumented async_callbacks
    # argument to @method?
    @log_and_exit
    @method('com.canonical.SystemImage')
    def CheckForUpdate(self):
        """Find out whether an update is available.

        This method is used to explicitly check whether an update is
        available, by communicating with the server and calculating an
        upgrade path from the current build number to a later build
        available on the server.

        This method runs asynchronously and thus does not return a result.
        Instead, an `UpdateAvailableStatus` signal is triggered when the check
        completes.  The argument to that signal is a boolean indicating
        whether the update is available or not.
        """
        self.loop.keepalive()
        # Check-and-acquire the lock.
        log.info('CheckForUpdate(): checking lock test and acquire')
        if not self._checking.acquire(blocking=False):
            log.info('CheckForUpdate(): checking lock not acquired')
            # Check is already in progress, so there's nothing more to do.  If
            # there's status available (i.e. we are in the auto-downloading
            # phase of the last CFU), then send the status.
            if self._update is not None:
                self.UpdateAvailableStatus(self._update.is_available,
                                           self._downloading.locked(),
                                           self._update.version,
                                           self._update.size,
                                           last_update_date(), "")
            return
        log.info('CheckForUpdate(): checking lock acquired')
        # We've now acquired the lock.  Reset any failure or in-progress
        # state.  Get a new mediator to reset any of its state.
        self._api = Mediator(self._progress_callback)
        log.info('Mediator recreated {}', self._api)
        self._failure_count = 0
        self._last_error = ''
        # Arrange for the actual check to happen in a little while, so that
        # this method can return immediately.
        GLib.timeout_add(50, self._check_for_update)

    #@log_and_exit
    def _progress_callback(self, received, total):
        # Plumb the progress through our own D-Bus API.  Our API is defined as
        # signalling a percentage and an eta.  We can calculate the percentage
        # easily, but the eta is harder.  For now, we just send 0 as the eta.
        percentage = received * 100 // total
        eta = 0
        self.UpdateProgress(percentage, eta)

    @log_and_exit
    def _download(self):
        if self._downloading.locked() and self._paused:
            self._api.resume()
            self._paused = False
            log.info('Download previously paused')
            return
        if (self._downloading.locked()  # Already in progress.
                or self._update is None  # Not yet checked.
                or not self._update.is_available  # No update available.
            ):
            log.info('Download already in progress or not available')
            return
        if self._failure_count > 0:
            self._failure_count += 1
            self.UpdateFailed(self._failure_count, self._last_error)
            log.info('Update failures: {}; last error: {}',
                     self._failure_count, self._last_error)
            return
        log.info('_download(): downloading lock entering critical section')
        with self._downloading:
            log.info('Update is downloading')
            try:
                # Always start by sending a UpdateProgress(0, 0).  This is
                # enough to get the u/i's attention.
                self.UpdateProgress(0, 0)
                self._api.download()
            except Exception:
                log.exception('Download failed')
                self._failure_count += 1
                # Set the last error string to the exception's class name.
                exception, value = sys.exc_info()[:2]
                # if there's no meaningful value, omit it.
                value_str = str(value)
                name = exception.__name__
                self._last_error = ('{}'.format(name) if len(value_str) == 0
                                    else '{}: {}'.format(name, value))
                self.UpdateFailed(self._failure_count, self._last_error)
            else:
                log.info('Update downloaded')
                self.UpdateDownloaded()
                self._failure_count = 0
                self._last_error = ''
                self._applicable = True
        log.info('_download(): downloading lock finished critical section')
        # Stop GLib from calling this method again.
        return False

    @log_and_exit
    @method('com.canonical.SystemImage')
    def DownloadUpdate(self):
        """Download the available update.

        The download may be canceled during this time.
        """
        # Arrange for the update to happen in a little while, so that this
        # method can return immediately.
        self.loop.keepalive()
        GLib.timeout_add(50, self._download)

    @log_and_exit
    @method('com.canonical.SystemImage', out_signature='s')
    def PauseDownload(self):
        """Pause a downloading update."""
        self.loop.keepalive()
        if self._downloading.locked():
            self._api.pause()
            self._paused = True
            error_message = ''
        else:
            error_message = 'not downloading'
        return error_message

    @log_and_exit
    @method('com.canonical.SystemImage', out_signature='s')
    def CancelUpdate(self):
        """Cancel a download."""
        self.loop.keepalive()
        # During the download, this will cause an UpdateFailed signal to be
        # issued, as part of the exception handling in _download().  If we're
        # not downloading, then no signal need be sent.  There's no need to
        # send *another* signal when downloading, because we never will be
        # downloading by the time we get past this next call.
        self._api.cancel()
        # XXX 2013-08-22: If we can't cancel the current download, return the
        # reason in this string.
        return ''

    @log_and_exit
    def _apply_update(self):
        self.loop.keepalive()
        if not self._applicable:
            command_file = os.path.join(config.updater.cache_partition,
                                        'ubuntu_command')
            if not os.path.exists(command_file):
                # Not enough has been downloaded to allow for the update to be
                # applied.
                self.Applied(False)
                return
        self._api.apply()
        # This code may or may not run.  On devices for which applying the
        # update requires a system reboot, we're racing against that reboot
        # procedure.
        self._applicable = False
        self.Applied(True)

    @log_and_exit
    @method('com.canonical.SystemImage')
    def ApplyUpdate(self):
        """Apply the update, rebooting the device."""
        GLib.timeout_add(50, self._apply_update)
        return ''

    @log_and_exit
    @method('com.canonical.SystemImage')
    def ForceAllowGSMDownload(self):  # pragma: no curl
        """Force an existing group download to proceed over GSM."""
        log.info('Mediator {}', self._api)
        self._api.allow_gsm()
        return ''

    @log_and_exit
    @method('com.canonical.SystemImage', out_signature='a{ss}')
    def Information(self):
        self.loop.keepalive()
        settings = Settings()
        current_build_number = str(config.build_number)
        version_detail = getattr(config.service, 'version_detail', '')
        response = dict(
            current_build_number=current_build_number,
            device_name=config.device,
            channel_name=config.channel,
            last_update_date=last_update_date(),
            version_detail=version_detail,
            last_check_date=settings.get('last_check_date'),
        )
        if self._update is None:
            response['target_build_number'] = '-1'
            response['target_version_detail'] = ''
        elif not self._update.is_available:
            response['target_build_number'] = current_build_number
            response['target_version_detail'] = version_detail
        else:
            response['target_build_number'] = str(self._update.version)
            response['target_version_detail'] = self._update.version_detail
        return response

    @log_and_exit
    @method('com.canonical.SystemImage', in_signature='ss')
    def SetSetting(self, key, value):
        """Set a key/value setting.

        Some values are special, e.g. min_battery and auto_downloads.
        Implement these special semantics here.
        """
        self.loop.keepalive()
        if key == 'min_battery':
            try:
                as_int = int(value)
            except ValueError:
                return
            if as_int < 0 or as_int > 100:
                return
        if key == 'auto_download':
            try:
                as_int = int(value)
            except ValueError:
                return
            if as_int not in (0, 1, 2):
                return
        settings = Settings()
        old_value = settings.get(key)
        settings.set(key, value)
        if value != old_value:
            # Send the signal.
            self.SettingChanged(key, value)

    @log_and_exit
    @method('com.canonical.SystemImage', in_signature='s', out_signature='s')
    def GetSetting(self, key):
        """Get a setting."""
        self.loop.keepalive()
        return Settings().get(key)

    @log_and_exit
    @method('com.canonical.SystemImage')
    def FactoryReset(self):
        self._api.factory_reset()

    @log_and_exit
    @method('com.canonical.SystemImage')
    def ProductionReset(self):
        self._api.production_reset()

    @log_and_exit
    @method('com.canonical.SystemImage')
    def Exit(self):
        """Quit the daemon immediately."""
        self.loop.quit()

    @log_and_exit
    @method('com.canonical.SystemImage', out_signature='as')
    def GetChannels(self):
        """Get channels from system server."""
        ret = list()
        channels = self._api.get_channels()
        if channels:
            for key in channels:
                if not key["hidden"] and not key["alias"] and not key[
                        "redirect"]:
                    ret.append(key["name"])
        log.info('Channels {}', ret)
        return ret

    @log_and_exit
    @method('com.canonical.SystemImage', in_signature='s', out_signature='b')
    def SetChannel(self, channel):
        """Set channel to get updates from"""
        return self._api.set_channel(channel)

    @log_and_exit
    @method('com.canonical.SystemImage', in_signature='i')
    def SetBuild(self, build):
        """Set build to get updates from"""
        self._api.set_build(build)

    @log_and_exit
    @method('com.canonical.SystemImage', out_signature='s')
    def GetChannel(self):
        """Get channel to get updates from"""
        return self._api.get_channel()

    @log_and_exit
    @method('com.canonical.SystemImage', out_signature='i')
    def GetBuild(self):
        """Get build to get updates from"""
        return self._api.get_build()

    @log_and_exit
    @method('com.canonical.SystemImage', out_signature='b')
    def SupportsFirmwareUpdate(self):
        """Check if device supports firmware update"""
        return self._api.supports_firmware_update

    @log_and_exit
    @method('com.canonical.SystemImage', out_signature='s')
    def CheckForFirmwareUpdate(self):
        """Check for firmware update"""
        return self._api.check_for_firmware_update()

    @log_and_exit
    @method('com.canonical.SystemImage', out_signature='s')
    def UpdateFirmware(self):
        """Update firmware"""
        return self._api.update_firmware()

    @log_and_exit
    @method('com.canonical.SystemImage')
    def Reboot(self):
        """Reboot"""
        self._api.reboot()

    @log_and_exit
    @signal('com.canonical.SystemImage', signature='bbsiss')
    def UpdateAvailableStatus(self, is_available, downloading,
                              available_version, update_size, last_update_date,
                              error_reason):
        """Signal sent in response to a CheckForUpdate()."""
        # For .Information()'s last_check_date value.
        iso8601_now = datetime.now().replace(microsecond=0).isoformat(sep=' ')
        Settings().set('last_check_date', iso8601_now)
        log.debug('EMIT UpdateAvailableStatus({}, {}, {}, {}, {}, {})',
                  is_available, downloading, available_version, update_size,
                  last_update_date, repr(error_reason))
        self.loop.keepalive()

    @log_and_exit
    @signal('com.canonical.SystemImage')
    def DownloadStarted(self):
        """The download has started."""
        log.debug('EMIT DownloadStarted()')
        self.loop.keepalive()

    #@log_and_exit
    @signal('com.canonical.SystemImage', signature='id')
    def UpdateProgress(self, percentage, eta):
        """Download progress."""
        log.debug('EMIT UpdateProgress({}, {})', percentage, eta)
        self.loop.keepalive()

    @log_and_exit
    @signal('com.canonical.SystemImage')
    def UpdateDownloaded(self):
        """The update has been successfully downloaded."""
        log.debug('EMIT UpdateDownloaded()')
        self.loop.keepalive()

    @log_and_exit
    @signal('com.canonical.SystemImage', signature='is')
    def UpdateFailed(self, consecutive_failure_count, last_reason):
        """The update failed for some reason."""
        log.debug('EMIT UpdateFailed({}, {})', consecutive_failure_count,
                  repr(last_reason))
        self.loop.keepalive()

    @log_and_exit
    @signal('com.canonical.SystemImage', signature='i')
    def UpdatePaused(self, percentage):
        """The download got paused."""
        log.debug('EMIT UpdatePaused({})', percentage)
        self.loop.keepalive()

    @log_and_exit
    @signal('com.canonical.SystemImage', signature='ss')
    def SettingChanged(self, key, new_value):
        """A setting value has change."""
        log.debug('EMIT SettingChanged({}, {})', repr(key), repr(new_value))
        self.loop.keepalive()

    @log_and_exit
    @signal('com.canonical.SystemImage', signature='b')
    def Applied(self, status):
        """The update has been applied."""
        log.debug('EMIT Applied({})', status)
        self.loop.keepalive()

    @log_and_exit
    @signal('com.canonical.SystemImage', signature='b')
    def Rebooting(self, status):
        """The system is rebooting."""
        # We don't need to keep the loop alive since we're probably just going
        # to shutdown anyway.
        log.debug('EMIT Rebooting({})', status)
예제 #17
0
 def test_update_available_version(self):
     # An update is available.  What's the target version number?
     self._setup_server_keyrings()
     update = Mediator().check_for_update()
     self.assertEqual(update.version, '1600')
예제 #18
0
 def test_update_available(self):
     # Because our build number is lower than the latest available in the
     # index file, there is an update available.
     self._setup_server_keyrings()
     update = Mediator().check_for_update()
     self.assertTrue(update.is_available)
예제 #19
0
 def test_update_available_version(self):
     # An update is available.  What's the target version number?
     self._setup_server_keyrings()
     update = Mediator().check_for_update()
     self.assertEqual(update.version_detail,
                      'ubuntu=101,raw-device=201,version=301')