Bug 760795

Summary: support renaming a volume -- virStorageVolumeRename
Product: [Community] Virtualization Tools Reporter: alekibango
Component: libvirtAssignee: Libvirt Maintainers <libvirt-maint>
Status: CLOSED NOTABUG QA Contact: Michal Privoznik <mprivozn>
Severity: low Docs Contact:
Priority: unspecified    
Version: unspecifiedCC: crobinso, mprivozn, xen-maint
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: All   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-03-23 14:40:48 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description alekibango 2011-12-07 00:53:55 UTC
Description of problem:

i want to rename volume using libvirt api, but i am unable to do so --  I have to use all kinds of other tools to achieve the needed result.

what should be done: implement virStorageVolumeRename which will rename the volume (using the same pool)...

Comment 1 alekibango 2011-12-07 01:55:40 UTC
see also https://bugzilla.redhat.com/show_bug.cgi?id=760796 -- moving volume to another pool would be very nice to have supported in api.

Comment 2 Michal Privoznik 2013-04-12 06:56:46 UTC
I don't think you are unable to rename a volume or any other object using libvirt. I know this bug went stale, but anyway. You can use combination of virStorageVolGetXMLDesc(), virStorageVolCreateXML() and virStorageVolDelete() you can rename any volume. Just change name and UUID between 1st and 2nd step.

In fact, this is an undocumented feature of virsh as well: if you virsh *edit $obj; change <name> and remove <uuid> (or change it to a non-existing one), you effectively create a clone of the object. Then use just virsh undefine $obj; to undefine original object.

Hence, I am suggesting to close this as NOTABUG. Any ideas?

Comment 3 Cole Robinson 2016-03-23 14:40:48 UTC
Closing as NOTABUG per comment #2