Compare commits
6 Commits
Author | SHA1 | Date | |
---|---|---|---|
fe15bdb854 | |||
b851a6209c | |||
5ceb57e540 | |||
62c84664fc | |||
66f1ac35ab | |||
529f99841d |
@ -20,6 +20,14 @@ To get started with PVC, please see the [About](https://parallelvirtualcluster.r
|
||||
|
||||
## Changelog
|
||||
|
||||
#### v0.9.16
|
||||
|
||||
* Improves some CLI help messages
|
||||
* Skips empty local cluster in CLI
|
||||
* Adjusts how confirmations happen during VM modify restarts
|
||||
* Fixes bug around corrupted VM log files
|
||||
* Fixes bug around subprocess pipe exceptions
|
||||
|
||||
#### v0.9.15
|
||||
|
||||
* [CLI] Adds additional verification (--yes) to several VM management commands
|
||||
|
@ -26,7 +26,7 @@ import pvcapid.flaskapi as pvc_api
|
||||
##########################################################
|
||||
|
||||
# Version string for startup output
|
||||
version = '0.9.15'
|
||||
version = '0.9.16'
|
||||
|
||||
if pvc_api.config['ssl_enabled']:
|
||||
context = (pvc_api.config['ssl_cert_file'], pvc_api.config['ssl_key_file'])
|
||||
|
@ -331,11 +331,7 @@ def cluster_list():
|
||||
if os.path.isfile(cfgfile):
|
||||
description, address, port, scheme, api_key = read_from_yaml(cfgfile)
|
||||
else:
|
||||
description = 'N/A'
|
||||
address = 'N/A'
|
||||
port = 'N/A'
|
||||
scheme = 'N/A'
|
||||
api_key = 'N/A'
|
||||
continue
|
||||
else:
|
||||
address = cluster_details.get('host', 'N/A')
|
||||
description = cluster_details.get('description', 'N/A')
|
||||
@ -735,12 +731,6 @@ def vm_modify(domain, cfgfile, editor, restart, confirm_flag):
|
||||
if not retcode and not vm_information.get('name', None):
|
||||
cleanup(False, 'ERROR: Could not find VM "{}"!'.format(domain))
|
||||
|
||||
if restart and not confirm_flag and not config['unsafe']:
|
||||
try:
|
||||
click.confirm('Restart VM {} after applying change'.format(domain), prompt_suffix='? ', abort=True)
|
||||
except Exception:
|
||||
exit(0)
|
||||
|
||||
dom_name = vm_information.get('name')
|
||||
|
||||
if editor is True:
|
||||
@ -756,6 +746,14 @@ def vm_modify(domain, cfgfile, editor, restart, confirm_flag):
|
||||
else:
|
||||
new_vm_cfgfile = new_vm_cfgfile.strip()
|
||||
|
||||
# We're operating in replace mode
|
||||
else:
|
||||
# Open the XML file
|
||||
new_vm_cfgfile = cfgfile.read()
|
||||
cfgfile.close()
|
||||
|
||||
click.echo('Replacing configuration of VM "{}" with file "{}".'.format(dom_name, cfgfile.name))
|
||||
|
||||
# Show a diff and confirm
|
||||
click.echo('Pending modifications:')
|
||||
click.echo('')
|
||||
@ -771,24 +769,6 @@ def vm_modify(domain, cfgfile, editor, restart, confirm_flag):
|
||||
click.echo(line)
|
||||
click.echo('')
|
||||
|
||||
click.confirm('Write modifications to cluster?', abort=True)
|
||||
|
||||
if restart:
|
||||
click.echo('Writing modified configuration of VM "{}" and restarting.'.format(dom_name))
|
||||
else:
|
||||
click.echo('Writing modified configuration of VM "{}".'.format(dom_name))
|
||||
|
||||
# We're operating in replace mode
|
||||
else:
|
||||
# Open the XML file
|
||||
new_vm_cfgfile = cfgfile.read()
|
||||
cfgfile.close()
|
||||
|
||||
if restart:
|
||||
click.echo('Replacing configuration of VM "{}" with file "{}" and restarting.'.format(dom_name, cfgfile.name))
|
||||
else:
|
||||
click.echo('Replacing configuration of VM "{}" with file "{}".'.format(dom_name, cfgfile.name))
|
||||
|
||||
# Verify our XML is sensible
|
||||
try:
|
||||
xml_data = etree.fromstring(new_vm_cfgfile)
|
||||
@ -796,6 +776,14 @@ def vm_modify(domain, cfgfile, editor, restart, confirm_flag):
|
||||
except Exception as e:
|
||||
cleanup(False, 'Error: XML is malformed or invalid: {}'.format(e))
|
||||
|
||||
click.confirm('Write modifications to cluster?', abort=True)
|
||||
|
||||
if restart and not confirm_flag and not config['unsafe']:
|
||||
try:
|
||||
click.confirm('Restart VM {}'.format(domain), prompt_suffix='? ', abort=True)
|
||||
except Exception:
|
||||
restart = False
|
||||
|
||||
retcode, retmsg = pvc_vm.vm_modify(config, domain, new_cfg, restart)
|
||||
if retcode and not restart:
|
||||
retmsg = retmsg + " Changes will be applied on next VM start/restart."
|
||||
@ -1151,23 +1139,23 @@ def vm_vcpu_set(domain, vcpus, topology, restart, confirm_flag):
|
||||
|
||||
By default, the topology of the vCPus is 1 socket, VCPUS cores per socket, 1 thread per core.
|
||||
"""
|
||||
if restart and not confirm_flag and not config['unsafe']:
|
||||
try:
|
||||
click.confirm('Restart VM {} after applying change'.format(domain), prompt_suffix='? ', abort=True)
|
||||
except Exception:
|
||||
exit(0)
|
||||
|
||||
if topology is not None:
|
||||
try:
|
||||
sockets, cores, threads = topology.split(',')
|
||||
if sockets * cores * threads != vcpus:
|
||||
raise
|
||||
except Exception:
|
||||
cleanup(False, "The topology specified is not valid.")
|
||||
cleanup(False, "The specified topology is not valid.")
|
||||
topology = (sockets, cores, threads)
|
||||
else:
|
||||
topology = (1, vcpus, 1)
|
||||
|
||||
if restart and not confirm_flag and not config['unsafe']:
|
||||
try:
|
||||
click.confirm('Restart VM {}'.format(domain), prompt_suffix='? ', abort=True)
|
||||
except Exception:
|
||||
restart = False
|
||||
|
||||
retcode, retmsg = pvc_vm.vm_vcpus_set(config, domain, vcpus, topology, restart)
|
||||
if retcode and not restart:
|
||||
retmsg = retmsg + " Changes will be applied on next VM start/restart."
|
||||
@ -1234,9 +1222,9 @@ def vm_memory_set(domain, memory, restart, confirm_flag):
|
||||
"""
|
||||
if restart and not confirm_flag and not config['unsafe']:
|
||||
try:
|
||||
click.confirm('Restart VM {} after applying change'.format(domain), prompt_suffix='? ', abort=True)
|
||||
click.confirm('Restart VM {}'.format(domain), prompt_suffix='? ', abort=True)
|
||||
except Exception:
|
||||
exit(0)
|
||||
restart = False
|
||||
|
||||
retcode, retmsg = pvc_vm.vm_memory_set(config, domain, memory, restart)
|
||||
if retcode and not restart:
|
||||
@ -1319,9 +1307,9 @@ def vm_network_add(domain, vni, macaddr, model, restart, confirm_flag):
|
||||
"""
|
||||
if restart and not confirm_flag and not config['unsafe']:
|
||||
try:
|
||||
click.confirm('Restart VM {} after applying change'.format(domain), prompt_suffix='? ', abort=True)
|
||||
click.confirm('Restart VM {}'.format(domain), prompt_suffix='? ', abort=True)
|
||||
except Exception:
|
||||
exit(0)
|
||||
restart = False
|
||||
|
||||
retcode, retmsg = pvc_vm.vm_networks_add(config, domain, vni, macaddr, model, restart)
|
||||
if retcode and not restart:
|
||||
@ -1355,9 +1343,9 @@ def vm_network_remove(domain, vni, restart, confirm_flag):
|
||||
"""
|
||||
if restart and not confirm_flag and not config['unsafe']:
|
||||
try:
|
||||
click.confirm('Restart VM {} after applying change'.format(domain), prompt_suffix='? ', abort=True)
|
||||
click.confirm('Restart VM {}'.format(domain), prompt_suffix='? ', abort=True)
|
||||
except Exception:
|
||||
exit(0)
|
||||
restart = False
|
||||
|
||||
retcode, retmsg = pvc_vm.vm_networks_remove(config, domain, vni, restart)
|
||||
if retcode and not restart:
|
||||
@ -1448,9 +1436,9 @@ def vm_volume_add(domain, volume, disk_id, bus, disk_type, restart, confirm_flag
|
||||
"""
|
||||
if restart and not confirm_flag and not config['unsafe']:
|
||||
try:
|
||||
click.confirm('Restart VM {} after applying change'.format(domain), prompt_suffix='? ', abort=True)
|
||||
click.confirm('Restart VM {}'.format(domain), prompt_suffix='? ', abort=True)
|
||||
except Exception:
|
||||
exit(0)
|
||||
restart = False
|
||||
|
||||
retcode, retmsg = pvc_vm.vm_volumes_add(config, domain, volume, disk_id, bus, disk_type, restart)
|
||||
if retcode and not restart:
|
||||
@ -1484,9 +1472,9 @@ def vm_volume_remove(domain, vni, restart, confirm_flag):
|
||||
"""
|
||||
if restart and not confirm_flag and not config['unsafe']:
|
||||
try:
|
||||
click.confirm('Restart VM {} after applying change'.format(domain), prompt_suffix='? ', abort=True)
|
||||
click.confirm('Restart VM {}'.format(domain), prompt_suffix='? ', abort=True)
|
||||
except Exception:
|
||||
exit(0)
|
||||
restart = False
|
||||
|
||||
retcode, retmsg = pvc_vm.vm_volumes_remove(config, domain, vni, restart)
|
||||
if retcode and not restart:
|
||||
@ -1775,6 +1763,7 @@ def net_modify(vni, description, domain, name_servers, ip6_network, ip6_gateway,
|
||||
Modify details of virtual network VNI. All fields optional; only specified fields will be updated.
|
||||
|
||||
Example:
|
||||
|
||||
pvc network modify 1001 --gateway 10.1.1.1 --dhcp
|
||||
"""
|
||||
|
||||
@ -2389,14 +2378,16 @@ def ceph_pool():
|
||||
default='copies=3,mincopies=2', show_default=True, required=False,
|
||||
help="""
|
||||
The replication configuration, specifying both a "copies" and "mincopies" value, separated by a
|
||||
comma, e.g. "copies=3,mincopies=2". The "copies" value specifies the total number of replicas and should not exceed the total number of nodes; the "mincopies" value specifies the minimum number of available copies to allow writes. For additional details please see the Cluster Architecture documentation.
|
||||
comma, e.g. "copies=3,mincopies=2". The "copies" value specifies the total number of replicas
|
||||
and should not exceed the total number of nodes; the "mincopies" value specifies the minimum
|
||||
number of available copies to allow writes. For additional details please see the Cluster
|
||||
Architecture documentation.
|
||||
"""
|
||||
)
|
||||
@cluster_req
|
||||
def ceph_pool_add(name, pgs, replcfg):
|
||||
"""
|
||||
Add a new Ceph RBD pool with name NAME and PGS placement groups.
|
||||
|
||||
"""
|
||||
|
||||
retcode, retmsg = pvc_ceph.ceph_pool_add(config, name, pgs, replcfg)
|
||||
@ -4198,9 +4189,13 @@ def status_cluster(oformat):
|
||||
Show basic information and health for the active PVC cluster.
|
||||
|
||||
Output formats:
|
||||
|
||||
plain: Full text, full colour output for human-readability.
|
||||
|
||||
short: Health-only, full colour output for human-readability.
|
||||
|
||||
json: Compact JSON representation for machine parsing.
|
||||
|
||||
json-pretty: Pretty-printed JSON representation for machine parsing or human-readability.
|
||||
"""
|
||||
|
||||
|
10
debian/changelog
vendored
10
debian/changelog
vendored
@ -1,3 +1,13 @@
|
||||
pvc (0.9.16-0) unstable; urgency=high
|
||||
|
||||
* Improves some CLI help messages
|
||||
* Skips empty local cluster in CLI
|
||||
* Adjusts how confirmations happen during VM modify restarts
|
||||
* Fixes bug around corrupted VM log files
|
||||
* Fixes bug around subprocess pipe exceptions
|
||||
|
||||
-- Joshua M. Boniface <joshua@boniface.me> Mon, 10 May 2021 01:13:21 -0400
|
||||
|
||||
pvc (0.9.15-0) unstable; urgency=high
|
||||
|
||||
* [CLI] Adds additional verification (--yes) to several VM management commands
|
||||
|
@ -18,6 +18,14 @@ To get started with PVC, please see the [About](https://parallelvirtualcluster.r
|
||||
|
||||
## Changelog
|
||||
|
||||
#### v0.9.16
|
||||
|
||||
* Improves some CLI help messages
|
||||
* Skips empty local cluster in CLI
|
||||
* Adjusts how confirmations happen during VM modify restarts
|
||||
* Fixes bug around corrupted VM log files
|
||||
* Fixes bug around subprocess pipe exceptions
|
||||
|
||||
#### v0.9.15
|
||||
|
||||
* [CLI] Adds additional verification (--yes) to several VM management commands
|
||||
|
@ -53,7 +53,7 @@ import pvcnoded.CephInstance as CephInstance
|
||||
import pvcnoded.MetadataAPIInstance as MetadataAPIInstance
|
||||
|
||||
# Version string for startup output
|
||||
version = '0.9.15'
|
||||
version = '0.9.16'
|
||||
|
||||
###############################################################################
|
||||
# PVCD - node daemon startup program
|
||||
|
@ -44,6 +44,13 @@ class VMConsoleWatcherInstance(object):
|
||||
open(self.logfile, 'a').close()
|
||||
os.chmod(self.logfile, 0o600)
|
||||
|
||||
try:
|
||||
self.logdeque = deque(open(self.logfile), self.console_log_lines)
|
||||
except UnicodeDecodeError:
|
||||
# There is corruption in the log file; overwrite it
|
||||
self.logger.out('Failed to decode console log file; clearing existing file', state='w', prefix='Domain {}'.format(self.domuuid))
|
||||
with open(self.logfile, 'w') as lfh:
|
||||
lfh.write('\n')
|
||||
self.logdeque = deque(open(self.logfile), self.console_log_lines)
|
||||
|
||||
self.stamp = None
|
||||
|
@ -91,6 +91,8 @@ def run_os_command(command_string, background=False, environment=None, timeout=N
|
||||
retcode = command_output.returncode
|
||||
except subprocess.TimeoutExpired:
|
||||
retcode = 128
|
||||
except Exception:
|
||||
retcode = 255
|
||||
|
||||
try:
|
||||
stdout = command_output.stdout.decode('ascii')
|
||||
|
Reference in New Issue
Block a user