Bug 1496394

Summary: [RFE] virt-manager should implement new rename API from libvirt
Product: [Community] Virtualization Tools Reporter: zhoujunqin <juzhou>
Component: virt-managerAssignee: Cole Robinson <crobinso>
Status: CLOSED DUPLICATE QA Contact:
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: unspecifiedCC: berrange, crobinso, gscrivan, kuwei, mxie, rbalakri, tzheng, xiaodwan, yanqzhan
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-10-11 19:03:37 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description zhoujunqin 2017-09-27 09:31:02 UTC
Description of problem:
[RFE] virt-manager should implement new rename API from libvirt

Version-Release number of selected component (if applicable):
libvirt-3.7.0-2.el7.x86_64
virt-manager-1.4.3-1.el7.noarch
qemu-kvm-rhev-2.9.0-16.el7_4.8.x86_64

How reproducible:
100%

Steps to Reproduce:
libvirt has new rename API '--domrename' to rename guest, but virt-manager use old way.
1. Prepare a inactive guest with snapshot.
# virsh domstate rhel7.4
shut off

# virsh snapshot-list rhel7.4
 Name                 Creation Time             State
------------------------------------------------------------
 s1                   2017-09-27 15:56:21 +0800 shutoff

2. Rename guest name to 'rhel7.4-new'.

2.1 From virt-manager GUI:

Launch virt-manager->Select guest and double click guest->Click 'Show virtual hardware details' button->Choose 'Overview'-> change Name to 'rhel7.4-new'->click 'Apply'

Result:
Error apply changes: Requested operation is not valid: cannot delete inactive domain with 1 snapshots

Traceback (most recent call last):
  File "/usr/share/virt-manager/virtManager/details.py", line 1887, in config_apply
    ret = self.config_overview_apply()
  File "/usr/share/virt-manager/virtManager/details.py", line 1979, in config_overview_apply
    self.vm.rename_domain(self.widget("overview-name").get_text())
  File "/usr/share/virt-manager/virtManager/domain.py", line 604, in rename_domain
    raise error
libvirtError: Requested operation is not valid: cannot delete inactive domain with 1 snapshots

2.2 with virsh command:
# virsh domrename rhel7.4 rhel7.4-name
error: Requested operation is not valid: cannot rename domain with snapshots


Actual results:
As description.

Expected results:
Implement new rename API from libvirt to virt-manager, then can make error message be accurate to user.

Additional info:
virt-manager reports same error as
# virsh undefine rhel7.4
error: Failed to undefine domain rhel7.4
error: Requested operation is not valid: cannot delete inactive domain with 1 snapshots

Comment 1 Cole Robinson 2017-10-11 19:03:37 UTC
This isn't that important to track for RHEL IMO, currently it won't add much functional benefit and will actually complicate code if we want to continue to support pre-rename libvirt versions.

So just duping this to the upstream issue tracking rename API usage

*** This bug has been marked as a duplicate of bug 1264687 ***