@Test
  public void testDoNotUpdateDeviceWhenReadOnlyIsNotChanged() {
    final UpdateVmDiskParameters parameters = createParameters();
    parameters.getDiskInfo().setReadOnly(false);

    when(diskDao.get(diskImageGuid)).thenReturn(createDiskImage());
    initializeCommand(parameters);
    mockVdsCommandSetVolumeDescription();
    command.executeVmCommand();

    verify(command, atLeast(1)).updateReadOnlyRequested();
    assertFalse(command.updateReadOnlyRequested());
    verify(vmDeviceDao, never()).update(any(VmDevice.class));
  }
  @Test
  public void testUpdateReadOnlyPropertyOnChange() {
    // Disk should be updated as Read Only
    final UpdateVmDiskParameters parameters = createParameters();
    parameters.getDiskInfo().setReadOnly(true);

    when(diskDao.get(diskImageGuid)).thenReturn(createDiskImage());
    initializeCommand(parameters);
    stubVmDevice(diskImageGuid, vmId);
    mockVdsCommandSetVolumeDescription();
    command.executeVmCommand();

    verify(command, atLeast(1)).updateReadOnlyRequested();
    assertTrue(command.updateReadOnlyRequested());
    verify(vmDeviceDao).update(any(VmDevice.class));
  }