Ejemplo n.º 1
0
    def test_host_caching_for_docopts(self):
        # No cache
        host_caching_docopts = self.__host_caching_docopts('--no-cache')
        assert Defaults.host_caching_for_docopts(host_caching_docopts) == 'None'
        # read-only cache
        host_caching_docopts = self.__host_caching_docopts('--read-only-cache')
        assert Defaults.host_caching_for_docopts(host_caching_docopts) == \
            'ReadOnly'

        # read-write cache
        host_caching_docopts = self.__host_caching_docopts('--read-write-cache')
        assert Defaults.host_caching_for_docopts(host_caching_docopts) == \
            'ReadWrite'
Ejemplo n.º 2
0
 def __attach(self):
     self.validate_at_least_one_argument_is_set(
         ['--disk-name', '--blob-name'])
     optional_args = {}
     if self.command_args['--label']:
         optional_args['label'] = self.command_args['--label']
     if self.command_args['--lun']:
         optional_args['lun'] = int(self.command_args['--lun'])
     if self.command_args['--blob-name']:
         optional_args['blob_name'] = self.command_args['--blob-name']
     if (self.command_args['--no-cache']
             or self.command_args['--read-only-cache']
             or self.command_args['--read-write-cache']):
         optional_args['host_caching'] = Defaults.host_caching_for_docopts(
             self.command_args)
     request_id = self.data_disk.attach(
         self.command_args['--disk-name'],
         self.command_args['--cloud-service-name'],
         self.command_args['--instance-name'], **optional_args)
     request_params = [
         self.command_args['--cloud-service-name'],
         (self.command_args['--instance-name']
          or self.command_args['--cloud-service-name']),
         int(self.data_disk.attached_lun)
     ]
     self.result.add('data-disk attach:%s:%s:%d' % tuple(request_params),
                     request_id)
     if self.command_args['--wait']:
         self.request_wait(request_id)
     self.out.display()
Ejemplo n.º 3
0
 def test_default_host_caching_for_docopts(self):
     host_caching_docopts = self.__host_caching_docopts()
     assert Defaults.host_caching_for_docopts(host_caching_docopts) == \
         'ReadOnly'