Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to add a disk to exist instance? #569

Open
higkoo opened this issue Jul 17, 2015 · 3 comments
Open

How to add a disk to exist instance? #569

higkoo opened this issue Jul 17, 2015 · 3 comments

Comments

@higkoo
Copy link

higkoo commented Jul 17, 2015

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

What can I do for this?

Thanks

@chamambom
Copy link

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
#569.

@rainsun
Copy link
Contributor

rainsun commented 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.

@yorks
Copy link

yorks commented 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 up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants