[GH-ISSUE #569] How to add a disk to exist instance? #431

Open
opened 2026-02-27 16:39:16 +03:00 by kerem · 3 comments
Owner

Originally created by @higkoo on GitHub (Jul 17, 2015).
Original GitHub issue: https://github.com/retspen/webvirtmgr/issues/569

I want to add a new disk to an exist instance.

What can I do for this?

Thanks

Originally created by @higkoo on GitHub (Jul 17, 2015). Original GitHub issue: https://github.com/retspen/webvirtmgr/issues/569 I want to add a new disk to an exist instance. What can I do for this? Thanks
Author
Owner

@chamambom commented on GitHub (Jul 17, 2015):

for all my instances that needed resizing ,i always used this link

http://michael.orlitzky.com/articles/resizing_a_kvm_or_qemu_disk_image.php

i am not too sure if that functionality is yet in webvirt ,

On Fri, Jul 17, 2015 at 12:33 PM, 楷子狐 notifications@github.com wrote:

I want to add a new disk to an exist instance.

What can I do for this?

Thanks


Reply to this email directly or view it on GitHub
https://github.com/retspen/webvirtmgr/issues/569.

<!-- gh-comment-id:122249810 --> @chamambom commented on GitHub (Jul 17, 2015): for all my instances that needed resizing ,i always used this link http://michael.orlitzky.com/articles/resizing_a_kvm_or_qemu_disk_image.php i am not too sure if that functionality is yet in webvirt , On Fri, Jul 17, 2015 at 12:33 PM, 楷子狐 notifications@github.com wrote: > I want to add a new disk to an exist instance. > > What can I do for this? > > Thanks > > — > Reply to this email directly or view it on GitHub > https://github.com/retspen/webvirtmgr/issues/569.
Author
Owner

@rainsun commented on GitHub (Aug 24, 2015):

I think you should create a new disk from storage page, and add this disk into the xml file of this server.
then reboot it, you will find everything is ok.

<!-- gh-comment-id:134379517 --> @rainsun commented on GitHub (Aug 24, 2015): I think you should create a new disk from storage page, and add this disk into the xml file of this server. then reboot it, you will find everything is ok.
Author
Owner

@yorks commented on GitHub (Aug 28, 2015):

There is no need to reboot, attach disk online is support by libvirt.
I added this function to my own virtMgr, like that:

$ git diff instance.py
...
+    def _attach_device(self, xml):
+        ret = self.instance.attachDevice( xml )
+        if self.get_status() == 1:
+            xmldom = self._XMLDesc(VIR_DOMAIN_XML_SECURE)
+            self._defineXML(xmldom)
+        return ret
+    def attach_disk(self, dtype, path, dev):
+        xml = """<disk type='file' device='disk'>
+                    <driver name='qemu' type='%s' cache='none'/>
+                    <source file='%s'/>
+                    <target dev='%s' bus='virtio'/>
+                 </disk> """ % (dtype, path, dev)
+        return self._attach_device( xml )

you can using: vrtManager.create.wvmCreate.create_volume to create the img,
and then using: vrtManager.instance.wvmInstance.attach_disk to attach the img to the instance.

<!-- gh-comment-id:135618733 --> @yorks commented on GitHub (Aug 28, 2015): There is no need to reboot, attach disk online is support by libvirt. I added this function to my own virtMgr, like that: ``` $ git diff instance.py ... + def _attach_device(self, xml): + ret = self.instance.attachDevice( xml ) + if self.get_status() == 1: + xmldom = self._XMLDesc(VIR_DOMAIN_XML_SECURE) + self._defineXML(xmldom) + return ret + def attach_disk(self, dtype, path, dev): + xml = """<disk type='file' device='disk'> + <driver name='qemu' type='%s' cache='none'/> + <source file='%s'/> + <target dev='%s' bus='virtio'/> + </disk> """ % (dtype, path, dev) + return self._attach_device( xml ) ``` you can using: `vrtManager.create.wvmCreate.create_volume` to create the img, and then using: `vrtManager.instance.wvmInstance.attach_disk` to attach the img to the instance.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/webvirtmgr#431
No description provided.