From 220b27c6a88482bf00ef06f2ee616166b81d2b53 Mon Sep 17 00:00:00 2001 From: Peter Iannucci Date: Thu, 12 Feb 2009 23:11:33 -0500 Subject: [PATCH 01/16] Updated changelog. svn path=/trunk/packages/invirt-remote/; revision=2106 --- debian/changelog | 6 ++++++ server/usr/sbin/invirt-remote-create | 1 - 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index 15474f7..cbd414b 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +invirt-remote (0.3.3) unstable; urgency=low + + * added remctl web availability to calculate memory available to new VMs + + -- Peter A. Iannucci Thu, 12 Feb 2009 23:10:31 -0500 + invirt-remote (0.3.2) unstable; urgency=low * in invirt-remote-listvms, ignore another way VMs can disappear diff --git a/server/usr/sbin/invirt-remote-create b/server/usr/sbin/invirt-remote-create index 714d846..991b3c8 100755 --- a/server/usr/sbin/invirt-remote-create +++ b/server/usr/sbin/invirt-remote-create @@ -15,7 +15,6 @@ import yaml def choose_host(): # Query each of the hosts. - # XXX will the output of 'xm info' always be parseable YAML? results = bcast('availability') return max((int(o), s) for (s, o) in results)[1] -- 1.7.9.5 From 7339891c2377d09611ba01b2f2496ae3aa151329 Mon Sep 17 00:00:00 2001 From: Peter Iannucci Date: Thu, 12 Feb 2009 23:26:48 -0500 Subject: [PATCH 02/16] Clean-up suggestions from price. Whitespace fixes. svn path=/trunk/packages/invirt-remote/; revision=2107 --- debian/changelog | 3 ++- host/usr/sbin/invirt-availability | 16 ++++++++++------ host/usr/sbin/invirt-remote | 9 +++------ 3 files changed, 15 insertions(+), 13 deletions(-) diff --git a/debian/changelog b/debian/changelog index cbd414b..c346af3 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,8 +1,9 @@ invirt-remote (0.3.3) unstable; urgency=low * added remctl web availability to calculate memory available to new VMs + * removed remctl web info - -- Peter A. Iannucci Thu, 12 Feb 2009 23:10:31 -0500 + -- Peter A. Iannucci Thu, 12 Feb 2009 23:26:24 -0500 invirt-remote (0.3.2) unstable; urgency=low diff --git a/host/usr/sbin/invirt-availability b/host/usr/sbin/invirt-availability index 2afd5ea..93ef381 100644 --- a/host/usr/sbin/invirt-availability +++ b/host/usr/sbin/invirt-availability @@ -13,19 +13,23 @@ def parseUnits(s): return int(num) * {'kb':1, 'mb':1024}[unit.lower()] def main(argv): + """ + Calculate the amount of memory available for new VMs + The numbers returned by xm info and xm info -c are in MB + The numbers in /proc/xen/balloon have nice units + All math is done in kilobytes for consistency + Output is in MB + """ p = Popen(['/usr/sbin/xm', 'info'], stdout=PIPE) output = p.communicate()[0] if p.returncode != 0: raise RuntimeError("Command '%s' returned non-zero exit status %d" - % ('invirt-availability', p.returncode)) + % ('/usr/sbin/xm info', p.returncode)) xminfo = yaml.load(output, yaml.CSafeLoader) - # In kilobytes free_memory = int(xminfo['free_memory']) * 1024 - f = open('/proc/xen/balloon', 'r') - ballooninfo = yaml.load(f.read()) - f.close() + ballooninfo = yaml.load(open('/proc/xen/balloon', 'r').read()) currentallocation = parseUnits(ballooninfo['Current allocation']) minimumtarget = parseUnits(ballooninfo['Minimum target']) @@ -33,7 +37,7 @@ def main(argv): output = p.communicate()[0] if p.returncode != 0: raise RuntimeError("Command '%s' returned non-zero exit status %d" - % ('invirt-availability', p.returncode)) + % ('/usr/sbin/xm info -c', p.returncode)) xminfoc = yaml.load(output, yaml.CSafeLoader) # In kilobytes diff --git a/host/usr/sbin/invirt-remote b/host/usr/sbin/invirt-remote index 948d0f0..931ec4e 100755 --- a/host/usr/sbin/invirt-remote +++ b/host/usr/sbin/invirt-remote @@ -11,17 +11,14 @@ case "$TYPE" in control) # $SERVICE is hostname COMMAND=/usr/sbin/invirt-vmcontrol - ;; + ;; web) case "$SERVICE" in lvcreate|lvremove|lvrename|lvresize) COMMAND=/usr/sbin/invirt-lvm - ;; + ;; listvms) COMMAND=/usr/sbin/invirt-listvms - ;; - info) - COMMAND=/usr/sbin/xm ;; availability) COMMAND=/usr/sbin/invirt-availability @@ -34,7 +31,7 @@ case "$TYPE" in exit 34 ;; esac - ;; + ;; *) echo "ERROR: invalid command" exit 34 -- 1.7.9.5 From 91cf1fc24419d0492c890daaa70febb8ab89e1cc Mon Sep 17 00:00:00 2001 From: Peter Iannucci Date: Sat, 14 Feb 2009 18:13:55 -0500 Subject: [PATCH 03/16] Modified invirt-availability and invirt-vmcontrol to stat /etc/invirt/nocreate. svn path=/trunk/packages/invirt-remote/; revision=2113 --- debian/changelog | 8 ++++++++ host/usr/sbin/invirt-availability | 9 +++++++++ host/usr/sbin/invirt-vmcontrol | 3 +++ 3 files changed, 20 insertions(+) diff --git a/debian/changelog b/debian/changelog index c346af3..53994ea 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,11 @@ +invirt-remote (0.3.4) unstable; urgency=low + + * modified host/usr/sbin/invirt-availability and invirt-vmcontrol to stat + /etc/invirt/nocreate; if it exists, they advertise zero free memory and + refuse to create VMs + + -- Peter A. Iannucci Sat, 14 Feb 2009 18:10:54 -0500 + invirt-remote (0.3.3) unstable; urgency=low * added remctl web availability to calculate memory available to new VMs diff --git a/host/usr/sbin/invirt-availability b/host/usr/sbin/invirt-availability index 93ef381..0122a8d 100644 --- a/host/usr/sbin/invirt-availability +++ b/host/usr/sbin/invirt-availability @@ -19,7 +19,16 @@ def main(argv): The numbers in /proc/xen/balloon have nice units All math is done in kilobytes for consistency Output is in MB + + Bail if /etc/invirt/nocreate exists """ + try: + os.stat('/etc/invirt/nocreate') + print 0 + return 0 + except OSError: + pass + p = Popen(['/usr/sbin/xm', 'info'], stdout=PIPE) output = p.communicate()[0] if p.returncode != 0: diff --git a/host/usr/sbin/invirt-vmcontrol b/host/usr/sbin/invirt-vmcontrol index 70bff12..66f5ca6 100755 --- a/host/usr/sbin/invirt-vmcontrol +++ b/host/usr/sbin/invirt-vmcontrol @@ -22,6 +22,9 @@ case "$ACTION" in ;; install|create) shift; shift; + if [ -f "/etc/invirt/nocreate" ]; then + echo "Host $HOSTNAME is currently refusing VM creation." && exit 2 + fi xm list "$MACHINE" >/dev/null 2>/dev/null && echo "$MACHINE already exists" && exit 1 if [ "$ACTION" = "install" ]; then xm create invirt-database machine_name="$ORIGMACHINE" installer_options="$(printf '%q ' "$@")" -- 1.7.9.5 From b468c61207f8d10c00129b54f4143f19ea49ac08 Mon Sep 17 00:00:00 2001 From: Peter Iannucci Date: Sat, 14 Feb 2009 19:09:26 -0500 Subject: [PATCH 04/16] Fixed missing import svn path=/trunk/packages/invirt-remote/; revision=2114 --- host/usr/sbin/invirt-availability | 1 + 1 file changed, 1 insertion(+) diff --git a/host/usr/sbin/invirt-availability b/host/usr/sbin/invirt-availability index 0122a8d..26ef5c9 100644 --- a/host/usr/sbin/invirt-availability +++ b/host/usr/sbin/invirt-availability @@ -6,6 +6,7 @@ Gathers availability data for the VM host it's running on. from subprocess import PIPE, Popen, call import sys import yaml +import os # return the amount of memory in kilobytes represented by s def parseUnits(s): -- 1.7.9.5 From 2248234ffe4df0cfb4d839c12fa7694e40bcb924 Mon Sep 17 00:00:00 2001 From: Peter Iannucci Date: Mon, 16 Feb 2009 23:52:01 -0500 Subject: [PATCH 05/16] RAM quotas at remctl; RAM quota exception script, table, and usage in -web and -remote-create; /etc/nocreate support svn path=/trunk/packages/invirt-remote/; revision=2132 --- debian/changelog | 6 ++++-- server/usr/sbin/invirt-remote-create | 24 ++++++++++++++++++++++++ 2 files changed, 28 insertions(+), 2 deletions(-) diff --git a/debian/changelog b/debian/changelog index 53994ea..1c55796 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,10 +1,12 @@ invirt-remote (0.3.4) unstable; urgency=low * modified host/usr/sbin/invirt-availability and invirt-vmcontrol to stat - /etc/invirt/nocreate; if it exists, they advertise zero free memory and + /etc/invirt/nocreate; if it exists, they advertise zero free memory and refuse to create VMs + * added memory quota validation to invirt-remote-create + * added owner table to database with ram_quota_total and ram_quota_single - -- Peter A. Iannucci Sat, 14 Feb 2009 18:10:54 -0500 + -- Peter A. Iannucci Mon, 16 Feb 2009 23:49:14 -0500 invirt-remote (0.3.3) unstable; urgency=low diff --git a/server/usr/sbin/invirt-remote-create b/server/usr/sbin/invirt-remote-create index 991b3c8..bae10c0 100755 --- a/server/usr/sbin/invirt-remote-create +++ b/server/usr/sbin/invirt-remote-create @@ -12,6 +12,18 @@ from invirt.remote import bcast from subprocess import PIPE, Popen, call import sys import yaml +import invirt.database + +def maxMemory(owner, xmlist): + """ + Return the memory available for a new machine. + """ + machines = invirt.database.Machine.query().filter_by(owner=owner) + (quota_total, quota_single) = invirt.database.Owner.getQuotas(owner) + + active_machines = [m for m in machines if m.name in xmlist] + mem_usage = sum([x.memory for x in active_machines]) + return min(quota_single, quota_total-mem_usage) def choose_host(): # Query each of the hosts. @@ -49,6 +61,18 @@ def main(argv): % (machine_name, host)) return 1 + if operation == "create": + invirt.database.connect() + machine = invirt.database.Machine.query().filter_by(name=machine_name).first() + + owner = machine.owner + vm_memory = machine.memory + + max_memory = maxMemory(owner, vms.keys()) + if vm_memory > max_memory: + print >>sys.stderr, "owner %s requested %d MB of memory for vm %s; %d MB allowed" % (owner, vm_memory, machine_name, max_memory) + return 1 + host = choose_host() print 'Creating on host %s...' % host sys.stdout.flush() -- 1.7.9.5 From e1b9196f42941a70ad972951214eec684290f9f8 Mon Sep 17 00:00:00 2001 From: Peter Iannucci Date: Tue, 17 Feb 2009 01:54:26 -0500 Subject: [PATCH 06/16] Added all the other quotas for great win. svn path=/trunk/packages/invirt-remote/; revision=2134 --- debian/changelog | 3 +-- server/usr/sbin/invirt-remote-create | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/debian/changelog b/debian/changelog index 1c55796..069d9a8 100644 --- a/debian/changelog +++ b/debian/changelog @@ -4,9 +4,8 @@ invirt-remote (0.3.4) unstable; urgency=low /etc/invirt/nocreate; if it exists, they advertise zero free memory and refuse to create VMs * added memory quota validation to invirt-remote-create - * added owner table to database with ram_quota_total and ram_quota_single - -- Peter A. Iannucci Mon, 16 Feb 2009 23:49:14 -0500 + -- Peter A. Iannucci Tue, 17 Feb 2009 01:31:20 -0500 invirt-remote (0.3.3) unstable; urgency=low diff --git a/server/usr/sbin/invirt-remote-create b/server/usr/sbin/invirt-remote-create index bae10c0..3ec70a5 100755 --- a/server/usr/sbin/invirt-remote-create +++ b/server/usr/sbin/invirt-remote-create @@ -19,7 +19,7 @@ def maxMemory(owner, xmlist): Return the memory available for a new machine. """ machines = invirt.database.Machine.query().filter_by(owner=owner) - (quota_total, quota_single) = invirt.database.Owner.getQuotas(owner) + (quota_total, quota_single) = invirt.database.Owner.getMemoryQuotas(owner) active_machines = [m for m in machines if m.name in xmlist] mem_usage = sum([x.memory for x in active_machines]) -- 1.7.9.5 From 602b0bb2a5afc374482d3018398fc6c047703943 Mon Sep 17 00:00:00 2001 From: Peter Iannucci Date: Tue, 17 Feb 2009 02:16:12 -0500 Subject: [PATCH 07/16] Made some changes requested by Broder. svn path=/trunk/packages/invirt-remote/; revision=2135 --- debian/changelog | 6 ++++++ server/usr/sbin/invirt-remote-create | 7 ++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/debian/changelog b/debian/changelog index 069d9a8..3d12870 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +invirt-remote (0.3.5) unstable; urgency=low + + * updated quota support to refer to renamed owner table columns + + -- Peter A. Iannucci Tue, 17 Feb 2009 02:13:44 -0500 + invirt-remote (0.3.4) unstable; urgency=low * modified host/usr/sbin/invirt-availability and invirt-vmcontrol to stat diff --git a/server/usr/sbin/invirt-remote-create b/server/usr/sbin/invirt-remote-create index 3ec70a5..add3113 100755 --- a/server/usr/sbin/invirt-remote-create +++ b/server/usr/sbin/invirt-remote-create @@ -23,7 +23,7 @@ def maxMemory(owner, xmlist): active_machines = [m for m in machines if m.name in xmlist] mem_usage = sum([x.memory for x in active_machines]) - return min(quota_single, quota_total-mem_usage) + return min(quota_single, quota_total - mem_usage) def choose_host(): # Query each of the hosts. @@ -37,7 +37,9 @@ def main(argv): operation = argv[1] machine_name = argv[2] args = argv[3:] - + + invirt.database.connect() + if operation == 'install': options = dict(arg.split('=', 1) for arg in args) valid_keys = set(('mirror', 'dist', 'arch', 'imagesize', 'noinstall')) @@ -62,7 +64,6 @@ def main(argv): return 1 if operation == "create": - invirt.database.connect() machine = invirt.database.Machine.query().filter_by(name=machine_name).first() owner = machine.owner -- 1.7.9.5 From 2aaa523ada0a8a4d4b37fcfd2840fce2746e1a2e Mon Sep 17 00:00:00 2001 From: Anders Kaseorg Date: Tue, 17 Feb 2009 05:01:23 -0500 Subject: [PATCH 08/16] Don't confuse {KB, MB, GB} with {KiB, MiB, GiB}. svn path=/trunk/packages/invirt-remote/; revision=2161 --- debian/changelog | 6 ++++++ host/usr/sbin/invirt-availability | 15 ++++++++------- server/usr/sbin/invirt-remote-create | 2 +- 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/debian/changelog b/debian/changelog index 3d12870..6efda3f 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +invirt-remote (0.3.6) unstable; urgency=low + + * Don't confuse KB with KiB, or MB with MiB. + + -- Anders Kaseorg Tue, 17 Feb 2009 04:58:06 -0500 + invirt-remote (0.3.5) unstable; urgency=low * updated quota support to refer to renamed owner table columns diff --git a/host/usr/sbin/invirt-availability b/host/usr/sbin/invirt-availability index 26ef5c9..1dcf9c8 100644 --- a/host/usr/sbin/invirt-availability +++ b/host/usr/sbin/invirt-availability @@ -8,18 +8,19 @@ import sys import yaml import os -# return the amount of memory in kilobytes represented by s +# return the amount of memory in kibibytes represented by s def parseUnits(s): num, unit = s.split(' ') - return int(num) * {'kb':1, 'mb':1024}[unit.lower()] + assert unit == 'kB', "unexpected unit" + return int(num) def main(argv): """ Calculate the amount of memory available for new VMs - The numbers returned by xm info and xm info -c are in MB - The numbers in /proc/xen/balloon have nice units - All math is done in kilobytes for consistency - Output is in MB + The numbers returned by xm info and xm info -c are in MiB + The numbers in /proc/xen/balloon are in KiB + All math is done in kibibytes for consistency + Output is in MiB Bail if /etc/invirt/nocreate exists """ @@ -50,7 +51,7 @@ def main(argv): % ('/usr/sbin/xm info -c', p.returncode)) xminfoc = yaml.load(output, yaml.CSafeLoader) - # In kilobytes + # In kibibytes dom0minmem = int(xminfoc['dom0-min-mem']) * 1024 dom0_spare_memory = currentallocation - max(minimumtarget, dom0minmem) diff --git a/server/usr/sbin/invirt-remote-create b/server/usr/sbin/invirt-remote-create index add3113..3bffba2 100755 --- a/server/usr/sbin/invirt-remote-create +++ b/server/usr/sbin/invirt-remote-create @@ -71,7 +71,7 @@ def main(argv): max_memory = maxMemory(owner, vms.keys()) if vm_memory > max_memory: - print >>sys.stderr, "owner %s requested %d MB of memory for vm %s; %d MB allowed" % (owner, vm_memory, machine_name, max_memory) + print >>sys.stderr, "owner %s requested %d MiB of memory for vm %s; %d MiB allowed" % (owner, vm_memory, machine_name, max_memory) return 1 host = choose_host() -- 1.7.9.5 From d1207209d27ff791910c31f6c194bc78e77319c1 Mon Sep 17 00:00:00 2001 From: Evan Broder Date: Thu, 26 Feb 2009 01:18:05 -0500 Subject: [PATCH 09/16] Add a remctl to find out the availability status of all hosts. svn path=/trunk/packages/invirt-remote/; revision=2188 --- debian/changelog | 7 +++++++ server/usr/sbin/invirt-remote-availability | 15 +++++++++++++++ server/usr/sbin/invirt-remote-proxy | 2 ++ 3 files changed, 24 insertions(+) create mode 100755 server/usr/sbin/invirt-remote-availability diff --git a/debian/changelog b/debian/changelog index 6efda3f..321e411 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +invirt-remote (0.3.7) unstable; urgency=low + + * Add an availability remctl for when we get around to letting us make + web remctls. + + -- Evan Broder Thu, 26 Feb 2009 01:04:07 -0500 + invirt-remote (0.3.6) unstable; urgency=low * Don't confuse KB with KiB, or MB with MiB. diff --git a/server/usr/sbin/invirt-remote-availability b/server/usr/sbin/invirt-remote-availability new file mode 100755 index 0000000..8c128d2 --- /dev/null +++ b/server/usr/sbin/invirt-remote-availability @@ -0,0 +1,15 @@ +#!/usr/bin/python + +""" +Retrieve and print out the availability value for all Invirt hosts +""" + +from invirt import remote +import yaml +import sys + +def main(argv): + print yaml.dump(dict(remote.bcast('availability')), default_flow_style=False) + +if __name__ == '__main__': + sys.exit(main(sys.argv)) diff --git a/server/usr/sbin/invirt-remote-proxy b/server/usr/sbin/invirt-remote-proxy index f05fa65..358447c 100755 --- a/server/usr/sbin/invirt-remote-proxy +++ b/server/usr/sbin/invirt-remote-proxy @@ -16,6 +16,8 @@ case "$TYPE/$SERVICE" in invirt-remote-listvms "$@" ;; web/vnccert ) invirt-remote-vnccert "$@" ;; + web/availability ) + invirt-remote-availability "$@" ;; control/help ) invirt-remctl-help ;; control/create|control/install ) -- 1.7.9.5 From b4aa88984ee1f2eb0d11d61737099032816732a4 Mon Sep 17 00:00:00 2001 From: Evan Broder Date: Fri, 27 Feb 2009 21:35:15 -0500 Subject: [PATCH 10/16] Allow anyone on the adminacl to issue web remctls. svn path=/trunk/packages/invirt-remote/; revision=2234 --- debian/changelog | 6 ++++++ server/etc/remctl/conf.d/invirt-web | 2 +- server/usr/sbin/invirt-remconffs | 12 +++++++++++- 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/debian/changelog b/debian/changelog index 321e411..58bd62f 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +invirt-remote (0.3.8) unstable; urgency=low + + * Allow anyone on the adminacl to issue web remctls. + + -- Evan Broder Fri, 27 Feb 2009 21:28:19 -0500 + invirt-remote (0.3.7) unstable; urgency=low * Add an availability remctl for when we get around to letting us make diff --git a/server/etc/remctl/conf.d/invirt-web b/server/etc/remctl/conf.d/invirt-web index af81d8a..e0f56d2 100644 --- a/server/etc/remctl/conf.d/invirt-web +++ b/server/etc/remctl/conf.d/invirt-web @@ -1,3 +1,3 @@ -web ALL /usr/sbin/invirt-remote-proxy-web /etc/remctl/acl/web +web ALL /usr/sbin/invirt-remote-proxy-web /etc/remctl/remconffs/adminacl control help /usr/sbin/invirt-remctl-help ANYUSER help ALL /usr/sbin/invirt-remctl-help ANYUSER diff --git a/server/usr/sbin/invirt-remconffs b/server/usr/sbin/invirt-remconffs index 6421164..ac4fe15 100755 --- a/server/usr/sbin/invirt-remconffs +++ b/server/usr/sbin/invirt-remconffs @@ -14,6 +14,7 @@ class RemConfFS(routefs.RouteFS): """ RemConfFS creates a filesytem for configuring remctl, like this: / + |-- adminacl |-- acl | |-- machine1 | ... @@ -39,11 +40,12 @@ class RemConfFS(routefs.RouteFS): m.connect('', controller='getroot') m.connect('acl', controller='getmachines') m.connect('acl/:machine', controller='getacl') + m.connect('adminacl', controller='getadmin') m.connect('conf', controller='getconf') return m def getroot(self, **kw): - return ['acl', 'conf'] + return ['adminacl', 'acl', 'conf'] def getacl(self, machine, **kw): """Build the ACL file for a machine @@ -70,6 +72,14 @@ class RemConfFS(routefs.RouteFS): def getmachines(self, **kw): """Get the list of VMs in the database. Does not cache to prevent race conditions.""" return list(row[0] for row in database.session.execute(sa.sql.select([database.Machine.c.name]))) + + def getadmin(self, **kw): + """ + Get the list of administrators for the global ACL. + """ + acl = [self.userToPrinc(row[0]) for row in database.session.execute(sa.sql.select([database.admins_table.c.user]))] + acl.append('include /etc/remctl/acl/web\n') + return '\n'.join(acl) def userToPrinc(self, user): """Convert Kerberos v4-style names to v5-style and append a default -- 1.7.9.5 From b250c7823eb3f186d2632047d7857f0e7d9dc52b Mon Sep 17 00:00:00 2001 From: Evan Broder Date: Thu, 12 Mar 2009 17:21:24 -0400 Subject: [PATCH 11/16] Include a CDROM drive in listvms if there is one. svn path=/trunk/packages/invirt-remote/; revision=2245 --- debian/changelog | 6 ++++++ host/usr/sbin/invirt-listvms | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/debian/changelog b/debian/changelog index 58bd62f..de68d30 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +invirt-remote (0.3.9) unstable; urgency=low + + * Include a CDROM in listvms, if there is one. + + -- Evan Broder Thu, 12 Mar 2009 17:20:15 -0400 + invirt-remote (0.3.8) unstable; urgency=low * Allow anyone on the adminacl to issue web remctls. diff --git a/host/usr/sbin/invirt-listvms b/host/usr/sbin/invirt-listvms index c16a883..0f9d5dc 100755 --- a/host/usr/sbin/invirt-listvms +++ b/host/usr/sbin/invirt-listvms @@ -32,6 +32,12 @@ def get_dom(domid): data['vm'] = xsc.read('', '/local/domain/%d/vm' % domid) data['start_time'] = float(xsc.read('', '%s/start_time' % data['vm'])) data['uptime'] = time.time()-data['start_time'] + # CD, if there is one + vbds = xsc.ls('', '/local/domain/%d/device/vbd' % domid) + for vbd in vbds: + dev = '/local/domain/%d/device/vbd/%s' % (domid, vbd) + if xsc.read('', '%s/device-type' % dev) == 'cdrom': + data['cdrom'] = xsc.read('', '%s/params' % xsc.read('', '%s/backend' % dev)) return name, data -- 1.7.9.5 From 5af3b5d0f46ce82b148766b4dc21abf0fec08e6b Mon Sep 17 00:00:00 2001 From: Greg Price Date: Mon, 16 Mar 2009 21:27:05 -0400 Subject: [PATCH 12/16] invirt-remote: enumerate all the subcommands on proxy server svn path=/trunk/packages/invirt-remote/; revision=2255 --- debian/changelog | 6 ++++++ server/usr/sbin/invirt-remote-proxy | 6 +++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index de68d30..87483c2 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +invirt-remote (0.3.10) unstable; urgency=low + + * Let invirt-remote-proxy know all the possible subcommands. + + -- Greg Price Mon, 16 Mar 2009 21:15:38 -0400 + invirt-remote (0.3.9) unstable; urgency=low * Include a CDROM in listvms, if there is one. diff --git a/server/usr/sbin/invirt-remote-proxy b/server/usr/sbin/invirt-remote-proxy index 358447c..9a9266d 100755 --- a/server/usr/sbin/invirt-remote-proxy +++ b/server/usr/sbin/invirt-remote-proxy @@ -18,6 +18,8 @@ case "$TYPE/$SERVICE" in invirt-remote-vnccert "$@" ;; web/availability ) invirt-remote-availability "$@" ;; + web/lvcreate | web/lvremove | web/lvrename | web/lvresize ) + remctl "$(invirt-getconf hosts.0.hostname)" remote "$TYPE" "$SERVICE" "$@" ;; control/help ) invirt-remctl-help ;; control/create|control/install ) @@ -28,5 +30,7 @@ case "$TYPE/$SERVICE" in # Everything but create must go where the VM is already running. invirt-remote-control "$MACHINE" "$SERVICE" "$@" ;; * ) - remctl "$(invirt-getconf hosts.0.hostname)" remote "$TYPE" "$SERVICE" "$@" ;; + echo "ERROR: invalid subcommand" + exit 34 + ;; esac -- 1.7.9.5 From 424e7823544e54dbf31cc1f28a47a7a76d5bd950 Mon Sep 17 00:00:00 2001 From: Greg Price Date: Mon, 16 Mar 2009 21:27:10 -0400 Subject: [PATCH 13/16] accept /etc/invirt/{nolvm,nocreate} on remote-server svn path=/trunk/packages/invirt-remote/; revision=2256 --- debian/changelog | 3 ++- server/usr/sbin/invirt-remote-proxy | 8 ++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index 87483c2..b42c03f 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,8 +1,9 @@ invirt-remote (0.3.10) unstable; urgency=low * Let invirt-remote-proxy know all the possible subcommands. + * Accept /etc/invirt/{nocreate,nolvm} on remote-server. - -- Greg Price Mon, 16 Mar 2009 21:15:38 -0400 + -- Greg Price Mon, 16 Mar 2009 21:22:13 -0400 invirt-remote (0.3.9) unstable; urgency=low diff --git a/server/usr/sbin/invirt-remote-proxy b/server/usr/sbin/invirt-remote-proxy index 9a9266d..cea1bbd 100755 --- a/server/usr/sbin/invirt-remote-proxy +++ b/server/usr/sbin/invirt-remote-proxy @@ -19,10 +19,18 @@ case "$TYPE/$SERVICE" in web/availability ) invirt-remote-availability "$@" ;; web/lvcreate | web/lvremove | web/lvrename | web/lvresize ) + if [ -f "/etc/invirt/nolvm" ]; then + echo "LVM operations are temporarily disabled for maintenance, sorry." + exit 2 + fi remctl "$(invirt-getconf hosts.0.hostname)" remote "$TYPE" "$SERVICE" "$@" ;; control/help ) invirt-remctl-help ;; control/create|control/install ) + if [ -f "/etc/invirt/nocreate" ]; then + echo "Booting VMs is temporarily disabled for maintenance, sorry." + exit 2 + fi invirt-remote-create "$SERVICE" "$MACHINE" "$@" ;; control/listhost|control/list-host ) invirt-remote-listhost "$MACHINE" "$@" ;; -- 1.7.9.5 From 5456b0dc8e9ed9d121b9c2f25bdbc238482fd31b Mon Sep 17 00:00:00 2001 From: Evan Broder Date: Wed, 18 Mar 2009 19:37:55 -0400 Subject: [PATCH 14/16] In invirt-remote: * Print errors to stderr on nocreate and nolvm so that the website actually notices. svn path=/trunk/packages/invirt-remote/; revision=2264 --- debian/changelog | 7 +++++++ server/usr/sbin/invirt-remote-proxy | 4 ++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/debian/changelog b/debian/changelog index b42c03f..486cb64 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +invirt-remote (0.3.11) unstable; urgency=low + + * Print errors to stderr on nocreate and nolvm so that the website + actually notices. + + -- Evan Broder Wed, 18 Mar 2009 19:37:38 -0400 + invirt-remote (0.3.10) unstable; urgency=low * Let invirt-remote-proxy know all the possible subcommands. diff --git a/server/usr/sbin/invirt-remote-proxy b/server/usr/sbin/invirt-remote-proxy index cea1bbd..d64a7d1 100755 --- a/server/usr/sbin/invirt-remote-proxy +++ b/server/usr/sbin/invirt-remote-proxy @@ -20,7 +20,7 @@ case "$TYPE/$SERVICE" in invirt-remote-availability "$@" ;; web/lvcreate | web/lvremove | web/lvrename | web/lvresize ) if [ -f "/etc/invirt/nolvm" ]; then - echo "LVM operations are temporarily disabled for maintenance, sorry." + echo "LVM operations are temporarily disabled for maintenance, sorry." >&2 exit 2 fi remctl "$(invirt-getconf hosts.0.hostname)" remote "$TYPE" "$SERVICE" "$@" ;; @@ -28,7 +28,7 @@ case "$TYPE/$SERVICE" in invirt-remctl-help ;; control/create|control/install ) if [ -f "/etc/invirt/nocreate" ]; then - echo "Booting VMs is temporarily disabled for maintenance, sorry." + echo "Booting VMs is temporarily disabled for maintenance, sorry." >&2 exit 2 fi invirt-remote-create "$SERVICE" "$MACHINE" "$@" ;; -- 1.7.9.5 From 0ff680d9b30ea7bc90a271045fb215abab75e83e Mon Sep 17 00:00:00 2001 From: Evan Broder Date: Thu, 2 Apr 2009 01:48:08 -0400 Subject: [PATCH 15/16] In invirt-remote: * ionice the dd to wipe out deleted LVs so it doesn't hose the system. svn path=/trunk/packages/invirt-remote/; revision=2286 --- debian/changelog | 6 ++++++ debian/control | 2 +- host/usr/sbin/invirt-lvm | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/debian/changelog b/debian/changelog index 486cb64..e4b0d4d 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +invirt-remote (0.3.12) unstable; urgency=low + + * ionice the dd to wipe out deleted LVs so it doesn't hose the system. + + -- Evan Broder Thu, 02 Apr 2009 01:46:38 -0400 + invirt-remote (0.3.11) unstable; urgency=low * Print errors to stderr on nocreate and nolvm so that the website diff --git a/debian/control b/debian/control index 50e6222..c683795 100644 --- a/debian/control +++ b/debian/control @@ -22,7 +22,7 @@ Description: Invirt remote-control server Package: invirt-remote-host Architecture: all Depends: ${misc:Depends}, remctl-server, invirt-console-host, - invirt-vnc-server, python-cjson, python-yaml + invirt-vnc-server, python-cjson, python-yaml, util-linux Description: Installs the Invirt host remctl configuration This is the remctl configuration for an Invirt host. It allows any commands to be run from the Invirt remote server diff --git a/host/usr/sbin/invirt-lvm b/host/usr/sbin/invirt-lvm index 22a7805..bafcec7 100755 --- a/host/usr/sbin/invirt-lvm +++ b/host/usr/sbin/invirt-lvm @@ -68,7 +68,7 @@ if subcommand == "lvremove": # this is running non-interactively), so let's just drop them on # the floor for now. if os.fork() == 0: - call(["/bin/dd", "if=/dev/zero", "of=%s" % new_lvpath]) + call(["/usr/bin/ionice", "-c", "3", "/bin/dd", "if=/dev/zero", "of=%s" % new_lvpath]) call(["/sbin/lvchange", "-a", "n", new_lvpath]) call(["/sbin/lvchange", "-a", "ey", new_lvpath]) call(["/sbin/lvremove", "--force", new_lvpath]) -- 1.7.9.5 From 8232cba45f276a1c668ed3ce1bb544b1c728c713 Mon Sep 17 00:00:00 2001 From: Evan Broder Date: Thu, 2 Apr 2009 20:35:36 -0400 Subject: [PATCH 16/16] In invirt-remote: * availability takes way too long to type. svn path=/trunk/packages/invirt-remote/; revision=2289 --- debian/changelog | 3 ++- host/usr/sbin/invirt-remote | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/debian/changelog b/debian/changelog index e4b0d4d..1eca118 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,8 +1,9 @@ invirt-remote (0.3.12) unstable; urgency=low * ionice the dd to wipe out deleted LVs so it doesn't hose the system. + * availability takes way too long to type. - -- Evan Broder Thu, 02 Apr 2009 01:46:38 -0400 + -- Evan Broder Thu, 02 Apr 2009 20:35:17 -0400 invirt-remote (0.3.11) unstable; urgency=low diff --git a/host/usr/sbin/invirt-remote b/host/usr/sbin/invirt-remote index 931ec4e..4c78d4e 100755 --- a/host/usr/sbin/invirt-remote +++ b/host/usr/sbin/invirt-remote @@ -20,7 +20,7 @@ case "$TYPE" in listvms) COMMAND=/usr/sbin/invirt-listvms ;; - availability) + availability|avail) COMMAND=/usr/sbin/invirt-availability ;; vnccert) -- 1.7.9.5