예제 #1
0
 def _CreateVm(self):
     vm_spec = azure_virtual_machine.AzureVmSpec(
         'test_vm_spec.Azure',
         zone='eastus2',
         machine_type='test_machine_type')
     return azure_virtual_machine.Ubuntu1604BasedAzureVirtualMachine(
         vm_spec)
예제 #2
0
  def DoAzureDiskTest(self, storage_type, disk_type, machine_type,
                      goal_media, goal_replication,
                      goal_host_caching, disk_size=2,
                      goal_size=2, goal_stripes=1):
    FLAGS.azure_storage_type = storage_type
    FLAGS.azure_host_caching = goal_host_caching
    disk_spec = disk.BaseDiskSpec(_COMPONENT, disk_size=disk_size,
                                  disk_type=disk_type,
                                  num_striped_disks=goal_stripes)

    vm_spec = azure_virtual_machine.AzureVmSpec(
        'test_vm_spec.AZURE', zone='eastus2', machine_type=machine_type)
    vm = azure_virtual_machine.Ubuntu1604BasedAzureVirtualMachine(vm_spec)

    azure_disk.AzureDisk.Create = mock.Mock()
    azure_disk.AzureDisk.Attach = mock.Mock()
    vm.StripeDisks = mock.Mock()
    vm.CreateScratchDisk(disk_spec)

    expected = {disk.MEDIA: goal_media,
                disk.REPLICATION: goal_replication,
                'num_stripes': goal_stripes,
                'size': goal_size}
    if goal_host_caching:
      expected[azure_disk.HOST_CACHING] = goal_host_caching
    self.assertDictContainsSubset(expected, vm.scratch_disks[0].metadata)