Deploy GCE instance with predefined disk size or already existent disk

56 views
Skip to first unread message

Andrey Kanevsky

unread,
Oct 30, 2014, 5:53:05 PM10/30/14
to salt-...@googlegroups.com
Hi All,

Is there is any way to deploy GCE instance with predefined disk size or already existent bootable disk with image?
I know it's headache to change the disk size on GCE and request reboot, but anyway?

I've seen all the new features from 2014.7 pre-release, but how can I start the instance with non-10Gb disk instead of "salt-cloud -a attach_disk myinstance disk_name=pd mode=READ_WRITE boot=yes" where "myinstance" should be already created?

Thank you.

Eric Johnson

unread,
Oct 31, 2014, 9:00:52 AM10/31/14
to salt-...@googlegroups.com
Hi Andrey,

Currently, the GCE module (even the 2014.7 RC) doesn't support either of those use-cases.  However, the GCE module uses the libcloud library which does support specifying an existing disk, so it's possible to add that to the GCE module.  I would be happy to help review/test if you were open to taking a stab at adding this functionality (/cc @erjohnso on the github pull request).

See https://github.com/apache/libcloud/blob/trunk/libcloud/compute/drivers/gce.py#L1250 for the 'ex_boot_disk' option. You'd want to add the libcloud option around here https://github.com/saltstack/salt/blob/develop/salt/cloud/clouds/gce.py#L1870 and make sure to map it to something meaningful in the config like 'boot_disk'.

I'm not sure the timing of 2014.7, but I suspect we wouldn't be able to get this merged in considering we're on RC releases.

But if you don't have the time or aren't comfortable taking a crack at it, I can probably get to it in the next month or so (please file an issue on github and /cc @erjohnso).

Kind regards,
Eric

Andrey Kanevsky

unread,
Nov 2, 2014, 6:03:24 PM11/2/14
to salt-...@googlegroups.com
Hi Eric,

This would be great to have this kind of functionality!

Buy the way I figure out this feature, if I predefine disk with the exact name of instance and in the same zone it'll be auto attached to the instance created.
For example, if I run:
$ salt-cloud -f create_disk gce disk_name=some-instance-name-999 location=us-central1-b size=100
$ salt-cloud -p working-profile some-instance-name-999
Then I'll have instance some-instance-name-999 with disk 100Gb. By df -h it will show default 10Gb, but after fdisk+reboot+resize2fs I'll have my 100Gb.

But only question, is there is any way to create a SSD disk without gsutil? like "type pd-ssd" or something?

Thank you.

пятница, 31 октября 2014 г., 15:00:52 UTC+2 пользователь Eric Johnson написал:

sadde...@sparkcognition.com

unread,
Oct 13, 2017, 7:43:41 PM10/13/17
to Salt-users
What's disk+reboot+resize2fs?
how to execute this command? Can you give a clear explanation. I am new to this. 

sadde...@sparkcognition.com

unread,
Oct 13, 2017, 10:27:29 PM10/13/17
to Salt-users
Is there any chance to create pre defined size of boot disk of a google cloud instance using salt?
Reply all
Reply to author
Forward
0 new messages